def test_slice_to_ref(): test_base = 'ACTGTTgggTTGCGTA' test_ref = 'ACTGTTTTGCGTA' start = 4 stop = 8 res = TFSeqTools.slice_to_ref(test_ref, start, stop, test_ref) yield eq_, test_ref[4:8].lower(), res.lower(), 'Simple Slice is wrong!' expect = 'TTgggTT' res = TFSeqTools.slice_to_ref(test_ref, start, stop, test_base) yield eq_, expect.lower(), res.lower(), 'Aligned Slice is wrong!'
def region_extractor(conb_ltr, start, stop, seq): oseq = TFSeqTools.slice_to_ref(seq, conb_ltr, start, stop) nseq = oseq.replace('-', '') if len(nseq): return nseq else: return np.nan