def test_stap_aureus_pacbio(self): logger = logging.getLogger(__name__) kmer = 11 pr = cProfile.Profile() pr.enable() fastas = Fastas(logger, databases + '/Staphylococcus_aureus/', kmer, False) mlst_profile = MlstProfile(databases + '/Staphylococcus_aureus/profile.txt') fastq = Fastq(logger, os.path.join(data_dir, 'NCTC11150.fastq.gz'), kmer, fastas.get_fastas_to_kmers(), 10, mlst_profile, 50, None, None, max_kmers=1) self.assertTrue(fastq.read_filter_and_map()) pr.disable() s = io.StringIO() sortby = 'cumulative' ps = pstats.Stats(pr, stream=s).sort_stats(sortby) ps.print_stats() print(s.getvalue())
def test_salmonella_welt_pacbio(self): logger = logging.getLogger(__name__) kmer = 11 fastas = Fastas(logger, data_dir, kmer, False) mlst_profile = MlstProfile(data_dir + '/profile.txt') fastq = Fastq(logger, os.path.join(data_dir, 'pacbio.fastq.gz'), kmer, fastas.get_fastas_to_kmers(), 10, mlst_profile, 50, None, None) self.assertTrue(fastq.read_filter_and_map())
def test_four_kmers(self): logger = logging.getLogger(__name__) fastas = Fastas(logger, data_dir, 4, False) mlst_profile = MlstProfile(data_dir + '/profile.txt') fastq = Fastq(logger, os.path.join(data_dir, 'query.fastq'), 4, fastas.get_fastas_to_kmers(), 1, mlst_profile, 50, None, None) self.assertTrue(fastq.read_filter_and_map())
def test_kp_nanopore(self): logger = logging.getLogger(__name__) kmer = 11 fastas = Fastas(logger, databases + '/Klebsiella_pneumoniae/', kmer, False) mlst_profile = MlstProfile(databases + '/Klebsiella_pneumoniae/profile.txt') fastq = Fastq(logger, os.path.join(data_dir, 'nanopore_kp_12.fastq.gz'), kmer, fastas.get_fastas_to_kmers(), 10, mlst_profile, 50, None, None) self.assertTrue(fastq.read_filter_and_map())
def run(self): mlst_profile = MlstProfile(self.mlst_profile_file()) fastas = Fastas(self.logger, self.allele_directory, self.kmer, self.divisible_by_3) fastq = Fastq(self.logger, self.input_fastq, self.kmer, fastas.get_fastas_to_kmers(), self.min_fasta_hits, mlst_profile, self.print_interval, self.output_file, self.filtered_reads_file, target_st=self.target_st, max_gap=self.max_gap, min_block_size=self.min_block_size, margin=self.margin, start_time=self.start_time, min_kmers_for_onex_pass=self.min_kmers_for_onex_pass) fastq.read_filter_and_map()
def test_four_kmers(self): logger = logging.getLogger(__name__) f = Fastas(logger, data_dir, 4, False) self.assertEqual(list(f.fastas_to_kmers.values()), [{ 'CTGA': 1, 'TGAC': 1, 'GACG': 1, 'ACGC': 2, 'CGCC': 1, 'GCCA': 1, 'CCAA': 1, 'CAAG': 1, 'AAGG': 1, 'AGGT': 1, 'GGTG': 1, 'GTGG': 1, 'TGGC': 1, 'GGCG': 1, 'GCGG': 2, 'CGGA': 1, 'GGAG': 1, 'GAGG': 1, 'AGGC': 1, 'TTCG': 1, 'TCGT': 1, 'CGTC': 2, 'GTCG': 1, 'TCGC': 1, 'CGCG': 1, 'CGGC': 1, 'GGCT': 1, 'GCAA': 1, 'CAAC': 1, 'AACG': 1, 'CGCT': 1, 'GCTA': 1, 'CTAA': 1, 'TAAC': 1, 'ACGT': 1, 'GTCA': 1 }, { 'CTGA': 2, 'TGAC': 2, 'GACG': 1, 'ACGC': 1, 'CGCC': 1, 'GCCG': 1, 'CCGG': 1, 'CGGA': 1, 'GGAT': 1, 'GATG': 1, 'ATGC': 1, 'TGCT': 1, 'GCTG': 1, 'GACA': 1, 'ACAA': 1, 'CAAC': 1, 'AACT': 1, 'ACTG': 1, 'CTGG': 1, 'TGGC': 1, 'TTCG': 1, 'TCGT': 1, 'CGTC': 1, 'GTCG': 1, 'TCGC': 1, 'CGCT': 1, 'GCTT': 1, 'CTTC': 1, 'TTCT': 1, 'TCTG': 1, 'GACC': 1, 'ACCT': 1, 'CCTC': 1, 'CTCC': 1, 'TCCC': 1, 'CCCA': 1, 'CCAG': 1, 'CAGG': 1, 'AGGT': 1, 'GGTG': 1, 'GTGA': 1, 'TGAT': 1, 'GATC': 1, 'ATCC': 1, 'TCCT': 1, 'GCAA': 1, 'CAAT': 1, 'AATT': 1, 'ATTG': 1, 'TTGC': 1, 'TGCC': 1, 'GCCC': 1, 'CCCT': 1, 'CCTT': 1, 'CTTT': 1, 'TTTC': 1, 'TTCA': 1 }])