Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch pymummer recipe #35379

Merged
merged 1 commit into from
Jun 15, 2022
Merged

patch pymummer recipe #35379

merged 1 commit into from
Jun 15, 2022

Conversation

rpetit3
Copy link
Member

@rpetit3 rpetit3 commented Jun 15, 2022

pymummer makes use of tempfile.mkdtemp() but specifies where the temp directory is made. Which does not play well with containers:

Traceback (most recent call last):
  File "/usr/local/bin/seroba", line 88, in <module>
    args.func(args)
  File "/usr/local/lib/python3.8/site-packages/seroba/tasks/sero_run.py", line 19, in run
    sero.run()
  File "/usr/local/lib/python3.8/site-packages/seroba/serotyping.py", line 481, in run
    self._prediction(assemblie_file,cluster)
  File "/usr/local/lib/python3.8/site-packages/seroba/serotyping.py", line 452, in _prediction
    self.sero, self.imp = Serotyping._find_serotype(assemblie_file,serogroup_fasta,self.meta_data_dict[serogroup],\
  File "/usr/local/lib/python3.8/site-packages/seroba/serotyping.py", line 261, in _find_serotype
    pymummer.nucmer.Runner(
  File "/usr/local/lib/python3.8/site-packages/pymummer/nucmer.py", line 139, in run
    tmpdir = tempfile.mkdtemp(prefix='tmp.run_nucmer.', dir=os.getcwd())
  File "/usr/local/lib/python3.8/tempfile.py", line 358, in mkdtemp
    _os.mkdir(file, 0o700)
PermissionError: [Errno 13] Permission denied: '/tmp.run_nucmer.727hfrey'

This PR allows tempfile to figure out where to make the temp dir (see https://docs.python.org/3/library/tempfile.html#tempfile.gettempdir)

Python searches a standard list of directories to find one which the calling user can create files in. The list is:

The directory named by the TMPDIR environment variable.
The directory named by the TEMP environment variable.
The directory named by the TMP environment variable.
A platform-specific location:
    - On Windows, the directories C:\TEMP, C:\TMP, \TEMP, and \TMP, in that order
    - On all other platforms, the directories /tmp, /var/tmp, and /usr/tmp, in that order.

As a last resort, the current working directory.

An upstream pull request has been submitted to pymummer (sanger-pathogens/pymummer#36), but a timeline of review is not available

This is also related to #35378


Please read the guidelines for Bioconda recipes before opening a pull request (PR).

  • If this PR adds or updates a recipe, use "Add" or "Update" appropriately as the first word in its title.
  • New recipes not directly relevant to the biological sciences need to be submitted to the conda-forge channel instead of Bioconda.
  • PRs require reviews prior to being merged. Once your PR is passing tests and ready to be merged, please issue the @BiocondaBot please add label command.
  • Please post questions on Gitter or ping @bioconda/core in a comment.
Please use the following BiocondaBot commands:

Everyone has access to the following BiocondaBot commands, which can be given in a comment:

@BiocondaBot please update Merge the master branch into a PR.
@BiocondaBot please add label Add the please review & merge label.
@BiocondaBot please fetch artifacts Post links to CI-built packages/containers.
You can use this to test packages locally.

For members of the Bioconda project, the following command is also available:

@BiocondaBot please merge Upload built packages/containers and merge a PR.
Someone must approve a PR first!
This reduces CI build time by reusing built artifacts.

Also, the bot watches for comments from non-members that include @bioconda/<team> and will automatically re-post them to notify the addressed <team>.

@rpetit3
Copy link
Member Author

rpetit3 commented Jun 15, 2022

@BiocondaBot please fetch artifacts

@BiocondaBot
Copy link
Collaborator

Package(s) built on Azure are ready for inspection:

Arch Package Zip File
noarch pymummer-0.11.0-pyhdfd78af_1.tar.bz2 LinuxArtifacts

You may also use conda to install these after downloading and extracting the appropriate zip file. From the LinuxArtifacts or OSXArtifacts directories:

conda install -c packages <package name>

Docker image(s) built (images are in the LinuxArtifacts zip file above):

Package Tag Install with docker
pymummer 0.11.0--pyhdfd78af_1
showgzip -dc LinuxArtifacts/images/pymummer:0.11.0--pyhdfd78af_1.tar.gz | docker load

@rpetit3
Copy link
Member Author

rpetit3 commented Jun 15, 2022

Testing

mamba create -n test-pymummer -c conda-forge -c bioconda 'python>3' 'pyfastaq>=3.10' mummer
conda activate test-pymummer
conda install LinuxArtifacts/packages/noarch/pymummer-0.11.0-pyhdfd78af_1.tar.bz2

# Looks good
grep mkdtemp /home/robert_petit/miniconda3/envs/test-pymummer/lib/python3.10/site-packages/pymummer/nucmer.py
        tmpdir = tempfile.mkdtemp(prefix='tmp.run_nucmer.')
        
# manually edited to print the tmpdir
export TMP=${PWD}/temptest
echo $TMP
/home/robert_petit/temp/test-pymummer/temptest

# test in python
python
>>> import pymummer
>>> test = pymummer.nucmer.Runner('x', 'y', 'z')
>>> test.run()
/home/robert_petit/temp/test-pymummer/temptest/tmp.run_nucmer.9coo3_6g

Much better this is now allowing tempfile to select the temp directory based on the user's environment and/or system

@rpetit3
Copy link
Member Author

rpetit3 commented Jun 15, 2022

@BiocondaBot please add label

@BiocondaBot BiocondaBot added the please review & merge set to ask for merge label Jun 15, 2022
Copy link
Member

@mfansler mfansler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense.

@mfansler
Copy link
Member

@bioconda-bot please merge

@BiocondaBot
Copy link
Collaborator

I will attempt to upload artifacts and merge this PR. This may take some time, please have patience.

@BiocondaBot BiocondaBot merged commit d1a47f9 into master Jun 15, 2022
@BiocondaBot BiocondaBot deleted the rp3-patch-pymummer branch June 15, 2022 06:35
@rpetit3
Copy link
Member Author

rpetit3 commented Jun 15, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
please review & merge set to ask for merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants