def mapReadsAgainstSpadesContigs(infiles, outfile): ''' map reads against spades contigs ''' inf = infiles[0] to_cluster = True index_dir = os.path.dirname(outfile) if "agg" not in infiles[1]: genome = re.search( ".*R[0-9]*", infiles[0]).group(0) + ".filtered.contigs.fa" else: genome = "agg-agg-agg.filtered.contigs.fa" if infiles[1].endswith(".bt2") or infiles[1].endswith(".ebwt"): infile, reffile = infiles[0], os.path.join(index_dir, genome) + ".fa" m = PipelineMapping.Bowtie( executable=P.substituteParameters(**locals())["bowtie_executable"]) elif infiles[1].endswith("bwt"): genome = genome job_options = " -l mem_free=%s" % (PARAMS["bwa_memory"]) bwa_index_dir = index_dir bwa_mem_options = PARAMS["bwa_mem_options"] bwa_threads = PARAMS["bwa_threads"] m = PipelineMapping.BWAMEM(remove_non_unique=True) statement = m.build((inf,), outfile) P.run()
def mapReads(infile, outfile): '''Map reads to the genome using BWA, sort and index BAM file, generate alignment statistics and deduplicate using Picard''' job_threads = PARAMS["bwa_threads"] job_memory = PARAMS["bwa_memory"] if PARAMS["bwa_algorithm"] == "aln": m = PipelineMapping.BWA( remove_non_unique=PARAMS["bwa_remove_non_unique"], strip_sequence=False) elif PARAMS["bwa_algorithm"] == "mem": m = PipelineMapping.BWAMEM( remove_non_unique=PARAMS["bwa_remove_non_unique"], strip_sequence=False) else: raise ValueError("bwa algorithm '%s' not known" % algorithm) statement = m.build((infile, ), outfile) print(statement) P.run()