Biostar Beta. Not for public use.
Question: how to run freebayes in multi-thread
0
Entering edit mode

Dear all, I would like to run freebayes as a multi-thread application. I followed the script given as an example

freebayes-parallel < fasta_generate_regions.py ref.fa.fai 100000) 36 -f ref.fa aln.bam > out.vcf"

by writing a command:

pathTo/freebayes/scripts/frebayes-parallel <(pathTo/freebayes/scripts/fasta_generate_regions.py pathTo/ref< File >.fa.fai) 36 -f pathTo/< refFile >.fa pathTo/<alnDeduplicated>.bam > < file.vcf >

but I am getting this error:

$   File "pathTo/freebayes/scripts/fasta_generate_regions.py", line 7
    print "usage: ", sys.argv[0], " <fasta file or index file> <region size>"
                  ^
SyntaxError: Missing parentheses in call to 'print'. Did you mean print("usage: ", sys.argv[0], " <fasta file or index file> <region size>")?

Same thing if I use <fasta_generate_regions.py pathTo="" ref<File="">.fa.fai). frebayes-parallel is in the PATH variable but if I don't give the absolute path I get the error command not found

What would be the correct syntax for this feature?

Tx

ADD COMMENTlink 12 months ago marongiu.luigi • 380 • updated 12 months ago RamRS 21k
Entering edit mode
1

Are you running with python 2 or 3?

ADD REPLYlink 12 months ago
Joe
12k
Entering edit mode
0

I think the standard is Python 3.7.0 because this is what comes out if I type python on the terminal

ADD REPLYlink 12 months ago
marongiu.luigi
• 380
Entering edit mode
0

Yep that makes sense. You will need to run that tool with Python2 specifically.

In python3, print commands require parentheses: print("Some string"), whereas in Python2 this wasn't strictly the case.

You can tell this from the error it gives you since it's showing you an ^ pointing (roughly) to where it was expecting to see ()

You may need to take a look at the shebang in the first line of the python script athTo/freebayes/scripts/fasta_generate_regions.py. It probably isn't specifying python2 (which it should really).

ADD REPLYlink 12 months ago
Joe
12k
Entering edit mode
0

I ran: $ ~/src/freebayes/scripts/frebayes-parallel <(python2 ~/src/freebayes/scripts/fasta_generate_regions.py ~/refSeq/fusion/fusion38-10k.fa.fai) 36 -f ~/refSeq/fusion/fusion38-10k.fa ~/servers/chirexpsrv3_a32/LUIGI_HIPO32_nls/rslt/A1/A1-N_F-AlnSrtDed.bam > ~/Downloads/h32/rslt/A1-N_F.vcf ang got: bash: /home/gigiux/src/freebayes/scripts/frebayes-parallel: No such file or directory $ Traceback (most recent call last): File "/home/gigiux/src/freebayes/scripts/fasta_generate_regions.py", line 17, in <module> region_size = int(sys.argv[2]) IndexError: list index out of range

ADD REPLYlink 12 months ago
marongiu.luigi
• 380
Entering edit mode
0

same thing when i changed the shebang to #!/usr/bin/env python2

ADD REPLYlink 12 months ago
marongiu.luigi
• 380
Entering edit mode
0

I would have expected changing the shebang to work, but there may be other elements of the code that also need to change. I'll need to take a closer look. Can you provide a link to the walkthrough you're using, and some example data so we can replicate the issue?

ADD REPLYlink 12 months ago
Joe
12k
Entering edit mode
0

marongiu.luigi are you doing the following?

Note that any of the above examples can be made parallel by using the scripts/freebayes-parallel script. If you find freebayes to be slow, you should probably be running it in parallel using this script to run on a single host, or generating a series of scripts, one per region, and run them on a cluster. Be aware that the freebayes-parallel script contains calls to other programs using relative paths from the scripts subdirectory; the easiest way to ensure a successful run is to invoke the freebayes-parallel script from within the scripts subdirectory.

ADD REPLYlink 12 months ago
genomax
68k
Entering edit mode
0

I thought I did it by launching freebayes-parallel with its absolute path...

ADD REPLYlink 12 months ago
marongiu.luigi
• 380
Entering edit mode
0

I will, but it might take sometimes...

ADD REPLYlink 12 months ago
marongiu.luigi
• 380
4
Entering edit mode
  • As mentioned by jrj.healey fasta_generate_regions.py must be run with python2
  • fasta_generate_regions.py requires two parameters:
    • the reference file or its index file
    • the size of the region

You are missing the size of the region in your command.

The error message you describe in this comment stated out whats wrong:

bash: /home/gigiux/src/freebayes/scripts/frebayes-parallel: No such file or directory

You are missing in e in freebayes-parallel.

(There is already a pull request to make the python scripts work in python2 and 3)

ADD COMMENTlink 12 months ago finswimmer 11k

Login before adding your answer.

Similar Posts
Loading Similar Posts
Powered by the version 2.0