예제 #1
0
    def test_intersection(self):
        interval_list = [Interval(1, 10), Interval(5, 7), Interval(7)]
        self.assertEqual(Interval(7), Interval.intersection(*interval_list))
        interval_list.append(Interval(11))
        self.assertEqual(None, Interval.intersection(*interval_list))

        with self.assertRaises(AttributeError):
            Interval.intersection()
예제 #2
0
 def test_deletion_across_intron(self):
     # 55240539_55240621  55323947_55324313
     bpp = BreakpointPair(Breakpoint('7', 55240610, orient=ORIENT.LEFT),
                          Breakpoint('7', 55323950, orient=ORIENT.RIGHT),
                          untemplated_seq='GTAC')
     self.assertEqual(Interval(-10), bpp.net_size(self.egfr_distance))
     # 55210998_55211181 55218987_55219055
     bpp = BreakpointPair(Breakpoint('7', 55211180, orient=ORIENT.LEFT),
                          Breakpoint('7', 55218990, orient=ORIENT.RIGHT),
                          untemplated_seq='')
     self.assertEqual(Interval(-4 + -135, -4),
                      bpp.net_size(self.egfr_distance))
예제 #3
0
 def test_reverse_reads(self):
     read, mate = mock_read_pair(
         MockRead('name', '1', 1001, 1100, is_reverse=False),
         MockRead('name', '1', 2201, 2301, is_reverse=True))
     self.assertEqual(Interval(1300),
                      self.genomic_ev.compute_fragment_size(read, mate))
     self.assertEqual(Interval(1300),
                      self.genomic_ev.compute_fragment_size(mate, read))
     self.assertEqual(Interval(1300),
                      self.trans_ev.compute_fragment_size(read, mate))
     self.assertEqual(Interval(1300),
                      self.trans_ev.compute_fragment_size(mate, read))
예제 #4
0
 def test_bwa_contigs(self):
     ev = GenomeEvidence(
         Breakpoint('reference3', 1114, orient=ORIENT.RIGHT),
         Breakpoint('reference3', 2187, orient=ORIENT.RIGHT),
         opposing_strands=True,
         bam_cache=BAM_CACHE,
         reference_genome=REFERENCE_GENOME,
         read_length=40,
         stdev_fragment_size=25,
         median_fragment_size=100,
         stdev_count_abnormal=2,
         min_splits_reads_resolution=1,
         min_flanking_pairs_resolution=1,
     )
     ev.contigs = [
         Contig(
             'CTGAGCATGAAAGCCCTGTAAACACAGAATTTGGATTCTTTCCTGTTTGGTTCCTGGTCGTGAGTGGCAGGTGCCATCATGTTTCATTCTGCCTGAGAGCAG'
             'TCTACCTAAATATATAGCTCTGCTCACAGTTTCCCTGCAATGCATAATTAAAATAGCACTATGCAGTTGCTTACACTTCAGATAATGGCTTCCTACATATTG'
             'TTGGTTATGAAATTTCAGGGTTTTCATTTCTGTATGTTAAT',
             0,
         )
     ]
     print(ev.contigs[0].seq)
     seq = align.align_sequences(
         {'seq': ev.contigs[0].seq},
         BAM_CACHE,
         REFERENCE_GENOME,
         aligner_reference=get_data('mock_reference_genome.fa'),
         aligner='bwa mem',
         aligner_output_file='mem.out',
         aligner_fa_input_file='mem.in.fa',
     )
     align.select_contig_alignments(ev, seq)
     print(ev.contigs[0].alignments)
     alignment = list(ev.contigs[0].alignments)[0]
     self.assertEqual(reverse_complement(alignment.read1.query_sequence),
                      alignment.read2.query_sequence)
     self.assertEqual('reference3', alignment.read1.reference_name)
     self.assertEqual('reference3', alignment.read2.reference_name)
     self.assertEqual(1, alignment.read1.reference_id)
     self.assertEqual(1, alignment.read2.reference_id)
     self.assertEqual(Interval(125, 244),
                      align.query_coverage_interval(alignment.read1))
     self.assertEqual(Interval(117, 244),
                      align.query_coverage_interval(alignment.read2))
     self.assertEqual(1114, alignment.read1.reference_start)
     self.assertEqual(2187, alignment.read2.reference_start)
     self.assertEqual([(CIGAR.S, 125), (CIGAR.EQ, 120)],
                      alignment.read1.cigar)
     self.assertEqual([(CIGAR.S, 117), (CIGAR.EQ, 128)],
                      alignment.read2.cigar)
