Convert all .bam of a folder to .sam

- 1 min

The following is the bash command I use to convert all the BAM files in a folder to SAM files using SAMtools:

for file in ./*.bam; do
    echo $file 
    ~/Software/samtools-0.1.19/samtools view -h $file > ${file/.bam/.sam}
Carles Hernandez-Ferrer

Carles Hernandez-Ferrer

Bioinformatics, data analysis and software development

rss facebook twitter github gitlab youtube mail spotify lastfm instagram linkedin google google-plus pinterest medium vimeo stackoverflow reddit quora quora