MaciekAber / pysam

Automatically exported from code.google.com/p/pysam
0 stars 0 forks source link

samtools exceptions thrown are incorrect #48

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. As far as I can tell, executing 
pysam.view("-bT",reference,"-o"+bamname,samname); on any valid samfile

What is the expected output? What do you see instead?
A pysam.SamtoolsError is thrown, even though the program properly executed, 
because "[samopen] SAM header is present: 1 sequences." is printed to stderr.

What version of the product are you using? On what operating system?
.3 on Mac OSX

Please provide any additional information below.
This logic clearly doesn't cover the "view" case:
        # samtools commands do not propagate the return code correctly.
        # I have thus added this patch to throw if there is output on stderr.
        # Note that there is sometimes output on stderr that is not an error,
        # for example: [sam_header_read2] 2 sequences loaded.
        # Ignore messages like these

Original issue reported on code.google.com by Delphi....@gmail.com on 22 Oct 2010 at 7:07

GoogleCodeExporter commented 8 years ago
Thanks,

The problem is the -o option. If used, samtools redirects stdout from
which pysam can not recover. pysam checks for -o, but expects spaces
between arguments. The command finishes without problems.

Best use ">", but I have added "[samopen] SAM header is present" to the white 
list of messages that do not raise an exception.

Bw,
Andreas

Original comment by andreas....@gmail.com on 2 Nov 2010 at 9:18