예제 #5
0
 def test_inversion_and_deletion(self):
     s = 'CTGAGCATGAAAGCCCTGTAAACACAGAATTTGGATTCTTTCCTGTTTGGTTCCTGGTCGTGAGTGGCAGGTGCCATCATGTTTCATTCTGCCTGAGAGCAGTCTACCTAAATATATAGCTCTGCTCACAGTTTCCCTGCAATGCATAATTAAAATAGCACTATGCAGTTGCTTACACTTCAGATAATGGCTTCCTACATATTGTTGGTTATGAAATTTCAGGGTTTTCATTTCTGTATGTTAAT'
     evidence = MockObject(
         interchromosomal=False,
         opposing_strands=True,
         break1=MockObject(orient=ORIENT.RIGHT, chr='3'),
         break2=MockObject(orient=ORIENT.RIGHT, chr='3'),
         contigs=[MockObject(seq=s, alignments=set())],
         standardize_read=lambda x: x,
         contig_aln_max_event_size=DEFAULTS.contig_aln_max_event_size,
         contig_aln_merge_inner_anchor=5,
         contig_aln_merge_outer_anchor=DEFAULTS.
         contig_aln_merge_outer_anchor,
         contig_aln_min_query_consumption=0.9,
         contig_aln_min_extend_overlap=DEFAULTS.
         contig_aln_min_extend_overlap,
         contig_aln_min_anchor_size=DEFAULTS.contig_aln_min_anchor_size,
         contig_aln_min_score=DEFAULTS.contig_aln_min_score,
         outer_window1=Interval(1000, 1200),
         outer_window2=Interval(2000, 2200),
         LR=False,
         LL=False,
         RR=True,
         RL=False,
         reference_genome=None,
         bam_cache=mock.Mock(stranded=False),
     )
     read1 = SamRead(
         reference_id=3,
         reference_start=1114,
         cigar=[(CIGAR.S, 125), (CIGAR.EQ, 120)],
         query_sequence=s,
         is_reverse=False,
         reference_name='3',
         alignment_rank=0,
     )
     read2 = SamRead(
         reference_id=3,
         reference_start=2187,
         cigar=[(CIGAR.S, 117), (CIGAR.EQ, 8), (CIGAR.D, 1),
                (CIGAR.EQ, 120)],
         query_sequence=reverse_complement(s),
         is_reverse=True,
         reference_name='3',
         alignment_rank=1,
     )
     raw_alignments = {s: [read1, read2]}
     align.select_contig_alignments(evidence, raw_alignments)
     alignments = list(evidence.contigs[0].alignments)
     self.assertEqual(2, len(alignments))
예제 #6
0
    def test_insertion(self):
        bpp = BreakpointPair(
            Breakpoint('1', 11, orient=ORIENT.RIGHT),
            Breakpoint('1', 10, orient=ORIENT.LEFT),
            untemplated_seq='T',
        )
        self.assertEqual(Interval(1), bpp.net_size())

        bpp = BreakpointPair(
            Breakpoint('1', 11, orient=ORIENT.RIGHT),
            Breakpoint('1', 10, orient=ORIENT.LEFT),
            untemplated_seq='TT',
        )
        self.assertEqual(Interval(2), bpp.net_size())
예제 #7
0
    def test_generate_gene_mapping_err(self):
        #  _generate_interval_mapping [genomic.IntergenicRegion(11:77361962_77361962+)] 1181.39453125 5 30 None 77356962 77366962)
        ir = genomic.IntergenicRegion('11', 5000, 5000, STRAND.POS)
        tgt_width = 1000
        d = DiagramSettings()
        d.gene_min_buffer = 10
        # (self, canvas, gene, width, height, fill, label='', reference_genome=None)
        draw_genes(d, self.canvas, [ir], tgt_width, [])

        # _generate_interval_mapping ['Interval(29684391, 29684391)', 'Interval(29663998, 29696515)'] 1181.39453125 5 60 None 29662998 29697515
        # def generate_interval_mapping(cls, input_intervals, target_width, ratio, min_width, buffer_length=None, start=None, end=None, min_inter_width=None)
        itvls = [Interval(29684391, 29684391), Interval(29663998, 29696515)]
        generate_interval_mapping(itvls, 1181.39, 5, 60, None, 29662998,
                                  29697515)
