def test_scan_motifs_aligned_r(self): mode = "aligned" strand = 1 c_REF_STR = motif_tools.comp_motif(self.REF_STR) motifs = set(self.MOTIFS) bi_motifs = set() opts = data.set_opts() barcode, kmers = read_scanner.scan_motifs(mode, self.IPD_VALS, c_REF_STR, strand, motifs, bi_motifs, opts) self.assertTrue(barcode["ACCACC-0"]==(1, round(2.4,1)) and \ barcode["TGATCA-2"]==(1, round(2.2,1)) and \ barcode["GACNNNNNACC-1"]==(1, round(2.3,1)))
def test_walk_over_read_bipartite_aligned_r(self): mode = "aligned" opts = data.set_opts() c_REF_STR = motif_tools.comp_motif(self.REF_STR) motifs = set([self.MOTIFS[2]]) subread_ipds = {} for motif in motifs: subread_ipds[motif] = [] strand = 1 subread_ipds = read_scanner.walk_over_read_bipartite(mode, subread_ipds, c_REF_STR, self.IPD_VALS, strand, opts) self.assertTrue(round(subread_ipds["GACNNNNNACC-1"][0],1)==2.3 )
def test_walk_over_read_aligned_r(self): mode = "aligned" opts = data.set_opts() c_REF_STR = motif_tools.comp_motif(self.REF_STR) motifs = set(self.MOTIFS[:2]) subread_ipds = {} for motif in motifs: subread_ipds[motif] = [] strand = 1 k = 6 subread_ipds = read_scanner.walk_over_read(mode, subread_ipds, c_REF_STR, self.IPD_VALS, strand, k, opts) self.assertTrue(round(subread_ipds["ACCACC-0"][0],1)==2.4 and \ round(subread_ipds["TGATCA-2"][0],1)==2.2)
def test_build_bipartite_motifs(self): opts = data.set_opts() opts.min_kmer = 0 opts.max_kmer = 0 motifs,bi_motifs = motif_tools.build_motif_sets(opts) self.assertEqual(194560,len(bi_motifs))
def test_build_contiguous_motifs(self): opts = data.set_opts() opts.bipartite = False motifs,bi_motifs = motif_tools.build_motif_sets(opts) self.assertEqual(7680,len(motifs))
def test_read_motifs_from_file(self): opts = data.set_opts() motifs = motif_tools.motifs_from_file(opts) self.assertEqual(2,len(motifs))
def test_kmer_freq_r(self): strand = 1 opts = data.set_opts() kmer_counts = read_scanner.kmer_freq(self.REF_STR, strand, opts) self.assertTrue(kmer_counts["ACTAG"]==3 and kmer_counts["AAATG"]==2 and kmer_counts["TGGTG"]==2 and kmer_counts["AGACT"]==2)