コード例 #1
0
ファイル: score.py プロジェクト: sh-miR/designer
def score_from_transcript(
    frame, original_frame, frame_ss, offtarget, regexp
):
    """
    Function which count score from transcript.

    Args:
        frame: backbone object
        original_frame: sh-miR object
        frame_ss: file from mfold
        offtarget: Number of transcripts
        regexp: Number of regular expression

    Returns:
        Dict of scores for: frame, offtarget, regexp and all together.
    """
    structure_points = score_structure(frame, frame_ss, original_frame)
    offtarget_points = score_offtarget(offtarget)
    regexp_points = score_regexp(regexp)
    thermostability_points = score_thermostability(frame)
    return {
        'structure': structure_points,
        'offtarget': offtarget_points,
        'regexp': regexp_points,
        'thermostability': thermostability_points,
        'all': (
            structure_points + offtarget_points +
            regexp_points + thermostability_points
        )
    }
コード例 #2
0
ファイル: test_score.py プロジェクト: sh-miR/designer
    def test_score_structure(self, mock_parse_ss, mock_parse_score):
        mock_parse_ss.return_value = 'acgtacgt'
        mock_parse_score.return_value = 4.0, [('a', 1), ('c', 4)]
        frame = MagicMock()
        original_frame = MagicMock()
        original_frame.flanks5_s = 'acgt'
        original_frame.miRNA_s = 'cgta'
        original_frame.loop_s = 'aacc'
        original_frame.flanks3_s = 'acg'
        original_frame.miRNA_a = 'aa'

        frame.flanks5_s = 'acg'
        frame.siRNA1 = 'ac'
        frame.loop_s = 'a'
        frame.siRNA2 = 'c'
        frame.flanks3_s = 'a'
        result = score_structure(frame, 'folding_file', original_frame)

        self.assertEqual(result, 250)
コード例 #3
0
ファイル: score.py プロジェクト: sh-miR/designer
def score_from_sirna(frame, original_frame, folding_file):
    """Function for getting score from siRNA.

    Args:
        frame_tuple: Tuple of frame
        original_frame: sh-miR object
        folding_file: folded structure from mfold

    Returns:
        tuple of score of frame, homogeneity and strands
    """
    structure = score_structure(frame, folding_file, original_frame)
    homogeneity = score_homogeneity(frame)
    same_ends = score_two_same_strands(frame.siRNA1, original_frame)

    return {
        'structure': structure,
        'homogeneity': homogeneity,
        'same_ends': same_ends,
        'all': structure + homogeneity + same_ends
    }