Closed ArtPoon closed 5 years ago
Update setup.py
script for Windows and macOS MAFFT binaries.
@kwade4 has MAFFT wrapper script, need to push to repo.
setup.py
and mafft.py
(the MAFFT wrapper script) work for me on Linux , Windows, and macOS.
Testing mafft.py
using a temp file resulted in a CalledProcessError
because the temp file could not be opened.
Setting shell=True
in line 41, appears to fix this.
We should avoid using shell=True
. Can you please post the error?
This is my error:
Cannot open ~/PycharmProjects/Poplars/poplars/siv-test.fasta.
subprocess.CalledProcessError: Command '['/home/kwade4/PycharmProjects/Poplars/poplars/bin/mafft-linux64/mafft.bat', '--quiet', '~/PycharmProjects/Poplars/poplars/siv-test.fasta']' returned non-zero exit status 1.
Running all-in-one MAFFT (from poplars/bin
) in the terminal using full absolute paths works.
What happens if you manually run that Command from the command line?
Could there be a file permissions problem?
The Command works in the command line. I set read and write access for the test files, but it doesn't seem to work when I use a temp file.
What do you mean by temp file? Can you elaborate? Is it a file stored at /tmp
?
Yes, I am sorry for being unclear.
In sequence_locator.py
, I create a temporary file (stored at /tmp
using the tempfile
module) that contains a query sequence and a reference sequence, and that the path to that file is passed to run_mafft
in mafft.py
.
I realized the error message I posted previously was for a test, where I manually created the query file (in my local repo) and passed it to run_mafft
in mafft.py
.
The same error arises with both cases.
Check that the file created by tempfile
still exists by the time you call the subprocess - the file gets destroyed as soon as the associated file stream is closed.
I figured it out (e07127c )- the mafft.py
was correct after all (with the exception of a typo)
Adding a os.path.abspath
call, rather than ~
fixed the error with the file in my local repo.
For the temporary file, I realized my problem was a simple indentation error. I had misaligned the run_mafft
function call with the with tempfile.NamedTemporaryFile(...)
block.
Thank you for all of your help!