Skip to content

Commit

Permalink
Merge e2b15e7 into 04042d5
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Halagan committed Apr 17, 2018
2 parents 04042d5 + e2b15e7 commit af49d0c
Show file tree
Hide file tree
Showing 11 changed files with 75 additions and 33 deletions.
46 changes: 22 additions & 24 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
# Config file for automatic testing at travis-ci.org
# This file will be regenerated if you run travis_pypi_setup.py

language: python
python: 3.6

env:
- TOXENV=py36

# command to install dependencies, e.g. pip install -r requirements.txt --use-mirrors
install: pip install -U tox

# command to run tests, e.g. python setup.py test
script: tox -e ${TOXENV}

# After you create the Github repo and add it to Travis, run the
# travis_pypi_setup.py script to finish PyPI deployment setup
# This file was autogenerated and will overwrite each time you run travis_pypi_setup.py
deploy:
provider: pypi
true:
condition: $TOXENV == py36
repo: nmdp-bioinformatics/pyhml
tags: true
distributions: sdist bdist_wheel
user: mhalagan
password:
secure: PLEASE_REPLACE_ME
on:
tags: true
repo: nmdp-bioinformatics/pyhml
condition: $TOXENV == py36
secure: TP8AuokOd8phofVZw6OJaEOTZjmTfDrPmQa2Tq4OCe1Lafqg8JK4bmLk30NiJbB8aV0q9/Kkl1OzrlseOBMLdK3WFB/Fe1vah4gR/KSGGRRAY/2d99p0F7BIr7OJV37ggUub72oBvRGA7CmXKhWNb5nEnSnBvXvYm+KWZqxPy0XWMUI/uv2Vlj3PyqDQwO6rO1phWqhGw6xYTCZOQTZCF5lbTuxzzkaEqJKZh6lg2XOjCVQcE0qqXRfumlebWqG7Rb75jUMg2RT4b7g1T+dcSyCN4IMyttEme67nyjKrbPbGR0Ytt0Tn/Z7Y3bn1o8xcz6YVEnteMtr3MVP5Mcn9eZesfr9VurvNNygGMNumlq+mIbHWinkE1hVIhsdCqKZ2/fnbk5xQUw+e21lV5Zdx449+nJA/eeu3q7O5/FArW/xkTRuTan/NL6LORt+iAMg8casWPGHT3z9vItpYHd4x/ikoGXKuoRFJU/XJraHoH3Q+qef1V7LgoOvX4lotwI7lzpG0w7erXtoOuB9pBgP0GPqPF+BzCz3vcBYbJWhKjVE6l4xaumt8LOLMF7ZvvxsT7YZdvgaJqmJTXi9eUmSJW2fyTPxOjLJAx9VbqxVXlMQusrGLOPQ7/84zqYOSTm1RMQyXMIylTO5rCxCVwIwvHEZB64zITacVl+3n1y0S6uM=
provider: pypi
user: mhalagan
env:
- TOXENV=py36
install: pip install -U tox
before_script:
- pip install -r requirements.txt
- pip install python-coveralls coveralls
language: python
python: 3.6
script:
- tox -e ${TOXENV}
- coverage run -m unittest discover -v tests
- coverage report -m
after_success:
- coveralls
6 changes: 6 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
History
=======

0.0.5 (2017-04-16)
------------------

* Improved documentation
* Fixed issues with parsing HML files with NMDP-CORRECTION

0.0.4 (2017-04-15)
------------------

Expand Down
9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ pyHML
.. image:: https://img.shields.io/pypi/v/pyhml.svg
:target: https://pypi.python.org/pypi/pyhml

.. image:: https://img.shields.io/travis/nmdp-bioinformatics/pyhml.svg
:target: https://travis-ci.org/nmdp-bioinformatics/pyhml
.. image:: https://img.shields.io/travis/nmdp-bioinformatics/pyHML.svg
:target: https://travis-ci.org/nmdp-bioinformatics/pyHML

.. image:: https://coveralls.io/repos/github/nmdp-bioinformatics/pyHML/badge.svg?branch=master
:target: https://coveralls.io/github/nmdp-bioinformatics/pyHML?branch=master

