Entering edit mode
5.8 years ago
shuksi1984
▴
60
What does SAMFormatException mean? How to troubleshoot this error. I got following error:
Exception in thread "main" htsjdk.samtools.SAMFormatException: Error parsing text SAM file. Not enough fields; File SRR6876052_mem.sam; Line 1
My command is:
nohup java -jar path/to/picard.jar SortSam INPUT=SRR6876052_mem.sam OUTPUT=SRR6876052_sortsam.bam SORT_ORDER=coordinate &
Hello shuksi,
could you please post the first lines of your sam file? How have you produced this file?
fin swimmer
Following are the 1st few lines of sam file
This file was produced by the following command:
Hello again,
those lines starting with
@
are the header lines. Beside this we need the first few lines that doesn't start by@.
fin swimmer
BTW: It's better to use the
code
formating button for file contents as well.how do we achieve that? Is my file corrupt?
To get the whole header:
To get the first 10 lines that are not the header:
The command
Gives following output:
I dont think these should be the content of sam file
You have redirected the bwa standard error output stream (stderr) to the same location as the standard output stream (stdout. Check your bwa command as redirects such as
2>&1
will do this.Check your shell configuration as well as some configurations will perform this redirect automatically.
You're correct, These status message shouldn't be in the sam file. In the command you gave above I cannot see why this happens.
Standard questions at this point: What version of bwa are you using? Which OS are you using?
fin swimmer
bwa-Version: 0.7.12-r1039 OS-Ubuntu 16.04.3 LTS (xenial)
It is because I used, nohup?
Yes, you are right. From
nohup --help
:I think you can repair your sam file by removing all lines that starts with
[
Thank you. My command was not running since I used nohup. The solution to this, I used bash scripting and redirected the error using nohup to my .sh file.