Entering edit mode
7.2 years ago
valopes
▴
30
Hi I am getting a message while converting sam to bam. I used this comand for mapping:
bwa mem -M -R '@RG\tID:sample1' -t 2 ref.fa sample1_R1.fastq
sample1_R2.fastq > sample1.sam
Now I tried to convert sam to bam, using:
samtools view -hSb PI200492.sam > PI200492.bam
and I got an Error
[W::sam_read1] parse error at line 1
[main_samview] truncated file
It looks the aligment worked!
Could someone help me please?
Thanks
Can you show the content of sam file? you can use
head PI200492.sam
I got this using
for some reasons your STDERR and STDOUT are mixed ????
are you sure you've written:
???
Yes I am sure it was this command.
no, it was not. You have used 'nohup'
Did you use exactly that command or was it embedded into any nohup-like redirection command?
In fact, I used
But I need to use "nohup" because the server here always disconnect for inactivity.
Do you think it can be the problem?
You can use GNU screen to be independent from an active terminal session.
Simply open a new screen by
screen -S <name>
. It can be detached with Ctrl-A Ctrl-D and reattached with screen -r <name>.I see. Thank you. It will help a lot. But it works just in one of the servers I've been working.
I'd recommend avoiding
nohup
. Append&
to the command or interrupt usingCtrl-Z
and then usebg
to send the job to background and then follow up withdisown <jobid>
so SIGHUPs don't bother the process. Retain the job ID to monitor the job and check your file on completion.I am sorry, I did't get it. Could you please explain it better? Thanks
When you run a command, you can run it either in the foreground or the background. The default is foreground, but you can run it in the background by using an
&
at the end of the command.But how can you move a running process from the foreground to the background? You interrupt it using
Ctrl-Z
and then use thebg
command to send it to the background. The process will then run in the background.Even a background process is linked to you, so if you logout or your connection terminates, the job will be killed. You can use
nohup
to overcome that, butnohup
is weird - I stopped using it when it messed with my redirections. You can also use a screen. I use a custom screen script that writes a log to a custom file and has a name attached to it, all done through a custom screenrc file created on the file - but I digress.A nifty trick is to use
disown
to remove your ownership of the process. That way, even if the terminal disconnects, your process keeps running as it is not attached to your terminal. But yeah, I was super sleepy when I wrote that answer andscreen
is a MUCH better way to do it.I think this should just work without the -S and -h, but I'm not sure which samtools version you are using.
Hi
I already tried this command and I got the same error. The samtools version is 1.5.