예제 #8
0
    def test_deletion_in_exon(self):
        bpp = BreakpointPair(
            Breakpoint('7', 55238890, orient=ORIENT.LEFT),
            Breakpoint('7', 55238899, orient=ORIENT.RIGHT),
            untemplated_seq='',
        )
        self.assertEqual(Interval(-8), bpp.net_size(self.egfr_distance))

        bpp = BreakpointPair(
            Breakpoint('7', 55238890, orient=ORIENT.LEFT),
            Breakpoint('7', 55238899, orient=ORIENT.RIGHT),
            untemplated_seq='GTAC',
        )
        self.assertEqual(Interval(-4), bpp.net_size(self.egfr_distance))
예제 #9
0
 def test_inversion(self):
     bpp = BreakpointPair(
         Breakpoint('1', 10, orient=ORIENT.LEFT),
         Breakpoint('1', 15, orient=ORIENT.LEFT),
         untemplated_seq='',
     )
     self.assertEqual(Interval(0), bpp.net_size())
예제 #10
0
 def test_duplication_with_insertion(self):
     bpp = BreakpointPair(
         Breakpoint('1', 10, orient=ORIENT.RIGHT),
         Breakpoint('1', 15, orient=ORIENT.LEFT),
         untemplated_seq='TTT',
     )
     self.assertEqual(Interval(9), bpp.net_size())
예제 #11
0
 def test_large_indel(self):
     bpp = BreakpointPair(
         Breakpoint('1', 10, orient=ORIENT.LEFT),
         Breakpoint('1', 101, orient=ORIENT.RIGHT),
         untemplated_seq='TTT',
     )
     self.assertEqual(Interval(-87), bpp.net_size())
예제 #12
0
 def test_inversion_insertion(self):
     bpp = BreakpointPair(
         Breakpoint('1', 10, orient=ORIENT.LEFT),
         Breakpoint('1', 15, orient=ORIENT.LEFT),
         untemplated_seq='TT',
     )
     assert bpp.net_size() == Interval(2)
예제 #13
0
 def test_deletion(self):
     bpp = BreakpointPair(
         Breakpoint('1', 10, orient=ORIENT.LEFT),
         Breakpoint('1', 15, orient=ORIENT.RIGHT),
         untemplated_seq='',
     )
     assert bpp.net_size() == Interval(-4)
예제 #14
0
 def test_pslx_row_to_pysam_single_block(self):
     pslx_row = {
         'score':
         20,
         'tseqs': ['AATACCAAATACATGATATA'],
         'tstarts': [3432307],
         'tstart':
         3432307,
         'block_sizes': [20],
         'qname':
         'seq1',
         'tname':
         'Y',
         'qstarts': [93],
         'strand':
         '+',
         'qseqs': ['AATACCATACATGATATA'],
         'percent_ident':
         100.0,
         'qseq_full':
         'AGCCTCCCAAGTAGCTGGGACTACAGGCGCCCGCCACTACGCCCGGCTAATTTTTTGTATTTTTAGTAGAGACGGGGTTTCACCGTTTT'
         'AGCCAGGATGGTCTCGATCTCCTGACCTCATGATCCGCCCGCCTCGGC',
     }
     read = Blat.pslx_row_to_pysam(pslx_row, self.cache, None)
     self.assertEqual(23, read.reference_id)
     self.assertEqual(Interval(93, 112), query_coverage_interval(read))
예제 #15
0
 def test_single_bp_window(self):
     regions = [
         Interval(4222347, 4222347),
         Interval(4221673, 4221903),
         Interval(2792992, 4852494)
     ]
     target = 911.9921875
     ratio = 5
     min_width = 60
     buffer_ = None
     start = 2791992
     end = 4853494
     min_inter = 10
     m = generate_interval_mapping(regions, target, ratio, min_width,
                                   buffer_, start, end, min_inter)
     self.assertEqual(7, len(m.keys()))
