Use samtools from the command line:
samtools view -h -o out.sam in.bam
oh I understand guys. before this command, we should install samtools in the bash. http://www.htslib.org/download/
Have you tried Googling "where is the command line"? Also, the fact that you need to convert a file for your mother is irrelevant here, so why mention it?
When you do find the command line, ensure you don't enter the $
at the beginning; that's just the symbol for the command line prompt and is not meant to be part of the command.
If you want to do it in batch:
# convert BAM to SAM
for file in ./*.bam
do
echo $file
samtools view -h $file > ${file/.bam/.sam}
done
Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
when converting from sam to bam the default method compresses the resulting bam file. Compression could result in data loss.
"Compression could result in data loss." This is only correct if a lossy compression algorithm is used. BAM natively employs zlib (~LZ77) compression, which is a _lossless_ compression algorithm. Thus, no data is lost.
Hi,
When I am converting Sam to Bam and back to Sam.I am loosing quality score of the Sam file. i.e. Input sam and the reversed sam does not match. Is this expected?
Hi manish. You should open a new question for this. When you put your question in as an answer, people are unlikely to respond.