.. image:: https://readthedocs.org/projects/pyhml/badge/?version=latest
:target: https://pyhml.readthedocs.io/en/latest/?badge=latest
Expand Down Expand Up @@ -39,7 +42,7 @@ Features
hml.tobiotype(outdir, dtype='fasta', by='subject')
# Print out the full HML file in IMGT dat file format
hml.tobiotype(outdir, dtype='imgt', by='hml')
hml.tobiotype(outdir, dtype='imgt', by='file')
# Get pandas DF from HML object
pandasdf = hml.toPandas()
Expand Down
5 changes: 3 additions & 2 deletions pyhml/pyhml.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def parse(self, hml_file: str) -> HML:
Parses an HML file into a python object.
>>> hml = hmlparser.parse(hml_file)
>>> hml_df = hml.toPandas()
:param hml_file: A valid HML file
:type: str
Expand Down Expand Up @@ -160,7 +159,7 @@ def parse(self, hml_file: str) -> HML:
type=hap['@type'])
haploids.append(haploid)
gls = [gl.strip() for gl in assignment['hmlns:glstring']
if re.search("\*\d", gl)]
if gl and re.search("\*\d", gl)]
allele_assignment = AlleleAssignment(allele_db=allele_db,
allele_version=db,
date=type_date,
Expand Down Expand Up @@ -299,6 +298,8 @@ def _unzip_clean(self, hmlfile):
"""
gunzip(hmlfile)
hml_unzipped = ".".join(hmlfile.split(".")[0:len(hmlfile.split("."))-1])
cmd = "perl -p -i -e 's/<\?X-NMDP-CORRECTION TRUE\?><\?X-NMDP-NOREPORTS\?>//g' " + hml_unzipped
os.system(cmd)
cmd4 = "perl -p -i -e 's/<\?xml.+\?>//g' " + hml_unzipped
os.system(cmd4)
cmd1 = "perl -p -i -e 's/\?//g' " + hml_unzipped
Expand Down
1 change: 0 additions & 1 deletion pyhml/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ def _deserialize_list(data, boxed_type):
for sub_data in data]



def _deserialize_dict(data, boxed_type):
"""
Deserializes a dict and its elements.
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.0.4
current_version = 0.0.5
commit = True
tag = True

Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
history = history_file.read()

requirements = [
'biopython==1.70',
'biopython==1.71',
'pandas==0.20.3',
'numpy==1.14.2',
'six==1.11.0',
Expand All @@ -50,7 +50,7 @@

setup(
name='pyhml',
version='0.0.4',
version='0.0.5',
description="Python HML parser",
long_description=readme + '\n\n' + history,
author="Mike Halagan",
Expand Down
Binary file modified tests/resources/2609.hml101.xml.gz
Binary file not shown.
Binary file modified tests/resources/3054.hml101.xml.gz
Binary file not shown.
26 changes: 26 additions & 0 deletions tests/test_pyhml.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@
import sys
import unittest

from pyhml.models.sample import Sample
from pyhml.models.typing import Typing
from pyhml.pyhml import HmlParser
from pyhml.models.hml import HML


from Bio import SeqIO
from pandas import DataFrame

Expand Down Expand Up @@ -79,4 +82,27 @@ def test_002_gzip(self):
os.system(cmd_zip)
pass

def test_003_sample(self):
sample = Sample(center_code='000', id='100000',
collection_method='DNA')
self.assertIsInstance(sample, Sample)
self.assertEqual(sample.id, '100000')
self.assertEqual(sample.center_code, '000')
self.assertEqual(sample.collection_method, 'DNA')
pass

def test_004_sampleTyping(self):
sample = Sample(center_code='000', id='100000',
collection_method='DNA')
typing = Typing(date='04-11-2011', gene_family='HLA')
sample.typing = [typing]
self.assertIsInstance(typing, Typing)
self.assertIsInstance(sample, Sample)
self.assertEqual(typing.gene_family, 'HLA')
self.assertIsInstance(sample.typing[0], Typing)
self.assertEqual(sample.id, '100000')
self.assertEqual(sample.center_code, '000')
self.assertEqual(sample.collection_method, 'DNA')
pass


9 changes: 9 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ setenv =

commands = python -m unittest

passenv =
TRAVIS
TRAVIS_BRANCH
TRAVIS_JOB_ID

[travis]
python =
3.6: py36, flake8

; If you want to make tox run the tests with the same versions, create a
; requirements.txt with the pinned versions and uncomment the following lines:
; deps =
Expand Down

0 comments on commit af49d0c

Please sign in to comment.