def main(source_base, binary_base): """Main entry point of the script.""" print 'Executing test for snp_store' print '=========================' print ph = app_tests.TestPathHelper( source_base, binary_base, 'apps/snp_store/tests') # tests dir # ============================================================ # Auto-detect the binary path. # ============================================================ path_to_program = app_tests.autolocateBinary( binary_base, 'apps/snp_store', 'snp_store') # ============================================================ # Built TestConf list. # ============================================================ # Build list with TestConf objects, analoguely to how the output # was generated in generate_outputs.sh. conf_list = [] # We prepare a list of transforms to apply to the output files. This is # used to strip the input/output paths from the programs' output to # make it more canonical and host independent. ph.outFile('-') # To ensure that the out path is set. transforms = [ app_tests.RegexpReplaceTransform("#.*snp_store.exe", "#snp_store"), app_tests.RegexpReplaceTransform("#[^ ]+snp_store", "#snp_store"), app_tests.ReplaceTransform(ph.inFile(''), ''), app_tests.ReplaceTransform(ph.outFile(''), ''), ] # ============================================================ # First Section. # ============================================================ # App TestConf objects to conf_list, just like this for each # test you want to run. # default conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('snp_store_default.stdout'), args=[ph.inFile('human-chr22-inf2.fa'), ph.inFile('human-reads2.gff'), '-o', ph.outFile('snps_default.vcf'), '-id', ph.outFile('indels_default.gff'),], to_diff=[(ph.inFile('snp_store_default.stdout'), ph.outFile('snp_store_default.stdout')), (ph.inFile('snps_default.vcf'), ph.outFile('snps_default.vcf'), transforms), (ph.inFile('indels_default.gff'), ph.outFile('indels_default.gff',))]) conf_list.append(conf) # test 2 conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('snp_store_realign.stdout'), args=[ph.inFile('human-chr22-inf2.fa'), ph.inFile('human-reads2.sam'), '-re', '-o', ph.outFile('snps_realign.vcf'), '-id', ph.outFile('indels_realign.gff')], to_diff=[(ph.inFile('snp_store_realign.stdout'), ph.outFile('snp_store_realign.stdout')), (ph.inFile('snps_realign.vcf'), ph.outFile('snps_realign.vcf'), transforms), (ph.inFile('indels_realign.gff'), ph.outFile('indels_realign.gff'))]) conf_list.append(conf) # test 3 conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('snp_store_realign_m1mp1oa.stdout'), args=[ph.inFile('human-chr22-inf2.fa'), ph.inFile('human-reads2.sam'), '-it', str(1), '-re', '-oa', '-mp', str(1), '-m', 'maq', '-hq', '-o', ph.outFile('snps_realign_m1mp1oa.vcf'), '-id', ph.outFile('indels_realign_m1mp1oa.gff')], to_diff=[(ph.inFile('snp_store_realign_m1mp1oa.stdout'), ph.outFile('snp_store_realign_m1mp1oa.stdout')), (ph.inFile('snps_realign_m1mp1oa.vcf'), ph.outFile('snps_realign_m1mp1oa.vcf'), transforms), (ph.inFile('indels_realign_m1mp1oa.gff'), ph.outFile('indels_realign_m1mp1oa.gff'))]) conf_list.append(conf) # test 4 conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('snp_store_realign_m0mp1oa.stdout'), args=[ph.inFile('human-chr22-inf2.fa'), ph.inFile('human-reads2.gff'), '-it', str(2), '-re', '-oa', '-mp', str(1), '-hq', '-o', ph.outFile('snps_realign_m0mp1oa.vcf'), '-id', ph.outFile('indels_realign_m0mp1oa.gff')], to_diff=[(ph.inFile('snp_store_realign_m0mp1oa.stdout'), ph.outFile('snp_store_realign_m0mp1oa.stdout')), (ph.inFile('snps_realign_m0mp1oa.vcf'), ph.outFile('snps_realign_m0mp1oa.vcf'), transforms), (ph.inFile('indels_realign_m0mp1oa.gff'), ph.outFile('indels_realign_m0mp1oa.gff'))]) conf_list.append(conf) # test 5 conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('snp_store_realign_m0mp1oa_it1ipt01.stdout'), args=[ph.inFile('human-chr22-inf2.fa'), ph.inFile('human-reads2.sam'), '-it', str(1), '-ipt', str(0.1), '-osc', '-re', '-oa', '-hq', '-o', ph.outFile('snps_realign_m0mp1oa_it1ipt01.vcf'), '-id', ph.outFile('indels_realign_m0mp1oa_it1ipt01.gff')], to_diff=[(ph.inFile('snp_store_realign_m0mp1oa_it1ipt01.stdout'), ph.outFile('snp_store_realign_m0mp1oa_it1ipt01.stdout')), (ph.inFile('snps_realign_m0mp1oa_it1ipt01.vcf'), ph.outFile('snps_realign_m0mp1oa_it1ipt01.vcf'), transforms), (ph.inFile('indels_realign_m0mp1oa_it1ipt01.gff'), ph.outFile('indels_realign_m0mp1oa_it1ipt01.gff'))]) conf_list.append(conf) # ============================================================ # Execute the tests. # ============================================================ failures = 0 for conf in conf_list: res = app_tests.runTest(conf) # Output to the user. print ' '.join(['snp_store'] + conf.args), if res: print 'OK' else: failures += 1 print 'FAILED' # Cleanup. ph.deleteTempDir() print '==============================' print ' total tests: %d' % len(conf_list) print ' failed tests: %d' % failures print 'successful tests: %d' % (len(conf_list) - failures) print '==============================' # Compute and return return code. return failures != 0
def main(source_base, binary_base): """Main entry point of the script.""" print 'Executing test for bs_tools' print '=========================' print ############################################################## ### Casbar ############################################################## ph = app_tests.TestPathHelper(source_base, binary_base, 'extras/apps/bs_tools/tests') # tests dir # ============================================================ # Auto-detect the binary path. # ============================================================ path_to_bisar = app_tests.autolocateBinary(binary_base, 'extras/apps/bs_tools', 'bisar') path_to_casbar = app_tests.autolocateBinary(binary_base, 'extras/apps/bs_tools', 'casbar') # ============================================================ # Built TestConf list. # ============================================================ # Build list with TestConf objects, analoguely to how the output # was generated in generate_outputs.sh. conf_list = [] ph.outFile('-') # To ensure that the out path is set. transforms = [ app_tests.ReplaceTransform( os.path.join(ph.source_base_path, 'extras/apps/bs_tools/tests') + os.sep, '', right=True), app_tests.ReplaceTransform(ph.temp_dir + os.sep, '', right=True), app_tests.RegexpReplaceTransform(r'\tVN:[^\t]*', r'\tVN:VERSION', right=True, left=True) ] # We prepare a list of transforms to apply to the output files. This is # used to strip the input/output paths from the programs' output to # make it more canonical and host independent. # Transforms for SAM output format only. Make VN field of @PG header canonical. #sam_transforms = [app_tests.RegexpReplaceTransform(r'\tVN:[^\t]*', r'\tVN:VERSION', right=True, left=True)] # ============================================================ # se # ============================================================ # App TestConf objects to conf_list, just like this for each # test you want to run. # 0 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-e3', str(4), '-e4', str(5), #-e3 4 -e4 5 '-o', ph.outFile('reads_se_N6000_0.CT_GA.verified.sam'), ph.inFile('reads_se_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000.fastq') ], to_diff=[ #(ph.inFile('STDOUT_FILE'), #ph.outFile('STDOUT_FILE')), (ph.inFile('reads_se_N6000_0.CT_GA.verified.sam'), ph.outFile('reads_se_N6000_0.CT_GA.verified.sam'), transforms) ]) conf_list.append(conf) # 1 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-gas', str(-4.5), '-ges', str(-2.0), '-der', str(0.001), '-bsc', str(0.99), '-gmr', str(0.5), '-i', str(0.8), '-rn', str(0.001), '-pms', str(0.9), '-e3', str(4), '-e4', str(5), # -gas -4.5 -ges -2.0 -der 0.001 -bsc 0.99 -gmr 0.5 -i 0.8 -rn 0.001 -pms 0.9 -mq 0 -e3 4 -e4 5 '-o', ph.outFile('reads_se_N6000_1.CT_GA.verified.sam'), ph.inFile('reads_se_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000.fastq') ], to_diff=[ #(ph.inFile('STDOUT_FILE'), #ph.outFile('STDOUT_FILE')), (ph.inFile('reads_se_N6000_1.CT_GA.verified.sam'), ph.outFile('reads_se_N6000_1.CT_GA.verified.sam'), transforms) ]) conf_list.append(conf) # 2 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nse', '-nsi', '-nsd', '-gas', str(-4.5), '-ges', str(-2.0), '-der', str(0.001), '-bsc', str(0.99), '-gmr', str(0.5), '-i', str(0.8), '-rn', str(0.001), '-pms', str(0.9), '-e3', str(4), '-e4', str(5), # -nse -nsi -nsd -gas -4.5 -ges -2.0 -der 0.001 -bsc 0.99 -gmr 0.5 -i 0.8 -rn 0.001 -pms 0.9 -mq 0 -e3 4 -e4 5 '-o', ph.outFile('reads_se_N6000_2.CT_GA.verified.sam'), ph.inFile('reads_se_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000.fastq') ], to_diff=[(ph.inFile('reads_se_N6000_2.CT_GA.verified.sam'), ph.outFile('reads_se_N6000_2.CT_GA.verified.sam'), transforms)]) conf_list.append(conf) # 3 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nse', '-nsi', '-nsd', '-gas', str(-4.5), '-ges', str(-2.0), '-der', str(0.001), '-bsc', str(0.99), '-gmr', str(0.2), '-i', str(0.8), '-rn', str(0.001), '-pms', str(0.9), '-e3', str(4), '-e4', str(5), # -nse -nsi -nsd -gas -4.5 -ges -2.0 -der 0.001 -bsc 0.99 -gmr 0.2 -i 0.8 -rn 0.001 -pms 0.9 -mq 0 -e3 4 -e4 5 '-o', ph.outFile('reads_se_N6000_3.CT_GA.verified.sam'), ph.inFile('reads_se_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000.fastq') ], to_diff=[(ph.inFile('reads_se_N6000_3.CT_GA.verified.sam'), ph.outFile('reads_se_N6000_3.CT_GA.verified.sam'), transforms)]) conf_list.append(conf) # 4 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nse', '-nsi', '-nsd', '-gas', str(-4.5), '-ges', str(-2.0), '-der', str(0.001), '-bsc', str(0.99), '-gmr', str(0.8), '-i', str(0.8), '-rn', str(0.001), '-pms', str(0.9), '-e3', str(4), '-e4', str(5), # -nse -nsi -nsd -gas -4.5 -ges -2.0 -der 0.001 -bsc 0.99 -gmr 0.8 -i 0.8 -rn 0.001 -pms 0.9 -mq 0 -e3 4 -e4 5 '-o', ph.outFile('reads_se_N6000_4.CT_GA.verified.sam'), ph.inFile('reads_se_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000.fastq') ], to_diff=[(ph.inFile('reads_se_N6000_4.CT_GA.verified.sam'), ph.outFile('reads_se_N6000_4.CT_GA.verified.sam'), transforms)]) conf_list.append(conf) # ============================================================ # pe # ============================================================ # 0 conf = app_tests.TestConf( program=path_to_bisar, redir_stdout=ph.outFile('other.stdout'), args=[ '-e3', str(4), '-e4', str(5), #-e3 4 -e4 5 '-o', ph.outFile('reads_pe_N6000_0.CT_GA.verified.sam'), ph.inFile('reads_pe_N6000.CT_GA.sam'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_pe_N6000.L.fastq'), ph.inFile('reads_pe_N6000.R.fastq') ], to_diff=[(ph.inFile('reads_pe_N6000_0.CT_GA.verified.sam'), ph.outFile('reads_pe_N6000_0.CT_GA.verified.sam'), transforms)]) conf_list.append(conf) ############################################################## ### Casbar ############################################################## # 0 conf = app_tests.TestConf( program=path_to_casbar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nec', '-mc', str(6), '-msc', str(5), '-mpc', str(0.5), '-hes', str(0.005), '-o', ph.outFile('snps_se_0.vcf'), '-b', ph.outFile('meths_se_0.bed'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000_2.CT_GA.verified.pos_so.sam') ], to_diff=[(ph.inFile('snps_se_0.vcf'), ph.outFile('snps_se_0.vcf')), (ph.inFile('meths_se_0.bed'), ph.outFile('meths_se_0.bed'))]) conf_list.append(conf) # 1 conf = app_tests.TestConf( program=path_to_casbar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nec', '-mc', str(2), '-msc', str(3), '-mpc', str(0.5), '-hes', str(0.005), '-o', ph.outFile('snps_se_1.vcf'), '-b', ph.outFile('meths_se_1.bed'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_se_N6000_2.CT_GA.verified.pos_so.sam') ], to_diff=[(ph.inFile('snps_se_1.vcf'), ph.outFile('snps_se_1.vcf')), (ph.inFile('meths_se_1.bed'), ph.outFile('meths_se_1.bed'))]) conf_list.append(conf) # ============================================================ # pe # ============================================================ # 0 conf = app_tests.TestConf( program=path_to_casbar, redir_stdout=ph.outFile('other.stdout'), args=[ '-nec', '-mc', str(6), '-msc', str(5), '-mpc', str(0.5), '-hes', str(0.005), '-o', ph.outFile('snps_pe_0.vcf'), '-b', ph.outFile('meths_pe_0.bed'), ph.inFile('hg18_chr21_3000.fa'), ph.inFile('reads_pe_N6000_0.CT_GA.verified.pos_so.sam') ], to_diff=[(ph.inFile('snps_pe_0.vcf'), ph.outFile('snps_pe_0.vcf')), (ph.inFile('meths_pe_0.bed'), ph.outFile('meths_pe_0.bed'))]) conf_list.append(conf) # ============================================================ # Execute the tests. # ============================================================ failures = 0 for conf in conf_list: res = app_tests.runTest(conf) # Output to the user. print ' '.join([os.path.basename(conf.program)] + conf.args), if res: print 'OK' else: failures += 1 print 'FAILED' # Cleanup. ph.deleteTempDir() print '==============================' print ' total tests: %d' % len(conf_list) print ' failed tests: %d' % failures print 'successful tests: %d' % (len(conf_list) - failures) print '==============================' # Compute and return return code. return failures != 0
def main(source_base, binary_base): """Main entry point of the script.""" print 'Executing test for mason' print '========================' print ph = app_tests.TestPathHelper( source_base, binary_base, 'core/apps/mason/tests') # tests dir # ============================================================ # Auto-detect the binary path. # ============================================================ path_to_program = app_tests.autolocateBinary( binary_base, 'core/apps/mason', 'mason') # ============================================================ # Built TestConf list. # ============================================================ # Build list with TestConf objects, analoguely to how the output # was generated in generate_outputs.sh. conf_list = [] # We prepare a list of transforms to apply to the output files: Strip the # running times from output. transforms = [ app_tests.RegexpReplaceTransform(r'Finished haplotype creation in [^ ]+s', r'Finished haplotype creation in <cut out>s', left=True, right=True), ] # ============================================================ # Run 454 Reads, Single-End # ============================================================ conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('454-se-random-N100-nm400-ne40-s0.stdout'), args=['454', '-N', '100', '-nm', '400', '-ne', '40', '-s', '0', '-rnp', 'read', '-o', ph.outFile('454-se-random-N100-nm400-ne40-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('454-se-random-N100-nm400-ne40-s0.fasta'), ph.outFile('454-se-random-N100-nm400-ne40-s0.fasta')), (ph.inFile('454-se-random-N100-nm400-ne40-s0.fasta.sam'), ph.outFile('454-se-random-N100-nm400-ne40-s0.fasta.sam')), (ph.inFile('454-se-random-N100-nm400-ne40-s0.stdout'), ph.outFile('454-se-random-N100-nm400-ne40-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('454-se-random-N100-nm400-ne40-s0-sq.stdout'), args=['454', '-N', '100', '-nm', '400', '-ne', '40', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('454-se-random-N100-nm400-ne40-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('454-se-random-N100-nm400-ne40-s0-sq.fastq'), ph.outFile('454-se-random-N100-nm400-ne40-s0-sq.fastq')), (ph.inFile('454-se-random-N100-nm400-ne40-s0-sq.fastq.sam'), ph.outFile('454-se-random-N100-nm400-ne40-s0-sq.fastq.sam')), (ph.inFile('454-se-random-N100-nm400-ne40-s0-sq.stdout'), ph.outFile('454-se-random-N100-nm400-ne40-s0-sq.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('454-se-random-N100-nm200-ne20-s0.stdout'), args=['454', '-N', '100', '-nm', '200', '-ne', '20', '-s', '0', '-rnp', 'read', '-o', ph.outFile('454-se-random-N100-nm200-ne20-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('454-se-random-N100-nm200-ne20-s0.fasta'), ph.outFile('454-se-random-N100-nm200-ne20-s0.fasta')), (ph.inFile('454-se-random-N100-nm200-ne20-s0.fasta.sam'), ph.outFile('454-se-random-N100-nm200-ne20-s0.fasta.sam')), (ph.inFile('454-se-random-N100-nm200-ne20-s0.stdout'), ph.outFile('454-se-random-N100-nm200-ne20-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('454-se-random-N100-nm200-ne20-s0-sq.stdout'), args=['454', '-N', '100', '-nm', '200', '-ne', '20', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('454-se-random-N100-nm200-ne20-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('454-se-random-N100-nm200-ne20-s0-sq.fastq'), ph.outFile('454-se-random-N100-nm200-ne20-s0-sq.fastq')), (ph.inFile('454-se-random-N100-nm200-ne20-s0-sq.fastq.sam'), ph.outFile('454-se-random-N100-nm200-ne20-s0-sq.fastq.sam')), (ph.inFile('454-se-random-N100-nm200-ne20-s0-sq.stdout'), ph.outFile('454-se-random-N100-nm200-ne20-s0-sq.stdout'), transforms)]) conf_list.append(conf) # ============================================================ # Run Illumina Reads, Single-End # ============================================================ conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-random-N100-n36-s0.stdout'), args=['illumina', '-N', '100', '-n', '36', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-se-random-N100-n36-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('illumina-se-random-N100-n36-s0.fasta'), ph.outFile('illumina-se-random-N100-n36-s0.fasta')), (ph.inFile('illumina-se-random-N100-n36-s0.fasta.sam'), ph.outFile('illumina-se-random-N100-n36-s0.fasta.sam')), (ph.inFile('illumina-se-random-N100-n36-s0.stdout'), ph.outFile('illumina-se-random-N100-n36-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-random-N100-n36-s0-sq.stdout'), args=['illumina', '-N', '100', '-n', '36', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-se-random-N100-n36-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('illumina-se-random-N100-n36-s0-sq.fastq'), ph.outFile('illumina-se-random-N100-n36-s0-sq.fastq')), (ph.inFile('illumina-se-random-N100-n36-s0-sq.fastq.sam'), ph.outFile('illumina-se-random-N100-n36-s0-sq.fastq.sam')), (ph.inFile('illumina-se-random-N100-n36-s0-sq.stdout'), ph.outFile('illumina-se-random-N100-n36-s0-sq.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-random-N100-n100-s0.stdout'), args=['illumina', '-N', '100', '-n', '100', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-se-random-N100-n100-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('illumina-se-random-N100-n100-s0.fasta'), ph.outFile('illumina-se-random-N100-n100-s0.fasta')), (ph.inFile('illumina-se-random-N100-n100-s0.fasta.sam'), ph.outFile('illumina-se-random-N100-n100-s0.fasta.sam')), (ph.inFile('illumina-se-random-N100-n100-s0.stdout'), ph.outFile('illumina-se-random-N100-n100-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-random-N100-n100-s0-sq.stdout'), args=['illumina', '-N', '100', '-n', '100', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-se-random-N100-n100-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('illumina-se-random-N100-n100-s0-sq.fastq'), ph.outFile('illumina-se-random-N100-n100-s0-sq.fastq')), (ph.inFile('illumina-se-random-N100-n100-s0-sq.fastq.sam'), ph.outFile('illumina-se-random-N100-n100-s0-sq.fastq.sam')), (ph.inFile('illumina-se-random-N100-n100-s0-sq.stdout'), ph.outFile('illumina-se-random-N100-n100-s0-sq.stdout'), transforms)]) conf_list.append(conf) # ============================================================ # Run Illumina Reads, Single-End, Existing Contig # ============================================================ conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-adeno-N100-n36-s0.stdout'), args=['illumina', '-N', '100', '-n', '36', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-se-adeno-N100-n36-s0.fasta'), ph.inFile('adeno-genome.fa')], to_diff=[(ph.inFile('illumina-se-adeno-N100-n36-s0.fasta'), ph.outFile('illumina-se-adeno-N100-n36-s0.fasta')), (ph.inFile('illumina-se-adeno-N100-n36-s0.fasta.sam'), ph.outFile('illumina-se-adeno-N100-n36-s0.fasta.sam')), (ph.inFile('illumina-se-adeno-N100-n36-s0.stdout'), ph.outFile('illumina-se-adeno-N100-n36-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-adeno-N100-n36-s0-sq.stdout'), args=['illumina', '-N', '100', '-n', '36', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-se-adeno-N100-n36-s0-sq.fastq'), ph.inFile('adeno-genome.fa')], to_diff=[(ph.inFile('illumina-se-adeno-N100-n36-s0-sq.fastq'), ph.outFile('illumina-se-adeno-N100-n36-s0-sq.fastq')), (ph.inFile('illumina-se-adeno-N100-n36-s0-sq.fastq.sam'), ph.outFile('illumina-se-adeno-N100-n36-s0-sq.fastq.sam')), (ph.inFile('illumina-se-adeno-N100-n36-s0-sq.stdout'), ph.outFile('illumina-se-adeno-N100-n36-s0-sq.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-adeno-N100-n100-s0.stdout'), args=['illumina', '-N', '100', '-n', '100', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-se-adeno-N100-n100-s0.fasta'), ph.inFile('adeno-genome.fa')], to_diff=[(ph.inFile('illumina-se-adeno-N100-n100-s0.fasta'), ph.outFile('illumina-se-adeno-N100-n100-s0.fasta')), (ph.inFile('illumina-se-adeno-N100-n100-s0.fasta.sam'), ph.outFile('illumina-se-adeno-N100-n100-s0.fasta.sam')), (ph.inFile('illumina-se-adeno-N100-n100-s0.stdout'), ph.outFile('illumina-se-adeno-N100-n100-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-se-adeno-N100-n100-s0-sq.stdout'), args=['illumina', '-N', '100', '-n', '100', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-se-adeno-N100-n100-s0-sq.fastq'), ph.inFile('adeno-genome.fa')], to_diff=[(ph.inFile('illumina-se-adeno-N100-n100-s0-sq.fastq'), ph.outFile('illumina-se-adeno-N100-n100-s0-sq.fastq')), (ph.inFile('illumina-se-adeno-N100-n100-s0-sq.fastq.sam'), ph.outFile('illumina-se-adeno-N100-n100-s0-sq.fastq.sam')), (ph.inFile('illumina-se-adeno-N100-n100-s0-sq.stdout'), ph.outFile('illumina-se-adeno-N100-n100-s0-sq.stdout'), transforms)]) conf_list.append(conf) # ============================================================ # Run Illumina Reads, Paired-End # ============================================================ conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-pe-random-N100-n36-s0.stdout'), args=['illumina', '-mp', '-N', '100', '-n', '36', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-pe-random-N100-n36-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('illumina-pe-random-N100-n36-s0_1.fasta'), ph.outFile('illumina-pe-random-N100-n36-s0_1.fasta')), (ph.inFile('illumina-pe-random-N100-n36-s0_2.fasta'), ph.outFile('illumina-pe-random-N100-n36-s0_2.fasta')), (ph.inFile('illumina-pe-random-N100-n36-s0.fasta.sam'), ph.outFile('illumina-pe-random-N100-n36-s0.fasta.sam')), (ph.inFile('illumina-pe-random-N100-n36-s0.stdout'), ph.outFile('illumina-pe-random-N100-n36-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-pe-random-N100-n36-s0-sq.stdout'), args=['illumina', '-mp', '-N', '100', '-n', '36', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-pe-random-N100-n36-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('illumina-pe-random-N100-n36-s0-sq_1.fastq'), ph.outFile('illumina-pe-random-N100-n36-s0-sq_1.fastq')), (ph.inFile('illumina-pe-random-N100-n36-s0-sq_2.fastq'), ph.outFile('illumina-pe-random-N100-n36-s0-sq_2.fastq')), (ph.inFile('illumina-pe-random-N100-n36-s0-sq.fastq.sam'), ph.outFile('illumina-pe-random-N100-n36-s0-sq.fastq.sam')), (ph.inFile('illumina-pe-random-N100-n36-s0-sq.stdout'), ph.outFile('illumina-pe-random-N100-n36-s0-sq.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-pe-random-N100-n100-s0.stdout'), args=['illumina', '-mp', '-N', '100', '-n', '100', '-s', '0', '-rnp', 'read', '-o', ph.outFile('illumina-pe-random-N100-n100-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('illumina-pe-random-N100-n100-s0_1.fasta'), ph.outFile('illumina-pe-random-N100-n100-s0_1.fasta')), (ph.inFile('illumina-pe-random-N100-n100-s0_2.fasta'), ph.outFile('illumina-pe-random-N100-n100-s0_2.fasta')), (ph.inFile('illumina-pe-random-N100-n100-s0.fasta.sam'), ph.outFile('illumina-pe-random-N100-n100-s0.fasta.sam')), (ph.inFile('illumina-pe-random-N100-n100-s0.stdout'), ph.outFile('illumina-pe-random-N100-n100-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('illumina-pe-random-N100-n100-s0-sq.stdout'), args=['illumina', '-mp', '-N', '100', '-n', '100', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('illumina-pe-random-N100-n100-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('illumina-pe-random-N100-n100-s0-sq_1.fastq'), ph.outFile('illumina-pe-random-N100-n100-s0-sq_1.fastq')), (ph.inFile('illumina-pe-random-N100-n100-s0-sq_2.fastq'), ph.outFile('illumina-pe-random-N100-n100-s0-sq_2.fastq')), (ph.inFile('illumina-pe-random-N100-n100-s0-sq.fastq.sam'), ph.outFile('illumina-pe-random-N100-n100-s0-sq.fastq.sam')), (ph.inFile('illumina-pe-random-N100-n100-s0-sq.stdout'), ph.outFile('illumina-pe-random-N100-n100-s0-sq.stdout'), transforms)]) conf_list.append(conf) # ============================================================ # Run Sanger Reads, Single-End # ============================================================ conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('sanger-se-random-N100-nm400-ne40-s0.stdout'), args=['sanger', '-N', '100', '-nm', '400', '-ne', '40', '-s', '0', '-rnp', 'read', '-o', ph.outFile('sanger-se-random-N100-nm400-ne40-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('sanger-se-random-N100-nm400-ne40-s0.fasta'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0.fasta')), (ph.inFile('sanger-se-random-N100-nm400-ne40-s0.fasta.sam'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0.fasta.sam')), (ph.inFile('sanger-se-random-N100-nm400-ne40-s0.stdout'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('sanger-se-random-N100-nm400-ne40-s0-sq.stdout'), args=['sanger', '-N', '100', '-nm', '400', '-ne', '40', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('sanger-se-random-N100-nm400-ne40-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('sanger-se-random-N100-nm400-ne40-s0-sq.fastq'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0-sq.fastq')), (ph.inFile('sanger-se-random-N100-nm400-ne40-s0-sq.fastq.sam'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0-sq.fastq.sam')), (ph.inFile('sanger-se-random-N100-nm400-ne40-s0-sq.stdout'), ph.outFile('sanger-se-random-N100-nm400-ne40-s0-sq.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('sanger-se-random-N100-nm200-ne20-s0.stdout'), args=['sanger', '-N', '100', '-nm', '200', '-ne', '20', '-s', '0', '-rnp', 'read', '-o', ph.outFile('sanger-se-random-N100-nm200-ne20-s0.fasta'), 'random.fasta'], to_diff=[(ph.inFile('sanger-se-random-N100-nm200-ne20-s0.fasta'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0.fasta')), (ph.inFile('sanger-se-random-N100-nm200-ne20-s0.fasta.sam'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0.fasta.sam')), (ph.inFile('sanger-se-random-N100-nm200-ne20-s0.stdout'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0.stdout'), transforms)]) conf_list.append(conf) conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('sanger-se-random-N100-nm200-ne20-s0-sq.stdout'), args=['sanger', '-N', '100', '-nm', '200', '-ne', '20', '-s', '0', '-sq', '-rnp', 'read', '-o', ph.outFile('sanger-se-random-N100-nm200-ne20-s0-sq.fastq'), 'random.fasta'], to_diff=[(ph.inFile('sanger-se-random-N100-nm200-ne20-s0-sq.fastq'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0-sq.fastq')), (ph.inFile('sanger-se-random-N100-nm200-ne20-s0-sq.fastq.sam'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0-sq.fastq.sam')), (ph.inFile('sanger-se-random-N100-nm200-ne20-s0-sq.stdout'), ph.outFile('sanger-se-random-N100-nm200-ne20-s0-sq.stdout'), transforms)]) conf_list.append(conf) # Execute the tests. failures = 0 for conf in conf_list: print ' '.join(['mason'] + conf.args), sys.stdout.flush() res = app_tests.runTest(conf) # Output to the user. print ' '.join(['mason'] + conf.args), if res: print 'OK' else: failures += 1 print 'FAILED' # Cleanup. ph.deleteTempDir() print '==============================' print ' total tests: %d' % len(conf_list) print ' failed tests: %d' % failures print 'successful tests: %d' % (len(conf_list) - failures) print '==============================' # Compute and return return code. return failures != 0
""" import logging import os.path import sys import glob # Automagically add util/py_lib to PYTHONPATH environment variable. path = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'util', 'py_lib')) sys.path.insert(0, path) import seqan.app_tests as app_tests transforms = [ app_tests.RegexpReplaceTransform("[0-9\.\-e]+ sec", "0.0 sec"), app_tests.RegexpReplaceTransform("Free [0-9]+ of [0-9]+ MB", "Free 0 of 0 MB") ] def main(source_base, binary_base): """Main entry point of the script.""" print 'Executing test for cuda mapper' print '==============================' print ph = app_tests.TestPathHelper(source_base, binary_base, 'core/apps/cuda_mapper/tests') # tests dir
""" import logging import os.path import sys import glob # Automagically add util/py_lib to PYTHONPATH environment variable. path = os.path.abspath( os.path.join(os.path.dirname(__file__), '..', '..', '..', 'util', 'py_lib')) sys.path.insert(0, path) import seqan.app_tests as app_tests log_transforms = [ app_tests.RegexpReplaceTransform("[0-9\.\-e]+ sec", "0.0 sec"), app_tests.RegexpReplaceTransform("Free [0-9]+ of [0-9]+ MB", "Free 0 of 0 MB") ] sam_transforms = [app_tests.RegexpReplaceTransform("@PG.*", "@PG")] def main(source_base, binary_base): """Main entry point of the script.""" # gold standard binary files created on little endian if sys.byteorder != 'little': print 'Skipping tests for Yara on big endian' print '=====================================' return 0
def main(source_base, binary_base): """Main entry point of the script.""" print 'Executing test for seqcons2' print '===========================' print ph = app_tests.TestPathHelper(source_base, binary_base, 'apps/seqcons2/tests') # tests dir # ============================================================ # Auto-detect the binary path. # ============================================================ path_to_seqcons = app_tests.autolocateBinary(binary_base, 'bin', 'seqcons2') # ============================================================ # Built TestConf list. # ============================================================ # Build list with TestConf objects, analoguely to how the output # was generated in generate_outputs.sh. conf_list = [] # We prepare a list of transforms to apply to the output files. This is # used to strip the input/output paths from the programs' output to # make it more canonical and host independent. ph.outFile('-') # To ensure that the out path is set. transforms = [ app_tests.ReplaceTransform( os.path.join(ph.source_base_path, 'apps/seqcons2/tests') + os.sep, '', right=True), app_tests.ReplaceTransform(ph.temp_dir + os.sep, '', right=True), app_tests.RegexpReplaceTransform(r'Overall time: .*s', r'Overall time: <removed>s', right=True, left=True), app_tests.NormalizeScientificExponentsTransform(), ] # ============================================================ # Test seqcons2 # ============================================================ # overlap_consensus and nop for FASTA input for method in ['overlap_consensus', 'nop']: conf = app_tests.TestConf( program=path_to_seqcons, args=[ '-m', method, '-i', ph.inFile('alns1.sam'), '-oc', ph.outFile('alns1.%s.fa' % method), '-oa', ph.outFile('alns1.%s.sam' % method), ], redir_stdout=ph.outFile('alns1.%s.sam.stdout' % method), redir_stderr=ph.outFile('alns1.%s.sam.stderr' % method), to_diff=[ (ph.inFile('alns1.%s.fa' % method), ph.outFile('alns1.%s.fa' % method)), (ph.inFile('alns1.%s.sam' % method), ph.outFile('alns1.%s.sam' % method)), (ph.inFile('alns1.%s.sam.stderr' % method), ph.outFile('alns1.%s.sam.stderr' % method), transforms), (ph.inFile('alns1.%s.sam.stdout' % method), ph.outFile('alns1.%s.sam.stdout' % method), transforms), ]) conf_list.append(conf) # all consensus variants (except for align) for SAM input for oa_ext in ['.sam', '.txt']: for method in [ 'overlap_consensus', 'pos_consensus', 'contig_consensus', 'realign', 'nop' ]: args = [ '-m', method, '-i', ph.inFile('alns1.sam'), '-oa', ph.outFile('alns1.%s%s' % (method, oa_ext)), ] to_diff = [(ph.inFile('alns1.%s.fa' % method), ph.outFile('alns1.%s.fa' % method)), (ph.inFile('alns1.%s%s' % (method, oa_ext)), ph.outFile('alns1.%s%s' % (method, oa_ext))), (ph.inFile('alns1.%s%s.stderr' % (method, oa_ext)), ph.outFile('alns1.%s%s.stderr' % (method, oa_ext)), transforms), (ph.inFile('alns1.%s%s.stdout' % (method, oa_ext)), ph.outFile('alns1.%s%s.stdout' % (method, oa_ext)), transforms)] if oa_ext != '.txt': args += [ '-oc', ph.outFile('alns1.%s.fa' % method), ] to_diff += [(ph.inFile('alns1.%s.fa' % method), ph.outFile('alns1.%s.fa' % method))] conf = app_tests.TestConf( program=path_to_seqcons, args=args, redir_stdout=ph.outFile('alns1.%s%s.stdout' % (method, oa_ext)), redir_stderr=ph.outFile('alns1.%s%s.stderr' % (method, oa_ext)), to_diff=to_diff) conf_list.append(conf) # align_consensus for longer sequences that are roughly globally similar for oa_ext in ['.sam', '.txt']: for method in ['align_consensus']: args = [ '-m', method, '-i', ph.inFile('seqs2.fa'), '-oa', ph.outFile('seqs2.%s%s' % (method, oa_ext)), ] to_diff = [(ph.inFile('seqs2.%s.fa' % method), ph.outFile('seqs2.%s.fa' % method)), (ph.inFile('seqs2.%s%s' % (method, oa_ext)), ph.outFile('seqs2.%s%s' % (method, oa_ext))), (ph.inFile('seqs2.%s%s.stderr' % (method, oa_ext)), ph.outFile('seqs2.%s%s.stderr' % (method, oa_ext)), transforms), (ph.inFile('seqs2.%s%s.stdout' % (method, oa_ext)), ph.outFile('seqs2.%s%s.stdout' % (method, oa_ext)), transforms)] if oa_ext != '.txt': args += [ '-oc', ph.outFile('seqs2.%s.fa' % method), ] to_diff += [(ph.inFile('seqs2.%s.fa' % method), ph.outFile('seqs2.%s.fa' % method))] conf = app_tests.TestConf( program=path_to_seqcons, args=args, redir_stdout=ph.outFile('seqs2.%s%s.stdout' % (method, oa_ext)), redir_stderr=ph.outFile('seqs2.%s%s.stderr' % (method, oa_ext)), to_diff=to_diff) conf_list.append(conf) # Execute the tests. failures = 0 for conf in conf_list: res = app_tests.runTest(conf) # Output to the user. print ' '.join([os.path.basename(conf.program)] + conf.args), if res: print 'OK' else: failures += 1 print 'FAILED' # Cleanup. ph.deleteTempDir() print '==============================' print ' total tests: %d' % len(conf_list) print ' failed tests: %d' % failures print 'successful tests: %d' % (len(conf_list) - failures) print '==============================' # Compute and return return code. return failures != 0
def main(source_base, binary_base, num_threads=1): """Main entry point of the script.""" print('Executing test for razers3') print('===========================') print() ph = app_tests.TestPathHelper(source_base, binary_base, 'apps/razers3/tests') # tests dir # ============================================================ # Auto-detect the binary path. # ============================================================ path_to_program = app_tests.autolocateBinary(binary_base, 'bin', 'razers3') # ============================================================ # Built TestConf list. # ============================================================ # Build list with TestConf objects, analoguely to how the output # was generated in generate_outputs.sh. conf_list = [] # We prepare a list of transforms to apply to the output files. This is # used to strip the input/output paths from the programs' output to # make it more canonical and host independent. ph.outFile('-') # To ensure that the out path is set. transforms = [ app_tests.ReplaceTransform( os.path.join(ph.source_base_path, 'apps/razers3/tests') + os.sep, '', right=True), app_tests.ReplaceTransform(ph.temp_dir + os.sep, '', right=True), ] # Transforms for SAM output format only. Make VN field of @PG header canonical. sam_transforms = [ app_tests.RegexpReplaceTransform(r'\tVN:[^\t]*', r'\tVN:VERSION', right=True, left=True) ] # Transforms for RazerS output format only. Remove pair id column. razers_transforms = [RemovePairIdColumn()] # ============================================================ # Run Adeno Single-End Tests # ============================================================ # We run the following for all read lengths we have reads for. for rl in [36, 100]: # Run with default options. conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-tc%d.stdout' % (rl, num_threads)), args=[ '-tc', str(num_threads), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-tc%d.razers' % (rl, num_threads)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1-tc%d.razers' % (rl, num_threads)), ph.outFile('se-adeno-reads%d_1-tc%d.razers' % (rl, num_threads))), (ph.inFile('se-adeno-reads%d_1-tc%d.stdout' % (rl, num_threads)), ph.outFile('se-adeno-reads%d_1-tc%d.stdout' % (rl, num_threads)))]) conf_list.append(conf) # Allow indels. conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-ng-tc%d.stdout' % (rl, num_threads)), args=[ '-tc', str(num_threads), '-ng', ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-ng-tc%d.razers' % (rl, num_threads)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1-ng-tc%d.razers' % (rl, num_threads)), ph.outFile('se-adeno-reads%d_1-ng-tc%d.razers' % (rl, num_threads))), (ph.inFile('se-adeno-reads%d_1-ng-tc%d.stdout' % (rl, num_threads)), ph.outFile('se-adeno-reads%d_1-ng-tc%d.stdout' % (rl, num_threads)))]) conf_list.append(conf) # Compute forward/reverse matches only. for o in ['-r', '-f']: conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1%s-tc%d.stdout' % (rl, o, num_threads)), args=[ '-tc', str(num_threads), o, ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1%s-tc%d.razers' % (rl, o, num_threads)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1%s-tc%d.razers' % (rl, o, num_threads)), ph.outFile('se-adeno-reads%d_1%s-tc%d.razers' % (rl, o, num_threads))), (ph.inFile('se-adeno-reads%d_1%s-tc%d.stdout' % (rl, o, num_threads)), ph.outFile('se-adeno-reads%d_1%s-tc%d.stdout' % (rl, o, num_threads)))]) conf_list.append(conf) # Compute with different identity rates. for i in range(90, 101): conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-i%d-tc%d.stdout' % (rl, i, num_threads)), args=[ '-tc', str(num_threads), '-i', str(i), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-i%d-tc%d.razers' % (rl, i, num_threads)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1-i%d-tc%d.razers' % (rl, i, num_threads)), ph.outFile('se-adeno-reads%d_1-i%d-tc%d.razers' % (rl, i, num_threads))), (ph.inFile('se-adeno-reads%d_1-i%d-tc%d.stdout' % (rl, i, num_threads)), ph.outFile('se-adeno-reads%d_1-i%d-tc%d.stdout' % (rl, i, num_threads)))]) conf_list.append(conf) # Compute with different output formats. for of, suffix in enumerate( ['razers', 'fa', 'eland', 'gff', 'sam', 'afg']): this_transforms = list(transforms) if suffix == 'razers': this_transforms += razers_transforms elif suffix == 'sam': this_transforms += sam_transforms conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-of%d-tc%d.stdout' % (rl, of, num_threads)), args=[ '-tc', str(num_threads), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-of%d-tc%d.%s' % (rl, of, num_threads, suffix)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1-of%d-tc%d.%s' % (rl, of, num_threads, suffix)), ph.outFile('se-adeno-reads%d_1-of%d-tc%d.%s' % (rl, of, num_threads, suffix)), this_transforms), (ph.inFile('se-adeno-reads%d_1-of%d-tc%d.stdout' % (rl, of, num_threads)), ph.outFile('se-adeno-reads%d_1-of%d-tc%d.stdout' % (rl, of, num_threads)), transforms)]) conf_list.append(conf) # Compute with different sort orders. for so in [0, 1]: conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-so%d-tc%d.stdout' % (rl, so, num_threads)), args=[ '-tc', str(num_threads), '-so', str(so), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-so%d-tc%d.razers' % (rl, so, num_threads)) ], to_diff=[(ph.inFile('se-adeno-reads%d_1-so%d-tc%d.razers' % (rl, so, num_threads)), ph.outFile('se-adeno-reads%d_1-so%d-tc%d.razers' % (rl, so, num_threads))), (ph.inFile('se-adeno-reads%d_1-so%d-tc%d.stdout' % (rl, so, num_threads)), ph.outFile('se-adeno-reads%d_1-so%d-tc%d.stdout' % (rl, so, num_threads)))]) conf_list.append(conf) # ============================================================ # Run Adeno Paired-End Tests # ============================================================ # We run the following for all read lengths we have reads for. for rl in [36, 100]: # Run with default options. conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)), args=[ '-tc', str(num_threads), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)), ph.outFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)), razers_transforms), (ph.inFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)), ph.outFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)))]) conf_list.append(conf) # Allow indels. conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)), args=[ '-tc', str(num_threads), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)), ph.outFile('pe-adeno-reads%d_2-tc%d.razers' % (rl, num_threads)), razers_transforms), (ph.inFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)), ph.outFile('pe-adeno-reads%d_2-tc%d.stdout' % (rl, num_threads)))]) conf_list.append(conf) # Compute forward/reverse matches only. for o in ['-r', '-f']: conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2%s-tc%d.stdout' % (rl, o, num_threads)), args=[ '-tc', str(num_threads), o, ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2%s-tc%d.razers' % (rl, o, num_threads)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2%s-tc%d.razers' % (rl, o, num_threads)), ph.outFile('pe-adeno-reads%d_2%s-tc%d.razers' % (rl, o, num_threads)), razers_transforms), (ph.inFile('pe-adeno-reads%d_2%s-tc%d.stdout' % (rl, o, num_threads)), ph.outFile('pe-adeno-reads%d_2%s-tc%d.stdout' % (rl, o, num_threads)))]) conf_list.append(conf) # Compute with different identity rates. for i in range(90, 101): conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2-i%d-tc%d.stdout' % (rl, i, num_threads)), args=[ '-tc', str(num_threads), '-i', str(i), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2-i%d-tc%d.razers' % (rl, i, num_threads)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2-i%d-tc%d.razers' % (rl, i, num_threads)), ph.outFile('pe-adeno-reads%d_2-i%d-tc%d.razers' % (rl, i, num_threads)), razers_transforms), (ph.inFile('pe-adeno-reads%d_2-i%d-tc%d.stdout' % (rl, i, num_threads)), ph.outFile('pe-adeno-reads%d_2-i%d-tc%d.stdout' % (rl, i, num_threads)))]) conf_list.append(conf) # Compute with different output formats. for of, suffix in enumerate( ['razers', 'fa', 'eland', 'gff', 'sam', 'afg']): this_transforms = list(transforms) if suffix == 'razers': this_transforms += razers_transforms elif suffix == 'sam': this_transforms += sam_transforms conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2-of%d-tc%d.stdout' % (rl, of, num_threads)), args=[ '-tc', str(num_threads), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2-of%d-tc%d.%s' % (rl, of, num_threads, suffix)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2-of%d-tc%d.%s' % (rl, of, num_threads, suffix)), ph.outFile('pe-adeno-reads%d_2-of%d-tc%d.%s' % (rl, of, num_threads, suffix)), this_transforms), (ph.inFile('pe-adeno-reads%d_2-of%d-tc%d.stdout' % (rl, of, num_threads)), ph.outFile('pe-adeno-reads%d_2-of%d-tc%d.stdout' % (rl, of, num_threads)), this_transforms)]) conf_list.append(conf) # Compute with different sort orders. for so in [0, 1]: conf = app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('pe-adeno-reads%d_2-so%d-tc%d.stdout' % (rl, so, num_threads)), args=[ '-tc', str(num_threads), '-so', str(so), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), ph.inFile('adeno-reads%d_2.fa' % rl), '-o', ph.outFile('pe-adeno-reads%d_2-so%d-tc%d.razers' % (rl, so, num_threads)) ], to_diff=[(ph.inFile('pe-adeno-reads%d_2-so%d-tc%d.razers' % (rl, so, num_threads)), ph.outFile('pe-adeno-reads%d_2-so%d-tc%d.razers' % (rl, so, num_threads)), razers_transforms), (ph.inFile('pe-adeno-reads%d_2-so%d-tc%d.stdout' % (rl, so, num_threads)), ph.outFile('pe-adeno-reads%d_2-so%d-tc%d.stdout' % (rl, so, num_threads)))]) conf_list.append(conf) # Execute the tests. failures = 0 for conf in conf_list: res = app_tests.runTest(conf) # Output to the user. print(' '.join(['razers3'] + conf.args), end=' ') if res: print('OK') else: failures += 1 print('FAILED') # Cleanup. ph.deleteTempDir() print('==============================') print(' total tests: %d' % len(conf_list)) print(' failed tests: %d' % failures) print('successful tests: %d' % (len(conf_list) - failures)) print('==============================') # Compute and return return code. return failures != 0
Usage: run_tests.py SOURCE_ROOT_PATH BINARY_ROOT_PATH """ import logging import os.path import sys import glob # Automagically add util/py_lib to PYTHONPATH environment variable. path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'util', 'py_lib')) sys.path.insert(0, path) import seqan.app_tests as app_tests transforms = [ app_tests.RegexpReplaceTransform("[0-9\.\-e]+ sec", "0.0 sec") ] defaultFormat = 'raw' samFormat = 'sam' def getMapperConf(ph, path_to_program, rl, optionName, optionValue): return app_tests.TestConf( program=path_to_program, redir_stdout=ph.outFile('se-adeno-reads%d_1-%s%s.stdout' % (rl, optionName, optionValue)), args=['-'+optionName, str(optionValue), ph.inFile('adeno-genome.fa'), ph.inFile('adeno-reads%d_1.fa' % rl), '-o', ph.outFile('se-adeno-reads%d_1-%s%s.out.%s' % (rl, optionName, optionValue, defaultFormat))], to_diff=[(ph.inFile('se-adeno-reads%d_1-%s%s.out.%s' % (rl, optionName, optionValue, defaultFormat)), ph.outFile('se-adeno-reads%d_1-%s%s.out.%s' % (rl, optionName, optionValue, defaultFormat)), 'md5'),