def test_deplete_human_aligned_input(self): myInputDir = util.file.get_test_input_path(self) # Run deplete_human args = taxon_filter.parser_deplete_human(argparse.ArgumentParser()).parse_args( [ os.path.join(myInputDir, 'test-reads-aligned.bam'), # output files os.path.join(self.tempDir, 'test-reads.revert.bam'), os.path.join(self.tempDir, 'test-reads.bmtagger.bam'), os.path.join(self.tempDir, 'test-reads.rmdup.bam'), os.path.join(self.tempDir, 'test-reads.blastn.bam'), "--taxfiltBam", os.path.join(self.tempDir, 'test-reads.taxfilt.imperfect.bam'), # DBs "--blastDbs", self.blastdb_path, "--bmtaggerDbs", self.database_prefix_path, "--lastDb", self.lastdb_path, "--threads", "4" ] ) args.func_main(args) # Compare to expected for fname in [ 'test-reads.revert.bam', 'test-reads.bmtagger.bam', 'test-reads.rmdup.bam', 'test-reads.blastn.bam', 'test-reads.taxfilt.imperfect.bam' ]: assert_equal_bam_reads(self, os.path.join(self.tempDir, fname), os.path.join(myInputDir, 'aligned-expected', fname))
def test_deplete_empty(self): myInputDir = util.file.get_test_input_path(self) empty_bam = os.path.join(util.file.get_test_input_path(), 'empty.bam') # Run deplete_human args = taxon_filter.parser_deplete_human(argparse.ArgumentParser()).parse_args( [ empty_bam, # output files os.path.join(self.tempDir, 'deplete-empty.bmtagger.bam'), os.path.join(self.tempDir, 'deplete-empty.rmdup.bam'), os.path.join(self.tempDir, 'deplete-empty.blastn.bam'), "--taxfiltBam", os.path.join(self.tempDir, 'deplete-empty.taxfilt.bam'), # DBs "--blastDbs", self.blastdb_path, "--bmtaggerDbs", self.database_prefix_path, "--lastDb", self.lastdb_path, "--threads", "4" ] ) args.func_main(args) # Compare to expected for fname in [ 'deplete-empty.bmtagger.bam', 'deplete-empty.rmdup.bam', 'deplete-empty.blastn.bam', 'deplete-empty.taxfilt.bam' ]: assert_equal_bam_reads(self, os.path.join(self.tempDir, fname), empty_bam)
def test_deplete_human(self): os.environ.pop('TMPDIR', None) util.file.set_tmp_dir(None) myInputDir = util.file.get_test_input_path(self) # Run deplete_human args = taxon_filter.parser_deplete_human( argparse.ArgumentParser()).parse_args([ os.path.join(myInputDir, 'test-reads.bam'), # output files os.path.join(self.tempDir, 'test-reads.bmtagger.bam'), os.path.join(self.tempDir, 'test-reads.rmdup.bam'), os.path.join(self.tempDir, 'test-reads.blastn.bam'), # DBs "--blastDbs", self.blastdb_path, "--bmtaggerDbs", self.database_prefix_path, "--chunkSize", "0", "--srprismMemory", '1500', "--threads", str(_CPUS) ]) args.func_main(args) # Compare to expected for fname in [ 'test-reads.bmtagger.bam', 'test-reads.rmdup.bam', 'test-reads.blastn.bam', ]: assert_equal_bam_reads(self, os.path.join(self.tempDir, fname), os.path.join(myInputDir, 'expected', fname))
def test_deplete_human_aligned_input(self): myInputDir = util.file.get_test_input_path(self) # Run deplete_human args = taxon_filter.parser_deplete_human( argparse.ArgumentParser()).parse_args([ os.path.join(myInputDir, 'test-reads-aligned.bam'), # output files os.path.join(self.tempDir, 'test-reads.revert.bam'), os.path.join(self.tempDir, 'test-reads.bmtagger.bam'), os.path.join(self.tempDir, 'test-reads.rmdup.bam'), os.path.join(self.tempDir, 'test-reads.blastn.bam'), "--taxfiltBam", os.path.join(self.tempDir, 'test-reads.taxfilt.imperfect.bam'), # DBs "--blastDbs", self.blastdb_path, "--bmtaggerDbs", self.database_prefix_path, "--lastDb", self.lastdb_path, "--threads", "4" ]) args.func_main(args) # Compare to expected for fname in [ 'test-reads.revert.bam', 'test-reads.bmtagger.bam', 'test-reads.rmdup.bam', 'test-reads.blastn.bam', 'test-reads.taxfilt.imperfect.bam' ]: assert_equal_bam_reads( self, os.path.join(self.tempDir, fname), os.path.join(myInputDir, 'aligned-expected', fname))
def test_deplete_empty(self): empty_bam = os.path.join(util.file.get_test_input_path(), 'empty.bam') # Run deplete_human args = taxon_filter.parser_deplete_human( argparse.ArgumentParser()).parse_args([ empty_bam, # output files os.path.join(self.tempDir, 'deplete-empty.bmtagger.bam'), os.path.join(self.tempDir, 'deplete-empty.rmdup.bam'), os.path.join(self.tempDir, 'deplete-empty.blastn.bam'), "--taxfiltBam", os.path.join(self.tempDir, 'deplete-empty.taxfilt.bam'), # DBs "--blastDbs", self.blastdb_path, "--bmtaggerDbs", self.database_prefix_path, "--lastDb", self.lastdb_path, "--threads", "4" ]) args.func_main(args) # Compare to expected for fname in [ 'deplete-empty.bmtagger.bam', 'deplete-empty.rmdup.bam', 'deplete-empty.blastn.bam', 'deplete-empty.taxfilt.bam' ]: assert_equal_bam_reads(self, os.path.join(self.tempDir, fname), empty_bam)
def test_deplete_human(self): myInputDir = util.file.get_test_input_path(self) tempDir = tempfile.mkdtemp() ref_fasta = os.path.join(myInputDir, '5kb_human_from_chr6.fasta') database_prefix_path = os.path.join(tempDir, "5kb_human_from_chr6") # create blast db blastdb_path = tools.blast.MakeblastdbTool().build_database( ref_fasta, database_prefix_path) # create bmtagger db bmtooldb_path = tools.bmtagger.BmtoolTool().build_database( ref_fasta, database_prefix_path + ".bitmask") srprismdb_path = tools.bmtagger.SrprismTool().build_database( ref_fasta, database_prefix_path + ".srprism") # create last db lastdb_path = tools.last.Lastdb().build_database( ref_fasta, database_prefix_path) # Run deplete_human args = taxon_filter.parser_deplete_human( argparse.ArgumentParser()).parse_args([ os.path.join(myInputDir, 'test-reads.bam'), # output files os.path.join(tempDir, 'test-reads.revert.bam'), os.path.join(tempDir, 'test-reads.bmtagger.bam'), os.path.join(tempDir, 'test-reads.rmdup.bam'), os.path.join(tempDir, 'test-reads.blastn.bam'), "--taxfiltBam", os.path.join(tempDir, 'test-reads.taxfilt.bam'), # DBs "--blastDbs", blastdb_path, "--bmtaggerDbs", database_prefix_path, "--lastDb", lastdb_path, "--threads", "4" ]) args.func_main(args) # Compare to expected for fname in [ 'test-reads.revert.bam', 'test-reads.bmtagger.bam', 'test-reads.rmdup.bam', 'test-reads.blastn.bam', 'test-reads.taxfilt.bam' ]: assert_equal_bam_reads(self, os.path.join(tempDir, fname), os.path.join(myInputDir, 'expected', fname))
def test_deplete_human(self): myInputDir = util.file.get_test_input_path(self) tempDir = tempfile.mkdtemp() ref_fasta = os.path.join(myInputDir, '5kb_human_from_chr6.fasta') database_prefix_path = os.path.join(tempDir, "5kb_human_from_chr6") # create blast db blastdb_path = tools.blast.MakeblastdbTool().build_database(ref_fasta, database_prefix_path) # create bmtagger db bmtooldb_path = tools.bmtagger.BmtoolTool().build_database(ref_fasta, database_prefix_path + ".bitmask") srprismdb_path = tools.bmtagger.SrprismTool().build_database(ref_fasta, database_prefix_path + ".srprism") # create last db lastdb_path = tools.last.Lastdb().build_database(ref_fasta, database_prefix_path) # Run deplete_human args = taxon_filter.parser_deplete_human(argparse.ArgumentParser()).parse_args( [ os.path.join(myInputDir, 'test-reads.bam'), # output files os.path.join(tempDir, 'test-reads.revert.bam'), os.path.join(tempDir, 'test-reads.bmtagger.bam'), os.path.join(tempDir, 'test-reads.rmdup.bam'), os.path.join(tempDir, 'test-reads.blastn.bam'), "--taxfiltBam", os.path.join(tempDir, 'test-reads.taxfilt.bam'), # DBs "--blastDbs", blastdb_path, "--bmtaggerDbs", database_prefix_path, "--lastDb", lastdb_path, "--threads", "4" ] ) args.func_main(args) # Compare to expected for fname in [ 'test-reads.revert.bam', 'test-reads.bmtagger.bam', 'test-reads.rmdup.bam', 'test-reads.blastn.bam', 'test-reads.taxfilt.bam' ]: assert_equal_bam_reads(self, os.path.join(tempDir, fname), os.path.join(myInputDir, 'expected', fname))