Skip to content

Commit

Permalink
[ci skip] Merge PR 29061
Browse files Browse the repository at this point in the history
Merge PR #29061, commits were: 
 * Update build number
 * Add patch file
 * Fix midas patch as given here snayfach/MIDAS#113
  • Loading branch information
npavlovikj authored Jun 16, 2021
1 parent b49c7b9 commit cd695da
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 40 deletions.
15 changes: 10 additions & 5 deletions recipes/midas/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{% set name = "midas" %}
{% set name = "MIDAS" %}
{% set version = "1.3.2" %}
{% set sha256 = "87621eaa5b51eb81edc87e3e6b86c7efd3e1d64f503c6abca246b1be79120859" %}

package:
name: '{{name}}'
name: '{{name|lower}}'
version: '{{version}}'

source:
url: https://github.com/snayfach/MIDAS/archive/v{{version}}.tar.gz
sha256: '{{sha256}}'
patches:
- midas.patch
# the working patch comes from https://github.com/snayfach/MIDAS/pull/113
- midas.patches

build:
noarch: python
number: 4
number: 5
script: {{ PYTHON }} -m pip install . --ignore-installed --no-deps -vv

requirements:
Expand Down Expand Up @@ -45,6 +46,10 @@ test:
about:
home: https://github.com/snayfach/MIDAS
license: GPL-3.0
license_family: GPL
license_file: LICENSE
summary: An integrated pipeline for estimating strain-level genomic variation from
metagenomic data
license_family: GPL

extra:
notes: MIDAS requires reference database that needs to be additionally downloaded and set, https://github.com/snayfach/MIDAS/blob/master/docs/ref_db.md.
35 changes: 0 additions & 35 deletions recipes/midas/midas.patch

This file was deleted.

76 changes: 76 additions & 0 deletions recipes/midas/midas.patches
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
--- setup.py 2017-11-26 11:00:47.000000000 -0600
+++ setup.py.new 2021-06-16 12:39:18.363149855 -0500
@@ -1,5 +1,5 @@
try:
- from setuptools import setup
+ from setuptools import setup, find_packages
except:
from distutils.core import setup
import os
@@ -12,5 +12,7 @@
author = 'Stephen Nayfach',
author_email='[email protected]',
url='https://github.com/snayfach/MIDAS',
- install_requires = ['biopython >= 1.62', 'numpy >= 1.7.0', 'pysam >= 0.8.1', 'pandas >= 0.17.1']
+ install_requires = ['biopython >= 1.62', 'numpy >= 1.7.0', 'pysam >= 0.8.1', 'pandas >= 0.17.1'],
+ packages = find_packages(),
+ scripts = ['scripts/build_midas_db.py', 'scripts/call_consensus.py', 'scripts/compare_genes.py', 'scripts/merge_midas.py', 'scripts/query_by_compound.py', 'scripts/run_midas.py', 'scripts/snp_diversity.py', 'scripts/strain_tracking.py']
)
--- midas/utility.py 2017-11-26 11:00:47.000000000 -0600
+++ midas/utility.py.new 2021-06-16 12:37:09.019590551 -0500
@@ -5,6 +5,7 @@
# Freely distributed under the GNU General Public License (GPLv3)

import io, os, stat, sys, resource, gzip, platform, bz2, Bio.SeqIO
+from distutils.spawn import find_executable

__version__ = '1.3.0'

@@ -106,23 +107,23 @@
pool.join()
sys.exit("\nKeyboardInterrupt")

+def find_exe(exe, path):
+ """ Finding executable """
+ if find_executable(exe) is None:
+ exe = os.path.join(path, exe)
+ if not os.path.isfile(exe):
+ sys.exit("\nError: File not found: %s\n" % exe)
+ if find_executable(exe) is None:
+ sys.exit("\nError: Executable not found: %s\n" % exe)
+ return exe
+
def add_executables(args):
""" Identify relative file and directory paths """
src_dir = os.path.dirname(os.path.abspath(__file__))
main_dir = os.path.dirname(src_dir)
- args['stream_seqs'] = '/'.join([src_dir, 'run', 'stream_seqs.py'])
- args['hs-blastn'] = '/'.join([main_dir, 'bin', platform.system(), 'hs-blastn'])
- args['bowtie2-build'] = '/'.join([main_dir, 'bin', platform.system(), 'bowtie2-build'])
- args['bowtie2'] = '/'.join([main_dir, 'bin', platform.system(), 'bowtie2'])
- args['samtools'] = '/'.join([main_dir, 'bin', platform.system(), 'samtools'])
-
- for arg in ['hs-blastn', 'stream_seqs', 'bowtie2-build', 'bowtie2', 'samtools']:
- if not os.path.isfile(args[arg]):
- sys.exit("\nError: File not found: %s\n" % args[arg])
-
- for arg in ['hs-blastn', 'bowtie2-build', 'bowtie2', 'samtools']:
- if not os.access(args[arg], os.X_OK):
- sys.exit("\nError: File not executable: %s\n" % args[arg])
+ args['stream_seqs'] = find_exe('stream_seqs.py', os.path.join(src_dir, 'run'))
+ for exe in ['hs-blastn', 'bowtie2-build', 'bowtie2', 'samtools']:
+ args[exe] = find_exe(exe, os.path.join(main_dir, 'bin', platform.system()))

import subprocess as sp

--- midas/run/snps.py 2017-11-26 11:00:47.000000000 -0600
+++ midas/run/snps.py.new 2021-06-16 12:32:36.982415965 -0500
@@ -220,6 +220,8 @@
start = time()
print("\nCounting alleles")
args['log'].write("\nCounting alleles\n")
+ args['log'].close()
+ args.pop('log', None)

# run pileups per species in parallel
argument_list = []

0 comments on commit cd695da

Please sign in to comment.