[Samtools-help] samtools mpileup -- error status 141

2014-11-13 Thread Karel Břinda
Hello,

I observe a strange problem and I am not able to find out what is the exact
reason of it. When I use samtools mpileup | another_program, samtools
return error code 141. Everything else is OK (pileup is well created, all
data are well processed). I observe it when I use set -o pipefail. The
overall return error status is 141 and it is really caused by samtools
because

echo ${PIPESTATUS[0]} ${PIPESTATUS[1]}
141 0

It is interesting that this problem appears only with pipes. When I save
the output of samtools to a file, the error code is 0.

Do you have any ideas about the reason?

Thanks

Karel
--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk___
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help


Re: [Samtools-help] samtools mpileup -- error status 141

2014-11-13 Thread John Marshall
On 13 Nov 2014, at 12:23, Karel Břinda karel.bri...@gmail.com wrote:
 I observe a strange problem and I am not able to find out what is the exact 
 reason of it. When I use samtools mpileup | another_program, samtools 
 return error code 141.

When a Unix shell reports that a command has an exit status greater than 128, 
this usually means the command was terminated by a signal.  You don't say what 
platform this is on, but typically 141 means signal 141-128 = 13, which is 
typically SIGPIPE.

 Everything else is OK (pileup is well created, all data are well processed). 
 I observe it when I use set -o pipefail. The overall return error status is 
 141 and it is really caused by samtools because
 echo ${PIPESTATUS[0]} ${PIPESTATUS[1]}
 141 0
 
 It is interesting that this problem appears only with pipes. When I save the 
 output of samtools to a file, the error code is 0.

SIGPIPE means that samtools tried to write on a pipe but there was no-one to 
read it.  So this means that another_program closed its input and exited while 
samtools mpileup still had more data to write.  Perhaps it was some trivial 
trailer or statistics and so doesn't much matter; but perhaps you should check 
that another_program really did process all the way to the end of the last 
chromosome!

John

-- 
 The Wellcome Trust Sanger Institute is operated by Genome Research 
 Limited, a charity registered in England with number 1021457 and a 
 company registered in England with number 2742969, whose registered 
 office is 215 Euston Road, London, NW1 2BE. 

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk
___
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help


Re: [Samtools-help] samtools mpileup -- error status 141

2014-11-13 Thread Karel Břinda
Hello,

thanks a lot for this excellent answer. Thanks to it I found where
originally the problem started.

So as I realized, it appeared only with FASTA files containing space in the
first line (i.e., with a sequence description). The program mentioned in my
previous e-mail as another_program considered whole strings after  as a
sequence name (did not remove the description from it). Since samtools
mpileup (unfortunately) skips some of uncovered positions (as it has been
discussed recently in this conference), another_program had to process
the PILEUP file concurrently with the FASTA file (to complet missing
information). So it considered the chromosomes in FASTA to be uncovered by
the PILEUP since the chromosome names were differing. And after iterating
over the whole FASTA file, it was still on the second line of the PILEUP
file.

An idea to the end -- would it be possible to add a new parameter to samtools
mpileup, which would ensure that all FASTA positions will be mentioned in
the PILEUP (even with zero coverage)?

Thanks again!

Karel


2014-11-13 14:07 GMT+01:00 John Marshall j...@sanger.ac.uk:

 On 13 Nov 2014, at 12:23, Karel Břinda karel.bri...@gmail.com wrote:
  I observe a strange problem and I am not able to find out what is the
 exact reason of it. When I use samtools mpileup | another_program,
 samtools return error code 141.

 When a Unix shell reports that a command has an exit status greater than
 128, this usually means the command was terminated by a signal.  You don't
 say what platform this is on, but typically 141 means signal 141-128 = 13,
 which is typically SIGPIPE.

  Everything else is OK (pileup is well created, all data are well
 processed). I observe it when I use set -o pipefail. The overall return
 error status is 141 and it is really caused by samtools because
  echo ${PIPESTATUS[0]} ${PIPESTATUS[1]}
  141 0
 
  It is interesting that this problem appears only with pipes. When I save
 the output of samtools to a file, the error code is 0.

 SIGPIPE means that samtools tried to write on a pipe but there was no-one
 to read it.  So this means that another_program closed its input and exited
 while samtools mpileup still had more data to write.  Perhaps it was some
 trivial trailer or statistics and so doesn't much matter; but perhaps you
 should check that another_program really did process all the way to the end
 of the last chromosome!

 John

 --
  The Wellcome Trust Sanger Institute is operated by Genome Research
  Limited, a charity registered in England with number 1021457 and a
  company registered in England with number 2742969, whose registered
  office is 215 Euston Road, London, NW1 2BE.

--
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://pubads.g.doubleclick.net/gampad/clk?id=154624111iu=/4140/ostg.clktrk___
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help