예제 #16
0
 def test_pslx_row_to_pysam_gapped_alignment_with_reference(self):
     pslx_row = {
         'block_count':
         1,
         'tstarts': [950, 7233],
         'block_sizes': [47, 100],
         'qname':
         'seq1',
         'tname':
         'fake',
         'qstarts': [0, 47],
         'strand':
         '+',
         'qseq_full':
         'ATCTAATAACTTGATCAATA'
         'TCTGTGATTATATTTTCATT'
         'GCCTTCC'
         'AATTTTGCAGATTATAAGAT'
         'CAATAGATATTTATTGTAAA'
         'ATGCACAAATAGTGCAACAT'
         'TTCTTAAAGTAGACCGTGAA'
         'ATACTTCATGTTGCCATGTT',
         'score':
         1,
     }
     read = Blat.pslx_row_to_pysam(pslx_row, self.cache, REFERENCE_GENOME)
     self.assertEqual(0, read.reference_id)
     self.assertEqual(Interval(0, 146), query_coverage_interval(read))
     self.assertEqual(950, read.reference_start)
     self.assertEqual([(CIGAR.EQ, 53), (CIGAR.D, 6236), (CIGAR.EQ, 94)],
                      read.cigar)
예제 #17
0
 def test_pslx_row_to_pysam_duplication(self):
     reference = {
         '14':
         MockObject(seq=MockLongString(
             'TTCTTCCATGCCCCCTAATCATGGCCACATTGTATCAGCCTGAGCATGAGCAACAGCACCATGGCCACATACGGGAATGGGCCTCATTGGTGTAATATTTGGCAGATTCTCTCCACACCCCCCGTGGCGGTCTGGCTTACTGTTAAGAAGGGTAACCTTAAAAAATACATTTCCCACTCCAGAAAATACTCATATGTGGCCTGTTAGCAGCACAAGAAGGGTGAAAGCAATGCCCATTCCTGCCTCCCTCCCCCTGCTCACCTCCACGTCCCTGTTTGCCCCTTTGTAGGTGAAGTGAGTATATTCAGCGTCTTCATGGCAGGGGAGAGGGTGTATTAATCCGTCTATGTCCGCTGGAAAGGCAGTCTCTGAGCGGGCCACAAGGGTTCAGCCATGGCCCATCCAATAACCTTTTTGATGACTTGGATGAAGAGACAAACATTCCAACCACATTCAAAGATCCAGACCTCCAAAGTGTGGCTCATTTGGTAGATAATGGAATTATATTTGGAAAGCATTTCCCGCAGCTGGGATGATGGGTCAAAAACAGATAGCATTTTACCAGATCATATTTGTGTGTGTGTGTGTGCGCGCGTGTGTGTGTGTGTGTGTGTGTGTTTTAAATTCAGTTTCCCAACTACAGGATG',
             offset=73014463,
         ))
     }
     pslx_row = {
         'block_count': 2,
         'tstarts': [73014606, 73014747],
         'block_sizes': [141, 30],
         'qname': '',
         'tname': '14',
         'qstarts': [0, 239],
         'strand': '+',
         'qseq_full':
         'AAGAAGGGTAACCTTAAAAAATACATTTCCCACTCCAGAAAATACTCATATGTGGCCTGTTAGCAGCACAAGAAGGGTGAAAGCAATGCCCATTCCTGCCTCCCTCCCCCTGCTCACCTCCACGTCCCTGTTTGCCCCTTTACTCATATGTGGCCTGTTAGCAGCACAAGAAGGGTGAAAGCAATGCCCATTCCTGCCTCCCTCCCCCTGCTCACCTCCACGTCCCTGTTTGCCCCTTTGTAGGTGAAGTGAGTATATTCAGCGTCTTC',
         'score': 1,
     }
     read2 = Blat.pslx_row_to_pysam(pslx_row, self.cache, reference)
     self.assertEqual(13, read2.reference_id)
     self.assertEqual(73014606, read2.reference_start)
     self.assertEqual([(CIGAR.M, 141), (CIGAR.I, 98), (CIGAR.M, 30)],
                      _cigar.convert_for_igv(read2.cigar))
     self.assertEqual(Interval(0,
                               len(pslx_row['qseq_full']) - 1),
                      query_coverage_interval(read2))
