Hi next-gen sequencing community,
as you all know, the analysis of next-generation sequencing data can be very time consuming. Therefore, i'd like to integrate parallelization into my python scripts. What i use is the python-pp package which makes it very convenient to put independent tasks into different processes which can be run in parallel. On the other hand i use the pysam package which gives me the desired functionality to access, and manipulate sequencing data. Unfortunately, it turned out that python-pp and pysam are not the best friends, and thus trouble was bound to occur.
A small example what can go wrong:
If you want to sort a set bam files within a python script in parallel, the following code should be sufficient:
Unfortunately, i got the following error message:
An error has occured during the function execution
Traceback (most recent call last):
File "/home/mbieg/.local/lib/python2.6/site-packages/ppworker.py", line 90, in run
__result = __f(*__args)
File "<string>", line 2, in sortBam
File "/home/mbieg/project/tools/python_packages/lib/python2.6/site-packages/pysam-0.6-py2.6-linux-x86_64.egg/pysam/__init__.py", line 50, in __call__
retval, stderr, stdout = csamtools._samtools_dispatch( self.dispatch, args )
File "csamtools.pyx", line 2860, in csamtools._samtools_dispatch (pysam/csamtools.c:26160)
AttributeError: StringIO instance has no attribute 'fileno'
Does anybody have an idea how to fix this?
Best,
Matthias
as you all know, the analysis of next-generation sequencing data can be very time consuming. Therefore, i'd like to integrate parallelization into my python scripts. What i use is the python-pp package which makes it very convenient to put independent tasks into different processes which can be run in parallel. On the other hand i use the pysam package which gives me the desired functionality to access, and manipulate sequencing data. Unfortunately, it turned out that python-pp and pysam are not the best friends, and thus trouble was bound to occur.
A small example what can go wrong:
If you want to sort a set bam files within a python script in parallel, the following code should be sufficient:
Code:
import pp
import pysam
def sortBam(bam_filepath, out_prefix):
pysam.sort(bam_filepath, out_prefix)
job_server = pp.Server(ncpus=2, ppservers = (), secret='secret')
job1 = job_server.submit(sortBam, ('<in1.bam>', '<out_prefix1>'), modules=('pysam',))
job2 = job_server.submit(sortBam, ('<in2.bam>', '<out_prefix2>'), modules=('pysam',))
result1 = job1()
result1 = job2()
An error has occured during the function execution
Traceback (most recent call last):
File "/home/mbieg/.local/lib/python2.6/site-packages/ppworker.py", line 90, in run
__result = __f(*__args)
File "<string>", line 2, in sortBam
File "/home/mbieg/project/tools/python_packages/lib/python2.6/site-packages/pysam-0.6-py2.6-linux-x86_64.egg/pysam/__init__.py", line 50, in __call__
retval, stderr, stdout = csamtools._samtools_dispatch( self.dispatch, args )
File "csamtools.pyx", line 2860, in csamtools._samtools_dispatch (pysam/csamtools.c:26160)
AttributeError: StringIO instance has no attribute 'fileno'
Does anybody have an idea how to fix this?
Best,
Matthias
Comment