using parallel on samtools view
0
0
Entering edit mode
4 months ago
chictu ▴ 10

I cannot get this to work. > seems to be the problem. but I can't figure out how to fix it.

bam=bam_paths.txt

id=samples_ids.txt

parallel --xapply -j 5 'samtools view -b -f 4 {1} ">" ${outdir}/{2}.unmapped.bam' :::: $bam :::: $id

Error:

[W::sam_read1] Parse error at line 1
Failed to open BAM file LP60088.unmapped.bam

I have also tried:

parallel --xapply -j 5 samtools view -b -f 4 {1} ">" ${outdir}/{2}.unmapped.bam :::: $bam :::: $id

and

parallel --xapply -j 5 'samtools view -b -f 4 {1} |tee ${outdir}/{2}.unmapped.bam' :::: $bam :::: $id

All these gave me the same error. Can someone help please?

samtools parallel • 698 views
ADD COMMENT
1
Entering edit mode

Have you tried using samtools output option -o instead of > ?

ADD REPLY
0
Entering edit mode

Yes I have. got the same error.

ADD REPLY
0
Entering edit mode

what is the output of

xargs -L1 -a bam_paths.txt  ls
ADD REPLY
0
Entering edit mode

a list of paths to the bam files.
/working/sample/aligned_read_group/q/3e3d3282xxxx.bam /working/sample/aligned_read_group/d/f8dj39dd3xxxx.bam
...etc

and the id.txt is a list of sample names.
D01
D02
...etc

ADD REPLY
0
Entering edit mode

ok so that was not an error in your apths.txt file.

ADD REPLY
0
Entering edit mode

And LP60088.unmapped.bam is a valid bam file from your input list having at least one read?

ADD REPLY
0
Entering edit mode

LP60088.unmapped.bam is an output

ADD REPLY
0
Entering edit mode

Which causes the error. Either you try to read that file despite the fact it isn't there or you don't have the permissions to write the file at the given location.

ADD REPLY

Login before adding your answer.

Traffic: 1703 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6