Question: Multithreading Python3 + Samtools
1
gravatar for glihm
2.5 years ago by
glihm590
France
glihm590 wrote:

Hi there !

I am working on Ribosome Profiling data, and I want to use Python3 multithreading to speed up my program.

To describe the scope of my question:

I use python scripts that take as input alignment files like:

python3 python_script.py <(samtools view file.bam)

and I take it in charge in the script with the fileinput module (import fileinput). It works like a charm !

So related to this, do you think that it is safe to call 3 python scripts at the same time using the same file.bam (using the samtools view command) ? For instance:

python3 script1.py <(samtools view file.bam) &
python3 script2.py <(samtools view file.bam) &
python3 script3.py <(samtools view file.bam) &

I am not sure: if the samtools view command is called on the file.bam, can I safely read again this file with an other samtools view command ? The output is not a problem, every scripts will write a different file. I gave the example with 3 scripts, but I will certainly use 3 functions.

Any kind of help of suggestion will be highly appreciated.

Wocka

ADD COMMENTlink modified 2.5 years ago by Devon Ryan88k • written 2.5 years ago by glihm590
2
gravatar for Devon Ryan
2.5 years ago by
Devon Ryan88k
Freiburg, Germany
Devon Ryan88k wrote:

You can call samtools (or any other program) any number of times on the same BAM file without issue. You can also use pysam inside of python to open the same files multiple times within the same script without issue.

ADD COMMENTlink written 2.5 years ago by Devon Ryan88k

Thank you to confirm it Devon !

ADD REPLYlink written 2.5 years ago by glihm590
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1177 users visited in the last hour