Converting multiple cram files to fastq files.
Hello everyone, I need help with converting cram files to fastq files. I have many cram files with me and want to convert them to fastq files at once. I am using samtools for conversion. Is there any possible way to do that ??
• 2,207 views
•
link
1 answer
using a Makefile
BAMS=$(shell find /path/to/dir -type f -name "*.cram" )
FASTQS=$(addsuffix .R1.fastq.gz,$(basename $(BAMS)))
REF=/path/to/ref.fa
%.R1.fastq.gz: %.cram
samtools collate --reference $(REF) -O -u -f --no-PG $< |\
samtools bam2fq -1 $@ -2 $(addsuffix .R2.fastq.gz,$(basename $<))
all: $(FASTQS)
invoke with make -j <number-of-threads>
• 0 views
•
link
Log in to answer this question.
You can simply use a
forloop to go through all files or submit parallel jobs if you are on a cluster and can use a job scheduler.Can you please give the code with for loop, I am actually new to scripting and tried a lot but none of them working.
Do not delete posts that have received feedback. Show us something that you've tried and tell us how it failed.