Hi,
I have recieved the following error with running the code below code:
...
bowtie2 -x /home/galaxy/Downloads/kumaran/Bactrocera_tryoni -1 /home/galaxy/Downloads/kumaran/reads/CLI-R-B1/CLI-R_S7_L004_R1_001.fastq.gz -2 /home/galaxy/Downloads/kumaran/reads/CLI-R-B1/CLI-R_S7_L004_R2_001.fastq.gz --rg-id CLI-R_S7_L004 --rg SM:CLI-R_S7_L004 --rg LB:CLI-R_S7_L004 --rg PL:ILLUMINA | samtools view -bS - | samtools sort - /home/galaxy/Downloads/kumaran/reads/CLI-R-B1//home/galaxy/Downloads/kumaran/alignments/CLI-R_S7_L004.sorted
Completed Task = 'run_bwa'
Task enters queue = 'mergeBams'
Traceback (most recent call last):
File "/home/galaxy/PycharmProjects/chip-seq/pipeline.py", line 48, in <module>
pipeline_run([mergeBams], multithread = 5)
File "/home/galaxy/.local/lib/python2.7/site-packages/ruffus/task.py", line 5916, in pipeline_run
raise job_errors
ruffus.ruffus_exceptions.RethrownJobError:
Original exception:
Exception #1
'<class 'ruffus.ruffus_exceptions.RethrownJobError'>
Exceptions generating parameters for
task = 'mergeBams'
Original exception:
Exception #1
'ruffus.ruffus_exceptions.MissingInputFileError(
No way to run job: Input file '/home/galaxy/Downloads/kumaran/reads/C5-B1-32237239//home/galaxy/Downloads/kumaran/alignments/C5-B1_S5_L001.sorted' does not exist)' raised in ...
Task = def mergeBams(...)
This is is the code:
from ruffus import *
from collections import defaultdict
from glob import glob
import os
data_files = glob("/home/galaxy/Downloads/kumaran/reads/*/*.fastq.gz")
sambam_dir = "/home/galaxy/Downloads/kumaran/alignments"
fastq_metadata = defaultdict(dict)
ref = "/home/galaxy/Downloads/kumaran/Bactrocera_tryoni"
def make_rg(metadata):
return " --rg-id %s --rg SM:%s --rg LB:%s --rg PL:ILLUMINA" % (metadata, metadata, metadata)
@collate(data_files, regex(r"([^/]+)(_R1|_R2)\_001.fastq.gz"),
[r"%s/\1.sorted" % sambam_dir, r"%s/\1.bwaPE.Success" % sambam_dir])
def run_bwa(inputs, outputs):
"""
Aligns two paired-end fastq files to a reference genome to produce a sam file.
"""
seq1, seq2 = sorted(inputs)
output, flag_file = outputs
rg = make_rg(os.path.basename(os.path.splitext(os.path.splitext(output)[0])[0]))
cmd = "bowtie2 -x %s -1 %s -2 %s %s | samtools view -bS - | samtools sort - %s" \
% (ref, seq1, seq2, rg, output)
print cmd
# if not os.system(cmd):
# # It worked: Create completion flag_file
# open(flag_file, "w")
# Merge all the sorted BAM alignments.
@merge(run_bwa, regex(r"([^/]+).sorted.bam"), r"\1/all_reads_aligned.sorted.bam")
def mergeBams(sortedBams, output):
bams = ' '.join(sortedBams)
print bams, output
What did I do wrong?
Mic