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

Switch from pyvcf to cyvcf2 for VCF parsing #146

Merged
merged 43 commits into from
Mar 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
5f52581
switch pyvcf to cyvcf2 and create metadata interface
mbhall88 Feb 7, 2022
2c8106b
replace pyvcf metadata interface
mbhall88 Feb 7, 2022
3f36fc3
replace info, format and filter interfaces
mbhall88 Feb 7, 2022
0a24542
update is_record_valid to new interface
mbhall88 Feb 7, 2022
e34559f
change interface for get genotype likelihoods function
mbhall88 Feb 7, 2022
9bac6de
change vcf interface for create variants and calls
mbhall88 Feb 7, 2022
0f720ac
ensure ONT set before genotyper constructed
mbhall88 Feb 8, 2022
406d1c0
Update CHANGELOG.md
mbhall88 Feb 8, 2022
55575b5
simplify record validation
mbhall88 Feb 9, 2022
2737265
add missing numpy dependency
mbhall88 Feb 9, 2022
0c72b64
remove numpy version spec in appveyor
mbhall88 Feb 9, 2022
316773d
add python to test path
mbhall88 Feb 10, 2022
be369a9
tell tox which python
mbhall88 Feb 10, 2022
aef474e
Update .appveyor.yml
mbhall88 Feb 10, 2022
e21d4d3
ensure same python3 is used everywhere
mbhall88 Feb 10, 2022
a6f46f8
run tox through python
mbhall88 Feb 10, 2022
ffab7b3
verbose tox
mbhall88 Feb 10, 2022
4d7c01e
try explicitly install cyvcf2
mbhall88 Feb 10, 2022
91cc0af
add openssl
mbhall88 Feb 11, 2022
a4c4615
try msys from htslib appveyor
mbhall88 Feb 11, 2022
676a43e
use sh instead of bash
mbhall88 Feb 11, 2022
dfb5f75
Update .appveyor.yml
mbhall88 Feb 11, 2022
0d69a68
Update .appveyor.yml
mbhall88 Feb 11, 2022
7152152
Update .appveyor.yml
mbhall88 Feb 11, 2022
d8b0a0d
Update .appveyor.yml
mbhall88 Feb 11, 2022
c0e00df
Update .appveyor.yml
mbhall88 Feb 11, 2022
a2f2b96
Update .appveyor.yml
mbhall88 Feb 11, 2022
6f79a61
try cyvcf2 from source
mbhall88 Feb 11, 2022
4d945e3
Update .appveyor.yml
mbhall88 Feb 11, 2022
5bb4524
Update .appveyor.yml
mbhall88 Feb 14, 2022
9091487
Update .appveyor.yml
mbhall88 Feb 14, 2022
468842d
Update .appveyor.yml
mbhall88 Feb 14, 2022
be4c95c
Update .appveyor.yml
mbhall88 Feb 14, 2022
97bbaf2
Update .appveyor.yml
mbhall88 Feb 15, 2022
70e498d
Update .appveyor.yml
mbhall88 Feb 16, 2022
cc94476
Update .appveyor.yml
mbhall88 Feb 16, 2022
efddda8
Update .appveyor.yml
mbhall88 Feb 16, 2022
8577d21
Update .appveyor.yml
mbhall88 Feb 24, 2022
36298d2
Update .appveyor.yml
mbhall88 Feb 27, 2022
7b4bcb0
Update .appveyor.yml
mbhall88 Feb 28, 2022
06cea22
update appveyor
mbhall88 Mar 4, 2022
facb01a
Update .appveyor.yml
mbhall88 Mar 23, 2022
0d7cd9d
reset appveyor to master
mbhall88 Mar 29, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,4 @@ test-probes.txt
z.test.pncA_T2ATAC.txt

