BDI-pathogens / phyloscanner

Phylogenetics between and within hosts at once, all along the genome.
GNU General Public License v3.0
44 stars 14 forks source link

Problem with first part of phyloscanner script #25

Closed MarcNiebel closed 6 years ago

MarcNiebel commented 6 years ago

Hi Chris,

After a recent update I think you made in the first part of the script, I am getting an error which was not there previously for making the trees.

My command is:

phyloscanner_make_trees.py P166_P63_test.csv --auto-window-params 250,0 --merge-paired-reads -A AF009606.fasta -2 1|a|AF009606 --no-tree -MTA 1 -MC 2 --time

The error is:

Problem calling mafft. Quitting. Traceback (most recent call last): File "../phyloscanner/phyloscanner_make_trees.py", line 851, in '--preservecase', TempFileForPairwiseUnalignedRefs], stdout=f) File "/usr/lib/python2.7/subprocess.py", line 522, in call return Popen(*popenargs, **kwargs).wait() File "/usr/lib/python2.7/subprocess.py", line 710, in init errread, errwrite) File "/usr/lib/python2.7/subprocess.py", line 1327, in _execute_child raise child_exception OSError: [Errno 2] No such file or directory

Any thoughts would be much appreciated.

Kind Regards,

Marc

ChrisHIV commented 6 years ago

Hi Marc, sorry about that. Some versions of mafft (newer ones perhaps) result in the command 'linsi' being available as well as 'mafft'; I had thought all of them did. Will push a fix. In the mean time you can use the option "--x-mafft2 mafft" to stop phyloscanner trying to use linsi.

MarcNiebel commented 6 years ago

Hi Chris,

Yea that resolved that problem but the next one is:

Error calling "pysam.AlignmentFile". The AlignmentFile attribute was introduced in pysam version 0.8.1; are you using an older version than that? You might be able to update by running pip install pysam --upgrade from the command line. Quitting.

Currently my python 2.7 has pysam 0.14 so am unable to understand what is required.

Kind Regards,

Marc

ChrisHIV commented 6 years ago

Odd. Pull and try again: it won't fix it but should give more information.

ChrisHIV commented 6 years ago

Sorry the last commit contained a silly error, better now.

MarcNiebel commented 6 years ago

This is the error now: Traceback (most recent call last): File "../phyloscanner/phyloscanner_make_trees.py", line 982, in if hasattr(pysam, AlignmentFile): NameError: name 'AlignmentFile' is not defined Marc

ChrisHIV commented 6 years ago

Grr sorry try again.

MarcNiebel commented 6 years ago

After doing a bit of digging, it seems to be looking at an old pysam version (0.6) which explains why there seems to be an error. Now I need to figure out how to direct it to the 0.14 version instead.

ChrisHIV commented 6 years ago

I'm guessing you have at least two installations of python on your machine, each with a different version of pysam. The shebang at the top of phyloscanner_make_trees.py, #!/usr/bin/env python, means that if you run "phyloscanner_make_trees.py" it should use the same python as if you type "python" in your terminal. If you want to use a different version of python, e.g. the one started by /usr/bin/python2.foo, then you can either change the shebang or run the script with "/usr/bin/python2.foo phyloscanner_make_trees.py".

MarcNiebel commented 6 years ago

Actually I have three versions of python but only one version of python 2. This one has two pysam versions. The first is 0.6 and the second is 0.14. Python uses 0.6 which is why the error comes up. I have tried modifying the sys.path but again I am having no luck, even when modifying $PYTHONPATH variable in .bashrc. Will keep trying!

MarcNiebel commented 6 years ago

Resolved it by using a virtual environment :)