def test_do_fwd_ctg_rt_bdg_with_right_hardclipping_right_on_ctg_clv(): """ AAAAA CG┘ <-right-tail read XCC/// <-contig 0123456 <-contig coord | ^ctg_offset ...XCC... <-reference genome 3456789 <-genome coord | ^ref_clv ^starting the contig2genome alignment """ read = MagicMock() read.reference_start = 2 read.reference_end = 4 read.cigartuples = ((S.BAM_CMATCH, 2), (S.BAM_CSOFT_CLIP, 5)) contig = MagicMock() contig.infer_query_length.return_value = 6 contig.cigartuples = ( (S.BAM_CMATCH, 3), (S.BAM_CHARD_CLIP, 3), ) assert do_fwd_ctg_rt_bdg(read, contig) is None
def test_do_fwd_ctg_rt_bdg_with_right_hardclipping_right_before_ctg_clv(): """ right hardclipping won't have an effect in such case AAAAA CG┘ <-right-tail read XCCG// <-contig 0123456 <-contig coord | ^ctg_offset ...XCCG... <-reference genome 34567 <-genome coord | ^ref_clv ^starting the contig2genome alignment """ read = MagicMock() read.reference_start = 2 read.reference_end = 4 read.cigartuples = ((S.BAM_CMATCH, 2), (S.BAM_CSOFT_CLIP, 5)) contig = MagicMock() contig.infer_query_length.return_value = 6 contig.cigartuples = ( (S.BAM_CMATCH, 4), (S.BAM_CHARD_CLIP, 2), ) ctg_offset = 3 tail_len = 5 assert do_fwd_ctg_rt_bdg(read, contig) == ('+', ctg_offset, tail_len)
def test_do_fwd_ctg_rt_bdg(): """ AA CCG┘ <-right-tail read XXCCGXX <-contig 0123456 <-contig coord 0123456 <-genome coord offset to 0 ^ctg_offset """ mock_read = get_mock_read(ref_beg=1, ref_end=4, cigartuples=[(S.BAM_CMATCH, 3), (S.BAM_CSOFT_CLIP, 2)]) mock_contig = MagicMock() mock_contig.infer_query_length.return_value = 7 mock_contig.cigartuples = ((S.BAM_CMATCH, 7), ) ctg_offset = 3 tail_len = 2 assert do_fwd_ctg_rt_bdg(mock_read, contig=mock_contig) == ('+', ctg_offset, tail_len)
def test_do_fwd_ctg_rt_bdg_with_left_hardclipping_right_on_ctg_clv(): """ AA CCG┘ <-right-tail read \\\\XX <-contig 0123456 <-contig coord ^ctg_offset ...XX... <-reference genome 45678 <-genome coord ref_clv^ ^starting the contig2genome alignment ref_clv won't be captured by this bridge read """ read = MagicMock() read.reference_start = 1 read.reference_end = 4 read.cigartuples = ((S.BAM_CMATCH, 3), (S.BAM_CSOFT_CLIP, 2)) contig = MagicMock() contig.cigartuples = ((S.BAM_CHARD_CLIP, 4), (S.BAM_CMATCH, 2)) contig.infer_query_length.return_value = 6 assert do_fwd_ctg_rt_bdg(read, contig) is None
def test_do_fwd_ctg_rt_bdg_with_left_hardclipping(): """ AA CCG┘ <-right-tail read \\\XCCGXX <-contig 0123456789 <-contig coord | ^ctg_offset ...XXXXCCGXX... <-reference genome 4567890 <-genome coord | ^ref_clv ^starting the contig2genome alignment """ read = MagicMock() read.reference_start = 4 read.reference_end = 7 read.cigartuples = ((S.BAM_CMATCH, 3), (S.BAM_CSOFT_CLIP, 2)) contig = MagicMock() contig.cigartuples = ((S.BAM_CHARD_CLIP, 3), (S.BAM_CMATCH, 7)) contig.infer_query_length.return_value = 9 ctg_offset = 3 tail_len = 2 assert do_fwd_ctg_rt_bdg(read, contig) == ('+', ctg_offset, tail_len)