.idea
.mongodb
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Default kmer size (21) made consistent across all subcommands [[#141][141]]
- Nanopore preset `--ont` defaults to an expected error rate of 0.08 and ploidy
'haploid' [[#134][134]]
- VCF interface from pyvcf to cyvcf2 [[#142][142]]

### Fixed
- Improved error messaging when an X amino acid resolves to a mutation already present
Expand Down Expand Up @@ -68,6 +69,7 @@ this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
[134]: https://github.com/Mykrobe-tools/mykrobe/issues/134
[140]: https://github.com/Mykrobe-tools/mykrobe/issues/140
[141]: https://github.com/Mykrobe-tools/mykrobe/issues/141
[142]: https://github.com/Mykrobe-tools/mykrobe/issues/142
[Unreleased]: https://github.com/Mykrobe-tools/mykrobe/compare/v0.10.0...HEAD
[mkdtemp]: https://docs.python.org/3.6/library/tempfile.html#tempfile.mkdtemp

2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
anytree
Biopython
pyvcf
cyvcf2
requests
mongoengine
cython
Expand Down
113 changes: 54 additions & 59 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,25 @@
# -*- encoding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
import logging

import io
import os
import requests
import shutil
import subprocess
import tarfile
import io
import re
from glob import glob
from os.path import basename
from os.path import dirname
from os.path import join
from os.path import splitext

import requests
from setuptools import find_packages
from setuptools import setup
from setuptools.command.install import install as DistutilsInstall


class MyInstall(DistutilsInstall):

def run(self):
self._install_mccortex()

Expand All @@ -37,7 +35,7 @@ def _get_mykrobe_data(self):
extracted_name = "mykrobe-data"
tarball_filename = "mykrobe_data.tar.gz"
request = requests.get(data_tarball_url, allow_redirects=True)
with open(tarball_filename, 'wb') as t:
with open(tarball_filename, "wb") as t:
t.write(request.content)
if os.path.exists(extracted_name):
shutil.rmtree(extracted_name)
Expand All @@ -63,16 +61,26 @@ def _install_mccortex(self):

if not os.path.exists(mccortex_git_dir):
subprocess.call(
["git", "clone", "--recursive", "-b", "geno_kmer_count", "https://github.com/Mykrobe-tools/mccortex", mccortex_git_dir], cwd=dir_of_this_file)
[
"git",
"clone",
"--recursive",
"-b",
"geno_kmer_count",
"https://github.com/Mykrobe-tools/mccortex",
mccortex_git_dir,
],
cwd=dir_of_this_file,
)

mccortex_build_binary = os.path.join(mccortex_git_dir, "bin", "mccortex31")
if not os.path.exists(mccortex_build_binary):
subprocess.call(
["make", "clean"], cwd=mccortex_git_dir)
subprocess.call(
["make"], cwd=mccortex_git_dir)
subprocess.call(["make", "clean"], cwd=mccortex_git_dir)
subprocess.call(["make"], cwd=mccortex_git_dir)

mccortex_install_dir = os.path.join(dir_of_this_file, "src", "mykrobe", "cortex")
mccortex_install_dir = os.path.join(
dir_of_this_file, "src", "mykrobe", "cortex"
)
mccortex_install_binary = os.path.join(mccortex_install_dir, "mccortex31")
assert os.path.exists(mccortex_install_dir)
shutil.copy(mccortex_build_binary, mccortex_install_binary)
Expand All @@ -82,65 +90,52 @@ def _install_mccortex(self):

def read(*names, **kwargs):
return io.open(
join(dirname(__file__), *names),
encoding=kwargs.get('encoding', 'utf8')
join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8")
).read()


setup(
name='mykrobe',
version='0.10.0',
license='MIT',
description='Antibiotic resistance prediction in minutes',
# long_description='%s\n%s' % (
# re.compile('^.. start-badges.*^.. end-badges',
# re.M | re.S).sub('', read('README.md')),
# re.sub(':[a-z]+:`~?(.*?)`', r'``\1``', read('CHANGELOG.rst'))
# ),
author='Phelim Bradley',
author_email='wave@phel.im',
url='https://github.com/Mykrobe-tools/mykrobe',
packages=find_packages('src'),
package_dir={'': 'src'},
py_modules=[splitext(basename(path))[0] for path in glob(
'src/*.py')]+[splitext(basename(path))[0] for path in glob('src/*/*.py')]+[splitext(basename(path))[0] for path in glob('src/*/*/*.py')],
name="mykrobe",
version="0.10.0",
license="MIT",
description="Antibiotic resistance prediction in minutes",
author="Phelim Bradley",
author_email="wave@phel.im",
url="https://github.com/Mykrobe-tools/mykrobe",
packages=find_packages("src"),
package_dir={"": "src"},
py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")]
+ [splitext(basename(path))[0] for path in glob("src/*/*.py")]
+ [splitext(basename(path))[0] for path in glob("src/*/*/*.py")],
include_package_data=True,
package_data={"mykrobe": ["cortex/mccortex31"]},
zip_safe=False,
classifiers=[
'Intended Audience :: Developers',
'Operating System :: Unix',
'Operating System :: POSIX',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
'Topic :: Utilities',
],
keywords=[
# eg: 'keyword1', 'keyword2', 'keyword3',
"Intended Audience :: Developers",
"Operating System :: Unix",
"Operating System :: POSIX",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Programming Language :: Python :: 3.5",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
"Topic :: Utilities",
],
install_requires=[
'anytree',
'Biopython',
"pyvcf",
'mongoengine',
'requests',
# eg: 'aspectlib==1.1.1', 'six>=1.7',
"anytree",
"Biopython",
"cyvcf2",
"mongoengine",
"requests",
"numpy",
],
extras_require={
# eg:
# 'rst': ['docutils>=0.11'],
# ':python_version=="2.6"': ['argparse'],
},
entry_points={
'console_scripts': [
'mykrobe = mykrobe.cli:main',
"console_scripts": [
"mykrobe = mykrobe.cli:main",
]
},
cmdclass={'install': MyInstall}
cmdclass={"install": MyInstall},
)
2 changes: 1 addition & 1 deletion src/mykrobe/_vcf/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from mykrobe._vcf.models import VCF
from mykrobe._vcf.models import VCF, Genotype
Loading