예제 #18
0
 def test_blat_contigs_deletion(self):
     ev = GenomeEvidence(
         Breakpoint('fake', 1714, orient=ORIENT.LEFT),
         Breakpoint('fake', 2968, orient=ORIENT.RIGHT),
         opposing_strands=False,
         bam_cache=BAM_CACHE,
         reference_genome=REFERENCE_GENOME,
         read_length=40,
         stdev_fragment_size=25,
         median_fragment_size=100
     )
     ev.contigs = [
         Contig(
             'GGTATATATTTCTCAGATAAAAGATATTTTCCCTTTTATCTTTCCCTAAGCTCACACTACATATATTGCATTTATCTTATATCTGCTTTAAAACCTATTTAT'
             'TATGTCATTTAAATATCTAGAAAAGTTATGACTTCACCAGGTATGAAAAATATAAAAAGAACTCTGTCAAGAAT', 0)
     ]
     seq = align.align_sequences({'seq': ev.contigs[0].seq}, BAM_CACHE, REFERENCE_GENOME, aligner_reference=get_data('mock_reference_genome.2bit'), aligner='blat')
     for query, reads in seq.items():
         print('>>>', query)
         for read in reads:
             print(repr(read))
     align.select_contig_alignments(ev, seq)
     alignments = list(ev.contigs[0].alignments)
     print('alignments:')
     for aln in alignments:
         print(aln, repr(aln.read1), repr(aln.read2))
     self.assertEqual(1, len(alignments))
     alignment = alignments[0]
     self.assertTrue(alignment.read2 is None)
     self.assertEqual(0, alignment.read1.reference_id)
     self.assertTrue(not alignment.read1.is_reverse)
     self.assertEqual(Interval(0, 175), align.query_coverage_interval(alignment.read1))
     self.assertEqual(1612, alignment.read1.reference_start)
     self.assertEqual([(CIGAR.EQ, 102), (CIGAR.D, 1253), (CIGAR.EQ, 74)], alignment.read1.cigar)
예제 #19
0
 def test_blat_contigs_deletion_revcomp(self):
     ev = GenomeEvidence(Breakpoint('fake', 1714, orient=ORIENT.LEFT),
                         Breakpoint('fake', 2968, orient=ORIENT.RIGHT),
                         opposing_strands=False,
                         bam_cache=BAM_CACHE,
                         reference_genome=REFERENCE_GENOME,
                         read_length=40,
                         stdev_fragment_size=25,
                         median_fragment_size=100)
     seq = 'GGTATATATTTCTCAGATAAAAGATATTTTCCCTTTTATCTTTCCCTAAGCTCACACTACATATATTGCATTTATCTTATATCTGCTTTAAAACCTATTTAT' \
           'TATGTCATTTAAATATCTAGAAAAGTTATGACTTCACCAGGTATGAAAAATATAAAAAGAACTCTGTCAAGAAT'
     ev.contigs = [Contig(reverse_complement(seq), 0)]
     align.select_contig_alignments(
         ev,
         align.align_sequences({'seq': ev.contigs[0].seq},
                               BAM_CACHE,
                               REFERENCE_GENOME,
                               aligner_reference=REFERENCE_GENOME_FILE_2BIT,
                               aligner='blat'))
     print('alignments:', ev.contigs[0].alignments)
     alignment = list(ev.contigs[0].alignments)[0]
     print(alignment)
     self.assertTrue(alignment.read2 is None)
     self.assertEqual(0, alignment.read1.reference_id)
     self.assertTrue(alignment.read1.is_reverse)
     self.assertEqual(seq, alignment.read1.query_sequence)
     self.assertEqual(Interval(0, 175),
                      align.query_coverage_interval(alignment.read1))
     self.assertEqual(1612, alignment.read1.reference_start)
     self.assertEqual([(CIGAR.EQ, 102), (CIGAR.D, 1253), (CIGAR.EQ, 74)],
                      alignment.read1.cigar)
