def test_match_multiple(self): ms = MotifSet(preload_motifs="default") ms = ms.filter({'database': ["jaspar_vertebrates"], 'name': ["MA0139.1.CTCF"]}, search="inexact") self.assertEqual(len(ms), 1) motif = ms.get_motif_list(1, 0.0001)[0] scanner = scan.Scanner(7) pssm_list, thresholds = [], [] thresholds.append(motif.threshold) thresholds.append(motif.threshold) pssm_list.append(motif.pssm) pssm_list.append(motif.pssm_rc) bg = tools.flat_bg(4) scanner.set_motifs(pssm_list, bg, thresholds) genomic_region = GenomicRegion("chr1", 0, 5022) # Reading sequence associated to genomic_region sequence = str(self.genome_file.fetch(genomic_region.chrom, genomic_region.initial, genomic_region.final)) grs = match_multiple(scanner, [motif], sequence, genomic_region) self.assertSequenceEqual(grs.sequences, [GenomicRegion("chr1", 4270, 4289, name="MA0139.1.CTCF", orientation="+"), GenomicRegion("chr1", 4180, 4199, name="MA0139.1.CTCF", orientation="-")])
def test_create_default(self): ms = MotifSet() self.assertEqual( len(ms), 0, msg="motif dictionary must be empty by default (no preload)") motif_list = ms.get_motif_list(1.0, 0.0001) self.assertEqual(len(motif_list), 0)
def test_create_empty(self): ms = MotifSet(preload_motifs=None) self.assertEqual(len(ms), 0, msg="motif dictionary must be empty") motif_list = ms.get_motif_list(1.0, 0.0001) self.assertEqual(len(motif_list), 0)
def test_create_default(self): ms = MotifSet() self.assertEqual(len(ms), 0, msg="motif dictionary must be empty by default (no preload)") motif_list = ms.get_motif_list(1.0, 0.0001) self.assertEqual(len(motif_list), 0)