From cd695da9f24a4a911c513fa3ae594cf2c093d9a2 Mon Sep 17 00:00:00 2001 From: Natasha Pavlovikj Date: Wed, 16 Jun 2021 14:09:41 -0500 Subject: [PATCH] [ci skip] Merge PR 29061 Merge PR #29061, commits were: * Update build number * Add patch file * Fix midas patch as given here https://github.com/snayfach/MIDAS/pull/113 --- recipes/midas/meta.yaml | 15 +++++--- recipes/midas/midas.patch | 35 ----------------- recipes/midas/midas.patches | 76 +++++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 40 deletions(-) delete mode 100644 recipes/midas/midas.patch create mode 100644 recipes/midas/midas.patches diff --git a/recipes/midas/meta.yaml b/recipes/midas/meta.yaml index 9edb0b3d2f480..fb0310c583c0d 100644 --- a/recipes/midas/meta.yaml +++ b/recipes/midas/meta.yaml @@ -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: @@ -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. diff --git a/recipes/midas/midas.patch b/recipes/midas/midas.patch deleted file mode 100644 index 671b59b54d450..0000000000000 --- a/recipes/midas/midas.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- midas/utility.py 2017-08-06 09:57:04.000000000 +0200 -+++ midas/utility.py 2017-08-06 09:59:55.000000000 +0200 -@@ -111,10 +111,10 @@ - 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']) -+ args['hs-blastn'] = 'hs-blastn' -+ args['bowtie2-build'] = 'bowtie2-build' -+ args['bowtie2'] = 'bowtie2' -+ args['samtools'] = 'samtools' - - for arg in ['hs-blastn', 'stream_seqs', 'bowtie2-build', 'bowtie2', 'samtools']: - if not os.path.isfile(args[arg]): ---- setup.py 2017-08-06 08:49:07.000000000 +0200 -+++ setup.py 2017-08-06 08:58:01.000000000 +0200 -@@ -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='snayfach@gmail.com', - 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'] - ) diff --git a/recipes/midas/midas.patches b/recipes/midas/midas.patches new file mode 100644 index 0000000000000..56ce427a10c3f --- /dev/null +++ b/recipes/midas/midas.patches @@ -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='snayfach@gmail.com', + 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 = []