예제 #20
0
    def test_deletion_in_exon(self, egfr_evidence):
        bpp = BreakpointPair(
            Breakpoint('7', 55238890, orient=ORIENT.LEFT),
            Breakpoint('7', 55238899, orient=ORIENT.RIGHT),
            untemplated_seq='',
        )
        assert bpp.net_size(lambda p1, p2: TranscriptomeEvidence.distance(
            egfr_evidence, p1, p2)) == Interval(-8)

        bpp = BreakpointPair(
            Breakpoint('7', 55238890, orient=ORIENT.LEFT),
            Breakpoint('7', 55238899, orient=ORIENT.RIGHT),
            untemplated_seq='GTAC',
        )
        assert bpp.net_size(lambda p1, p2: TranscriptomeEvidence.distance(
            egfr_evidence, p1, p2)) == Interval(-4)
예제 #21
0
 def test_single_bp_dup(self):
     transcript = fusion.FusionTranscript()
     transcript.position = Interval(1, 500)
     transcript.exons = [
         genomic.Exon(1, 7, transcript=transcript, intact_end_splice=False),
         genomic.Exon(8,
                      8,
                      transcript=transcript,
                      intact_start_splice=False,
                      intact_end_splice=False),
         genomic.Exon(9,
                      100,
                      transcript=transcript,
                      intact_start_splice=False),
         genomic.Exon(200, 500, transcript=transcript),
     ]
     cfg = DiagramSettings(width=1500)
     canvas = Drawing(size=(cfg.width, 1000))
     drawing_width = cfg.width - cfg.label_left_margin - cfg.left_margin - cfg.right_margin
     canvas.add(
         draw_ustranscript(cfg,
                           canvas,
                           transcript,
                           target_width=drawing_width))
     if OUTPUT_SVG:
         canvas.saveas('test_single_bp_dup.svg')
예제 #22
0
 def test_pslx_row_to_pysam_revcomp_deletion(self, cache):
     pslx_row = {
         'block_count':
         2,
         'tstarts': [2205, 2281],
         'block_sizes': [50, 34],
         'qname':
         'seq1',
         'tname':
         'reference3',
         'qstarts': [0, 50],
         'strand':
         '-',
         'qseq_full':
         'CTGAGCATGAAAGCCCTGTAAACACAGAATTTGGTGAGTGGCAGGTGCCATCATGTTTCATTCTGCCTGAGAGCAGTCTACCTA',
         'score':
         1,
         'qseqs': [
             'TAGGTAGACTGCTCTCAGGCAGAATGAAACATGATGGCACCTGCCACTCA',
             'CCAAATTCTGTGTTTACAGGGCTTTCATGCTCAG',
         ],
         'tseqs': [
             'TAGGTAGACTGCTCTCAGGCAGAATGAAACATGATGGCACCTGCCACTCA',
             'CCAAATTCTGTGTTTACAGGGCTTTCATGCTCAG',
         ],
     }
     read = Blat.pslx_row_to_pysam(pslx_row, cache, REFERENCE_GENOME)
     assert read.reference_id == 3
     assert query_coverage_interval(read) == Interval(0, 83)
     assert read.reference_start == 2205
     assert read.cigar == [(CIGAR.EQ, 51), (CIGAR.D, 26), (CIGAR.EQ, 33)]
     assert read.query_sequence[
         0:50] == 'TAGGTAGACTGCTCTCAGGCAGAATGAAACATGATGGCACCTGCCACTCA'
     assert read.query_sequence[50:] == 'CCAAATTCTGTGTTTACAGGGCTTTCATGCTCAG'
예제 #23
0
    def test_single_bp_ins_exon(self):
        transcript = fusion.FusionTranscript()
        transcript.position = Interval(401258, 408265)
        transcript.exons = [
            genomic.Exon(401258, 401461, transcript=transcript),
            genomic.Exon(404799,
                         405254,
                         intact_end_splice=False,
                         transcript=transcript),
            genomic.Exon(
                405255,
                405255,
                intact_start_splice=False,
                intact_end_splice=False,
                transcript=transcript,
            ),
            genomic.Exon(405256,
                         408265,
                         intact_start_splice=False,
                         transcript=transcript),
        ]

        cfg = DiagramSettings(width=1500)
        canvas = Drawing(size=(cfg.width, 1000))
        drawing_width = cfg.width - cfg.label_left_margin - cfg.left_margin - cfg.right_margin
        canvas.add(
            draw_ustranscript(cfg,
                              canvas,
                              transcript,
                              target_width=drawing_width))
        if OUTPUT_SVG:
            canvas.saveas('test_single_bp_ins_exon.svg')
