Thank you for your helping!! I will test with cn = pysam.view("-c", "a.bam");
Hi, guys. I'm a beginer of pysam. I got some body's code.
import pysam
cn = pysam.view("-F4","-c","./a.bam");
print cn;
when I use pysam 0.7.7, it works well. However, when I use pysam 0.9.1.4, it returns "Segmentation Fault".
Actually, I don't know those code's meaning. So, I just tested below code by myself.
import pysam
cn = pysam.view("./a.bam");
print cn;
And the result is "MemoryError".
Could anybody give me any examples for testing my pysam 0.9.1.4?
I really don't know what problem is.
I want to know whether I missed something on installation or my pysam(0.9.1.4) has bug something..etc.
Please save my code..
1 answer
Looks like you ran out of memory: https://docs.python.org/3/library/exceptions.html#exceptions.MemoryError
Your problem is that in the second snippet, you aren't returning the count of reads, you're returning the BAM data. This is causing your machine to run out of memory.
You need to add the -c option when calling pysam.view.
I would suggest reading the documentation for both pysam and samtools before venturing further.
the result is "Segmentation Fault"..
So I just test on the terminal next code.
$samtools view -c a.bam
9238589
I guess my samtools has no problem..
What should I test for inspection?
Please give me any hint...
Log in to answer this question.
What do you try to achieve?