quachtina96 / pysam

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

pysam.calmd output redirection #109

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Calmd samtools command receives a set of parameters and always returns the 
modified SAM/BAM to the standard output. Using the samtools command-line it is 
quite simple to just redirect the command's output to a file, but using pysam I 
couldn't find how to do this.

I just would like to redirect my output to a file.

Adding the redirection to the command didn't work:
pysam.calmd(*["-b", "-C", "50", "input.bam", "human_g1k_v37.fasta", 
">output.bam"])

Neither a "-o" parameter:
pysam.calmd(*["-o", "output.bam", "-b", "-C", "50", "input.bam", 
"human_g1k_v37.fasta"])

Maybe I am just missing something.

Thanks in advance!
Pablo.

Original issue reported on code.google.com by priesgof...@gmail.com on 3 Jan 2013 at 10:25

GoogleCodeExporter commented 9 years ago
This should work:

lines = pysam.calmd(*["-b", "input.bam", "human_g1k_v37.fasta"])
output = open("output.bam", 'w')
for line in lines:
    output.write(line)
output.close()

Original comment by mjldeh...@gmail.com on 10 Jan 2013 at 4:26

GoogleCodeExporter commented 9 years ago
Thanks!

Original comment by priesgof...@gmail.com on 10 Jan 2013 at 11:55

GoogleCodeExporter commented 9 years ago

Original comment by andreas....@gmail.com on 14 Jan 2013 at 10:28