예제 #24
0
 def test_pslx_row_to_pysam_gapped_alignment(self, cache):
     pslx_row = {
         'block_count':
         1,
         'tstarts': [950, 7233],
         'block_sizes': [47, 100],
         'qname':
         'seq1',
         'tname':
         'fake',
         'qstarts': [0, 47],
         'strand':
         '+',
         'qseq_full':
         'ATCTAATAACTTGATCAATA'
         'TCTGTGATTATATTTTCATT'
         'GCCTTCC'
         'AATTTTGCAGATTATAAGAT'
         'CAATAGATATTTATTGTAAA'
         'ATGCACAAATAGTGCAACAT'
         'TTCTTAAAGTAGACCGTGAA'
         'ATACTTCATGTTGCCATGTT',
         'score':
         1,
     }
     read = Blat.pslx_row_to_pysam(pslx_row, cache, None)
     assert read.reference_id == 0
     assert query_coverage_interval(read) == Interval(0, 146)
     assert read.reference_start == 950
     assert read.cigar == [(CIGAR.M, 47), (CIGAR.D, 6236), (CIGAR.M, 100)]
예제 #25
0
파일: test_bam.py 프로젝트: shenjia1/mavis
 def test_no_events(self):
     ref_range = Interval(89700031, 89700040)
     qrange = _read.map_ref_range_to_query_range(self.contig_read,
                                                 ref_range)
     self.assertEqual(10, len(qrange))
     self.assertEqual(6, qrange.start)
     self.assertEqual(15, qrange.end)
예제 #26
0
파일: test_bam.py 프로젝트: shenjia1/mavis
 def test_full_aligned_portion(self):
     ref_range = Interval(89700026, 89712619)
     qrange = _read.map_ref_range_to_query_range(self.contig_read,
                                                 ref_range)
     self.assertEqual(571, len(qrange))
     self.assertEqual(1, qrange.start)
     self.assertEqual(571, qrange.end)
예제 #27
0
 def test_indel(self):
     bpp = BreakpointPair(
         Breakpoint('1', 13, orient=ORIENT.RIGHT),
         Breakpoint('1', 10, orient=ORIENT.LEFT),
         untemplated_seq='TTT',
     )
     assert bpp.net_size() == Interval(1)
예제 #28
0
 def test_deletion_across_intron(self, egfr_evidence):
     # 55240539_55240621  55323947_55324313
     bpp = BreakpointPair(
         Breakpoint('7', 55240610, orient=ORIENT.LEFT),
         Breakpoint('7', 55323950, orient=ORIENT.RIGHT),
         untemplated_seq='GTAC',
     )
     assert bpp.net_size(lambda p1, p2: TranscriptomeEvidence.distance(
         egfr_evidence, p1, p2)) == Interval(-10)
     # 55210998_55211181 55218987_55219055
     bpp = BreakpointPair(
         Breakpoint('7', 55211180, orient=ORIENT.LEFT),
         Breakpoint('7', 55218990, orient=ORIENT.RIGHT),
         untemplated_seq='',
     )
     assert bpp.net_size(lambda p1, p2: TranscriptomeEvidence.distance(
         egfr_evidence, p1, p2)) == Interval(-4 + -135, -4)
예제 #29
0
 def test_insertion_at_exon_end_mixed(self):
     # 55238868_55238906
     bpp = BreakpointPair(
         Breakpoint('7', 55238905, orient=ORIENT.LEFT),
         Breakpoint('7', 55238906, orient=ORIENT.RIGHT),
         untemplated_seq='TTATCG',
     )
     self.assertEqual(Interval(6), bpp.net_size(self.egfr_distance))
예제 #30
0
 def test_insertion_at_exon_start_mixed(self):
     # EXON 15: 55232973-55233130
     # EXON 16: 55238868-55238906
     # EXON 17: 55240676-55240817
     bpp = BreakpointPair(Breakpoint('7', 55238867, orient=ORIENT.LEFT),
                          Breakpoint('7', 55238868, orient=ORIENT.RIGHT),
                          untemplated_seq='TTATCG')
     self.assertEqual(Interval(6), bpp.net_size(self.egfr_distance))