def test_hisat(self): """Test hisat index creation, FaQC, and mapping.""" dir_path = os.path.dirname(os.path.realpath(__file__)) bindir = os.path.abspath(os.path.join(dir_path, '..', 'bin')) luigi.interface.build([ Map.HisatIndex(fasta="tests/data/test_prok.fna", hi_index="tests/test_hisatmapping/prok_index", num_cpus=1), Map.Hisat(fastqs=[ "tests/data/BTT_test15_R1.1000.fastq", "tests/data/BTT_test15_R2.1000.fastq" ], num_cpus=1, sample="samp1", faqc_min_L=50, n_cutoff=5, qc_outdir="tests/test_hisatmapping/trimming_results", map_dir="tests/test_hisatmapping/mapping_results", indexfile="tests/test_hisatmapping/prok_index", spliceFile="", outsam="tests/test_hisatmapping/samp1.sam", ref_file="tests/data/test_prok.fa", workdir="tests/test_hisatmapping/") ], local_scheduler=True) self.assertTrue( os.path.exists("tests/test_hisatmapping/prok_index.8.ht2l")) self.assertTrue(os.path.exists("tests/test_hisatmapping/samp1.sam"))
def test_hisat(self): """Test hisat index creation, FastQC, and mapping.""" luigi.interface.build([ Map.HisatIndex(fasta="tests/data/test_prok.fa", hi_index="tests/test_hisatmapping/prok_index", bindir="bin", numCPUs=1), FastQC.PairedRunQC( fastqs=[ "tests/data/BTT_test15_R1.1000.fastq", "tests/data/BTT_test15_R2.1000.fastq" ], sample="samp1", numCPUs=1, outdir="tests/test_hisatmapping/trimming_results", bindir="bin"), Map.Hisat(fastq1="tests/data/BTT_test15_R1.1000.fastq", fastq2="tests/data/BTT_test15_R2.1000.fastq", numCPUs=1, indexfile="tests/test_hisatmapping/prok_index", spliceFile="", mappingLogFile="tests/test_hisatmapping/mapping.log", unalned="tests/test_hisatmapping//unligned.fastq", outsam="tests/test_hisatmapping/samp1.sam", ref_file="tests/data/test_prok.fa", bindir="bin") ], local_scheduler=True) self.assertTrue( os.path.exists("tests/test_hisatmapping/prok_index.8.ht2l")) self.assertTrue(os.path.exists("tests/test_hisatmapping/samp1.sam"))
def test_splice_creation(self): """Test if CreateSplice works.""" luigi.interface.build([ Map.GFF2GTF(gff_file="tests/data/test_prok.gff", workdir="tests/test_createsplice"), Map.CreateSplice(gff_file="tests/data/test_prok.gff", workdir="tests/test_createsplice") ], local_scheduler=True) self.assertTrue( os.path.exists("tests/test_createsplice/test_prok.splice"))
def test_splices_creation(self): """Test if GFF2GTF works for multiple gffs.""" luigi.interface.build([ Map.GFF2GTF( gff_file= "tests/data/test_prok1.1.gff,tests/data/eukarya_test.gff3", workdir="tests/test_createsplice"), Map.CreateSplice( gff_file= "tests/data/test_prok1.1.gff,tests/data/eukarya_test.gff3", workdir="tests/test_createsplice") ], local_scheduler=True) self.assertTrue( os.path.exists("tests/test_createsplice/test_prok1.1.splice")) self.assertTrue( os.path.exists("tests/test_createsplice/eukarya_test.splice"))
def test_gtf_creation(self): """Test if GFF2GTF works.""" luigi.interface.build([ Map.GFF2GTF(gff_file="tests/data/test_prok.gff", workdir="tests/test_gff2gtf") ], local_scheduler=True) self.assertTrue(os.path.exists("tests/test_gff2gtf/test_prok.gtf"))
def test_splices_creation(self): """Test if GFF2GTF works for multiple gffs.""" luigi.interface.build([ Map.GFF2GTF( gff_file= "tests/data/test_prok1.1.gff,tests/data/eukarya_test.gff3", bindir="bin", workdir="tests/test_createsplice"), Map.CreateSplice( gff_file= "tests/data/test_prok1.1.gff,tests/data/eukarya_test.gff3", bindir="bin", workdir="tests/test_createsplice") ], local_scheduler=True) self.assertTrue( os.path.exists("tests/test_createsplice/test_prok1.1.splice")) self.assertTrue( os.path.exists("tests/test_createsplice/eukarya_test.splice")) with open("tests/test_createsplice/eukarya_test.splice") as pg: first_line_second_column = pg.readline().split("\t")[1] self.assertEqual(first_line_second_column, "220")
def test_star(): """Test star index creation, FaQC, and mapping.""" luigi.interface.build([Map.star(fastqs=["tests/data/BTT_test15_R1.1000.fastq", "tests/data/BTT_test15_R2.1000.fastq"], num_cpus=1, fasta="tests/data2/chr22_ERCC92.fa", stardb_dir="tests/test_star_mapping/index", map_dir="tests/test_star_mapping/mapping_results", gff_file="tests/data2/chr22_ERCC92.gff3", sample="migun")], local_scheduler=True) assert os.path.exists("tests/test_star_mapping/mapping_results/migun_Aligned.sortedByCoord.out.bam") is True rm_cmd = rm["-rf", "tests/test_star_mapping"] rm_cmd()
def test_gtfs_creation(self): """Test if GFF2GTF works for multiple gffs.""" luigi.interface.build([ Map.GFF2GTF( gff_file= "tests/data/test_prok.gff,tests/data/eukarya_test.gff3", workdir="tests/test_gff2gtf") ], local_scheduler=True) self.assertTrue(os.path.exists("tests/test_gff2gtf/test_prok.gtf")) self.assertTrue(os.path.exists("tests/test_gff2gtf/eukarya_test.gtf")) with open("tests/test_gff2gtf/test_prok.gtf") as pg: lines = pg.readlines() self.assertEqual(lines[5].split("\t")[4], "1747") with open("tests/test_gff2gtf/eukarya_test.gtf") as pg: lines = pg.readlines() self.assertEqual(lines[5].split("\t")[4], "3007")
def test_gtfs_creation(self): """Test if GFF2GTF works for multiple gffs.""" luigi.interface.build([ Map.GFF2GTF( gff_file= "tests/data/test_prok.gff,tests/data/eukarya_test.gff3", bindir="bin", workdir="tests/test_gff2gtf") ], local_scheduler=True) self.assertTrue(os.path.exists("tests/test_gff2gtf/test_prok.gtf")) self.assertTrue(os.path.exists("tests/test_gff2gtf/eukarya_test.gtf")) with open("tests/test_gff2gtf/test_prok.gtf") as pg: first_line_fourth_column = pg.readline().split("\t")[3] self.assertEqual(first_line_fourth_column, "462") with open("tests/test_gff2gtf/eukarya_test.gtf") as pg: first_line_fifth_column = pg.readline().split("\t")[4] self.assertEqual(first_line_fifth_column, "2754")