Sam files cannot have any trailing tabs at the end of each sam file entry. If you do, the sam-to-bam conversion (samtools view -Sb file.sam > file.bam) will not work.


This has actually been documented here: http://groups.google.com/group/bedtools-discuss/browse_thread/thread/b0535d6769540fe0?pli=1


I was able to get around this however, with a simple sed command:


sed 's/[ \t]*$//' file.sam > file.notrailingtabs.sam

Now, the sam-to-bam conversion will work:

samtools view -Sb file.notrailingtabs.sam > file.notrailingtabs.bam