Entering edit mode
6.2 years ago
Medhat
9.8k
What is the right way to use pysam.[some tool]
This for example works,
merge_parameters = ["-@", "4", "-r", output] + input_bam
pysam.merge(*merge_parameters)
But this does not work:
depth = [my_input_bam] + [">", "my.depth"]
pysam.depth(*depth)
Nor this works:
pysam.depth(my_input_bam, ">", "my.depth")
Error will be:
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=,
stderr=samtools depth: Could not open ">": No such file or
directory\n'
Is there a special way to use pysam.depth? (how to use pysam.tool
the correct way)
Hey Medhat ,
I guess the order of arguments matters and must fit the needs of the
samtools
program. Forsamtools merge
this would be:As you see the output is not streamed here and a file must be given explicit.
fin swimmer
Thanks,
The merge in my case is working while
pysam.depth
is the one that does not work.I found that the way to write out the result of
pysam.depth
:Which is not convenient.
Is there a better way?
you can parse the output into a dataframe