Loading .travis.yml +17 −10 Original line number Diff line number Diff line Loading @@ -6,14 +6,12 @@ python: - '3.7' - '3.6' - '3.5' - '3.4' - '2.7' - 'pypy' - 'pypy3' install: - pip wheel -f wheelhouse cython pysam numpy || true - pip install -f wheelhouse cython pysam pyfasta coverage pyvcf numpy || true - pip install -f wheelhouse -e git+https://github.com/biopython/biopython.git#egg=biopython || true - pip install -f wheelhouse cython pysam biopython requests coverage pyfasta pyvcf numpy || true - python setup.py install - if [ ! -f samtools-1.2 ]; then curl -sL https://github.com/samtools/samtools/releases/download/1.2/samtools-1.2.tar.bz2 | tar -xjv; fi - cd samtools-1.2 Loading @@ -26,8 +24,7 @@ install: - export PATH=$PATH:$PWD - cd .. before_script: - if [ $(python --version) -gt 2.6 ]; then env pip install biopython; fi - env python tests/data/download_gene_fasta.py - python tests/data/download_gene_fasta.py script: nosetests --with-coverage --cover-package=pyfaidx deploy: provider: pypi Loading @@ -36,14 +33,24 @@ deploy: secure: MbSaeuitkVTZqxa0PJ3RcR1aMf+B/sMbcx2sWOo9xfLlRFDFpYWJZ0EfXWEhrVu2YWXpBsasgunTDWSi0jNcZMH92MzOC+UTVYr45LO5sy6hm4iSiAgm/DPgYWdjP0SFKr7eL/HWPS+gHvgkXL1upleX21O358bxaezoasuKFvs= on: all_branches: true python: 3.6 python: 3.7 tags: true repo: mdshw5/pyfaidx matrix: include: - os: windows language: sh python: "3.7" before_install: - choco install python3 - export PATH="/c/Python37:/c/Python37/Scripts:$PATH" - python -m virtualenv $HOME/venv - source $HOME/venv/Scripts/activate allow_failures: - python: 'nightly' - python: 'pypy3' - python: 'pypy' - python: nightly - python: pypy3 - python: pypy - os: windows fast_finish: true cache: directories: Loading @@ -53,4 +60,4 @@ cache: - wheelhouse after_success: - bash <(curl -s https://codecov.io/bash) - if [ $TRAVIS_PYTHON_VERSION == '3.4' ] && [ $TRAVIS_TAG ]; then python scripts/benchmark.py 1000; fi appveyor.ymldeleted 100644 → 0 +0 −31 Original line number Diff line number Diff line environment: matrix: # For Python versions available on Appveyor, see # http://www.appveyor.com/docs/installed-software#python - PYTHON: "C:\\Python27" - PYTHON: "C:\\Python33" - PYTHON: "C:\\Python34" - PYTHON: "C:\\Python35" - PYTHON: "C:\\Python27-x64" - PYTHON: "C:\\Python33-x64" DISTUTILS_USE_SDK: "1" - PYTHON: "C:\\Python34-x64" DISTUTILS_USE_SDK: "1" - PYTHON: "C:\\Python35-x64" install: # Fix for problem building extensions for x64 under Python 3.3 and 3.4 # See: http://help.appveyor.com/discussions/problems/4278-cant-build-some-c-extensions-with-python-34-x64 # Used same solution as Matplotlib: https://github.com/matplotlib/matplotlib/blob/master/appveyor.yml - cmd: copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" # We need wheel installed to build wheels - "%PYTHON%\\python.exe -m pip install -r dev-requirements.txt" build: off test_script: - "%PYTHON%\\python.exe setup.py nosetests" ci/appveyor/vcvars64.batdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64 pyfaidx/__init__.py +12 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ if sys.version_info > (3, ): dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)') __version__ = '0.5.7' __version__ = '0.5.8' class KeyFunctionError(ValueError): Loading Loading @@ -198,6 +198,13 @@ class Sequence(object): """ return len(self.seq) def __eq__(self, other): """ >>> Sequence('chr1', 'ACT') == 'ACT' True """ return str(self) == str(other) @property def fancy_name(self): """ Return the fancy name for the sequence, including start, end, and complementation. Loading Loading @@ -1021,6 +1028,10 @@ class Fasta(object): for rname in self.keys(): yield self[rname] def __len__(self): """Return the cumulative length of all FastaRecords in self.records.""" return sum(len(record) for record in self) def get_seq(self, name, start, end, rc=False): """Return a sequence by record name and interval [start, end). Loading tests/data/download_gene_fasta.py +17 −16 Original line number Diff line number Diff line Loading @@ -34,15 +34,13 @@ def fetch_genes(filename, suffix=None): lower.write(line) def fetch_chr22(filename): from subprocess import Popen, PIPE import requests import gzip grch36 = 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz' curl = Popen(['curl', '-s', grch36], stdout=PIPE) gz = Popen(['gzip', '-dcq'], stdin=curl.stdout, stdout=PIPE) with gz.stdout as remote: with open(filename, 'w') as fasta: with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz') as compressed: with open(filename, 'w') as fasta, gzip.GzipFile(fileobj=compressed.raw) as gz: chr22 = False for line in remote: for line in gz: if line[0:3] == '>22': fasta.write(line) chr22 = True Loading @@ -66,17 +64,20 @@ def fake_chr22(filename): fake_file.write('N' * mod_70 + '\n') def bgzip_compress_fasta(filename): from subprocess import call call(' '.join(['bgzip', '-c', filename, '>', filename + '.gz']), shell=True) from Bio.bgzf import BgzfWriter with BgzfWriter(filename=filename + '.gz') as compressed, open(filename, 'r') as fasta: for line in fasta: compressed.write(line) def fetch_chr22_vcf(filename): from subprocess import call call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz', '-o', filename]) call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi', '-o', filename + '.tbi']) import requests with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz') as vcf: with open(filename, 'wb') as out: out.write(vcf.content) with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi') as tbi: with open(filename + '.tbi', 'wb') as out: out.write(tbi.content) if __name__ == "__main__": Loading Loading
.travis.yml +17 −10 Original line number Diff line number Diff line Loading @@ -6,14 +6,12 @@ python: - '3.7' - '3.6' - '3.5' - '3.4' - '2.7' - 'pypy' - 'pypy3' install: - pip wheel -f wheelhouse cython pysam numpy || true - pip install -f wheelhouse cython pysam pyfasta coverage pyvcf numpy || true - pip install -f wheelhouse -e git+https://github.com/biopython/biopython.git#egg=biopython || true - pip install -f wheelhouse cython pysam biopython requests coverage pyfasta pyvcf numpy || true - python setup.py install - if [ ! -f samtools-1.2 ]; then curl -sL https://github.com/samtools/samtools/releases/download/1.2/samtools-1.2.tar.bz2 | tar -xjv; fi - cd samtools-1.2 Loading @@ -26,8 +24,7 @@ install: - export PATH=$PATH:$PWD - cd .. before_script: - if [ $(python --version) -gt 2.6 ]; then env pip install biopython; fi - env python tests/data/download_gene_fasta.py - python tests/data/download_gene_fasta.py script: nosetests --with-coverage --cover-package=pyfaidx deploy: provider: pypi Loading @@ -36,14 +33,24 @@ deploy: secure: MbSaeuitkVTZqxa0PJ3RcR1aMf+B/sMbcx2sWOo9xfLlRFDFpYWJZ0EfXWEhrVu2YWXpBsasgunTDWSi0jNcZMH92MzOC+UTVYr45LO5sy6hm4iSiAgm/DPgYWdjP0SFKr7eL/HWPS+gHvgkXL1upleX21O358bxaezoasuKFvs= on: all_branches: true python: 3.6 python: 3.7 tags: true repo: mdshw5/pyfaidx matrix: include: - os: windows language: sh python: "3.7" before_install: - choco install python3 - export PATH="/c/Python37:/c/Python37/Scripts:$PATH" - python -m virtualenv $HOME/venv - source $HOME/venv/Scripts/activate allow_failures: - python: 'nightly' - python: 'pypy3' - python: 'pypy' - python: nightly - python: pypy3 - python: pypy - os: windows fast_finish: true cache: directories: Loading @@ -53,4 +60,4 @@ cache: - wheelhouse after_success: - bash <(curl -s https://codecov.io/bash) - if [ $TRAVIS_PYTHON_VERSION == '3.4' ] && [ $TRAVIS_TAG ]; then python scripts/benchmark.py 1000; fi
appveyor.ymldeleted 100644 → 0 +0 −31 Original line number Diff line number Diff line environment: matrix: # For Python versions available on Appveyor, see # http://www.appveyor.com/docs/installed-software#python - PYTHON: "C:\\Python27" - PYTHON: "C:\\Python33" - PYTHON: "C:\\Python34" - PYTHON: "C:\\Python35" - PYTHON: "C:\\Python27-x64" - PYTHON: "C:\\Python33-x64" DISTUTILS_USE_SDK: "1" - PYTHON: "C:\\Python34-x64" DISTUTILS_USE_SDK: "1" - PYTHON: "C:\\Python35-x64" install: # Fix for problem building extensions for x64 under Python 3.3 and 3.4 # See: http://help.appveyor.com/discussions/problems/4278-cant-build-some-c-extensions-with-python-34-x64 # Used same solution as Matplotlib: https://github.com/matplotlib/matplotlib/blob/master/appveyor.yml - cmd: copy ci\appveyor\vcvars64.bat "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64" # We need wheel installed to build wheels - "%PYTHON%\\python.exe -m pip install -r dev-requirements.txt" build: off test_script: - "%PYTHON%\\python.exe setup.py nosetests"
ci/appveyor/vcvars64.batdeleted 100644 → 0 +0 −1 Original line number Diff line number Diff line CALL "C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.cmd" /x64
pyfaidx/__init__.py +12 −1 Original line number Diff line number Diff line Loading @@ -25,7 +25,7 @@ if sys.version_info > (3, ): dna_bases = re.compile(r'([ACTGNactgnYRWSKMDVHBXyrwskmdvhbx]+)') __version__ = '0.5.7' __version__ = '0.5.8' class KeyFunctionError(ValueError): Loading Loading @@ -198,6 +198,13 @@ class Sequence(object): """ return len(self.seq) def __eq__(self, other): """ >>> Sequence('chr1', 'ACT') == 'ACT' True """ return str(self) == str(other) @property def fancy_name(self): """ Return the fancy name for the sequence, including start, end, and complementation. Loading Loading @@ -1021,6 +1028,10 @@ class Fasta(object): for rname in self.keys(): yield self[rname] def __len__(self): """Return the cumulative length of all FastaRecords in self.records.""" return sum(len(record) for record in self) def get_seq(self, name, start, end, rc=False): """Return a sequence by record name and interval [start, end). Loading
tests/data/download_gene_fasta.py +17 −16 Original line number Diff line number Diff line Loading @@ -34,15 +34,13 @@ def fetch_genes(filename, suffix=None): lower.write(line) def fetch_chr22(filename): from subprocess import Popen, PIPE import requests import gzip grch36 = 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz' curl = Popen(['curl', '-s', grch36], stdout=PIPE) gz = Popen(['gzip', '-dcq'], stdin=curl.stdout, stdout=PIPE) with gz.stdout as remote: with open(filename, 'w') as fasta: with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/technical/reference/human_b36_male.fa.gz') as compressed: with open(filename, 'w') as fasta, gzip.GzipFile(fileobj=compressed.raw) as gz: chr22 = False for line in remote: for line in gz: if line[0:3] == '>22': fasta.write(line) chr22 = True Loading @@ -66,17 +64,20 @@ def fake_chr22(filename): fake_file.write('N' * mod_70 + '\n') def bgzip_compress_fasta(filename): from subprocess import call call(' '.join(['bgzip', '-c', filename, '>', filename + '.gz']), shell=True) from Bio.bgzf import BgzfWriter with BgzfWriter(filename=filename + '.gz') as compressed, open(filename, 'r') as fasta: for line in fasta: compressed.write(line) def fetch_chr22_vcf(filename): from subprocess import call call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz', '-o', filename]) call(['curl', '-s', 'ftp://ftp-trace.ncbi.nih.gov//1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi', '-o', filename + '.tbi']) import requests with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz') as vcf: with open(filename, 'wb') as out: out.write(vcf.content) with requests.get('https://ftp-trace.ncbi.nih.gov/1000genomes/ftp/pilot_data/release/2010_07/exon/snps/CEU.exon.2010_03.genotypes.vcf.gz.tbi') as tbi: with open(filename + '.tbi', 'wb') as out: out.write(tbi.content) if __name__ == "__main__": Loading