def test_dustscore_calculation():
        'It calculates the dust score'
        seqs = ['TTTTTTTTTTTTTTTTTTTTTTTTTTTT', 'TATATATATATATATATATATATATATA',
                'GAAGAAGAAGAAGAAGAAGAAGAAGAAG', 'AACTGCAGTCGATGCTGATTCGATCGAT',
                'AACTGAAAAAAAATTTTTTTAAAAAAAA']

        # short sequences
        scores = [100, 48, 30.76, 4.31, 23.38]
        scoresx3 = [100, 48.68, 28.65, 5.62, 27.53]
        scoresx4 = [100, 48.55, 28.25, 5.79, 28.00]
        for seq, score, scorex3, scorex4 in zip(seqs, scores, scoresx3,
                                                scoresx4):
            seqrec = SeqRecord(Seq(seq))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - score < 0.01
            seqrec = SeqRecord(Seq(seq * 3))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - scorex3 < 0.01
            seqrec = SeqRecord(Seq(seq * 4))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - scorex4 < 0.01
Beispiel #2
0
    def test_dustscore_calculation():
        'It calculates the dust score'
        seqs = ['TTTTTTTTTTTTTTTTTTTTTTTTTTTT', 'TATATATATATATATATATATATATATA',
                'GAAGAAGAAGAAGAAGAAGAAGAAGAAG', 'AACTGCAGTCGATGCTGATTCGATCGAT',
                'AACTGAAAAAAAATTTTTTTAAAAAAAA']

        # short sequences
        scores = [100, 48, 30.76, 4.31, 23.38]
        scoresx3 = [100, 48.68, 28.65, 5.62, 27.53]
        scoresx4 = [100, 48.55, 28.25, 5.79, 28.00]
        for seq, score, scorex3, scorex4 in zip(seqs, scores, scoresx3,
                                                scoresx4):
            seqrec = SeqRecord(Seq(seq))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - score < 0.01
            seqrec = SeqRecord(Seq(seq * 3))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - scorex3 < 0.01
            seqrec = SeqRecord(Seq(seq * 4))
            seqrec = SeqWrapper(SEQRECORD, seqrec, None)
            assert calculate_dust_score(seqrec) - scorex4 < 0.01
Beispiel #3
0
    def __call__(self, snv):
        self._clean_filter(snv)
        # we have to make all the posible conbinations
        chrom = snv.chrom
        last_chrom = self._last_chrom
        if last_chrom is not None and chrom == self._last_chrom[0]:
            ref = last_chrom[1]
        else:
            ref = self.ref_index[snv.chrom]
            self._last_chrom = chrom, ref

        start, end = calculate_window(snv.pos, snv.end, self.window, len(ref))

        snv_win_seq = SeqWrapper(SEQRECORD, ref[start:end], None)
        score = calculate_dust_score(snv_win_seq)
        if score > self.threshold:
            snv.add_filter(self.name)

        self._scores.append(score)

        if self.return_modified_snv:
            return snv
Beispiel #4
0
    def __call__(self, snv):
        self._clean_filter(snv)
        # we have to make all the posible conbinations
        chrom = snv.chrom
        last_chrom = self._last_chrom
        if last_chrom is not None and chrom == self._last_chrom[0]:
            ref = last_chrom[1]
        else:
            ref = self.ref_index[snv.chrom]
            self._last_chrom = chrom, ref

        start, end = calculate_window(snv.pos, snv.end, self.window, len(ref))

        snv_win_seq = SeqWrapper(SEQRECORD, ref[start:end], None)
        score = calculate_dust_score(snv_win_seq)
        if score > self.threshold:
            snv.add_filter(self.name)

        self._scores.append(score)

        if self.return_modified_snv:
            return snv
Beispiel #5
0
 def  _do_check(self, seq):
     threshold = self._threshold
     dustscore = calculate_dust_score(seq)
     return True if dustscore < threshold else False
Beispiel #6
0
 def _do_check(self, seq):
     threshold = self._threshold
     dustscore = calculate_dust_score(seq)
     return True if dustscore < threshold else False