How to use picard for batch sam to bam conversion
Can you please provide
a) GATK version used
b) Exact GATK commands used
c) The entire error log if applicable.
I have been using the following command for sam to bam conversion using picard; however, I do not know how to scale it up and do a batch conversion. Ideally, if I could ask picard to read all the sam files in a folder and convert them to bam files, that would be nice, if applicable. What would be the easiest way through? I would appreciate if you could guide me.
Best
Zara
java -jar picard.jar SamFormatConverter \
I=test2.sam \
O=results/test2.bam
-
Doesn't look like there are options within the tool, https://gatk.broadinstitute.org/hc/en-us/articles/360046221751-SamFormatConverter-Picard-. You may be able to use a scripting language to run this command for many files.
If other community members have found a way to do this, please chime in!
-
Thank you for your input.
Best
Zara
-
Hi again Genevieve Brandt
Do you know if samtools does the batch conversion?
Thanks alot
-
Hello
The script did the job
Thanks a lot
For i in {1..10}
Do
java -jar picard.jar SamFormatConverter \
I=$i.sam \
O=results/$i.bam
Done
Please sign in to leave a comment.
4 comments