Skip to content

Commit

Permalink
Merge branch 'develop' into enhance-file-parsing
Browse files Browse the repository at this point in the history
# Conflicts:
#	tests/__init__.py
  • Loading branch information
apriha committed Jun 5, 2020
2 parents 39a6a91 + 71a8881 commit 22bbdad
Show file tree
Hide file tree
Showing 8 changed files with 792 additions and 282 deletions.
27 changes: 9 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,35 +9,26 @@ language: python

before_install:
- pip install --upgrade pip setuptools wheel
- pip install pytest-cov codecov awscli
- pip install pytest-cov codecov

install:
- pip install .

script:
# for testing, limit downloads from the resource servers by using cached resources;
# note that the master branch is tested weekly via `cron`, so this ensures all Python
# versions will be periodically integration tested with the resource servers
# for testing, limit downloads from the resource servers to only the selected job for
# PRs and the master branch; note that the master branch is tested weekly via `cron`,
# so this ensures all Python versions will be periodically integration tested with the
# resource servers
- set -e
- NUM_JOBS=4
- SELECTED_JOB=$((10#$(date +%V) % $NUM_JOBS)) # identify a job based on week of the year
- DOWNLOADS_ENABLED=false
- |
if [[ $TRAVIS_PULL_REQUEST != "false" ]]; then
# download resources for all jobs on a pull request
DOWNLOADS_ENABLED=true
if [[ $TRAVIS_PULL_REQUEST != "false" && $SELECTED_JOB == $JOB_ID ]]; then
# download resources for selected job on a pull request
export DOWNLOADS_ENABLED=true
elif [[ $TRAVIS_BRANCH == "master" && $SELECTED_JOB == $JOB_ID ]]; then
# download resources for selected job on master branch
DOWNLOADS_ENABLED=true
fi
- |
if [[ $DOWNLOADS_ENABLED == "false" ]]; then
# use cached resources on Amazon S3
aws s3 cp s3://snps-resources/resources.tar.gz resources.tar.gz
if [[ -f resources.tar.gz ]]; then
tar -xzf resources.tar.gz
rm resources.tar.gz
fi
export DOWNLOADS_ENABLED=true
fi
- pytest --cov=snps tests
- |
Expand Down
29 changes: 2 additions & 27 deletions src/snps/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -520,33 +520,8 @@ def _get_path_assembly_mapping_data(
if not create_dir(self._resources_dir):
return ""

chroms = [
"1",
"2",
"3",
"4",
"5",
"6",
"7",
"8",
"9",
"10",
"11",
"12",
"13",
"14",
"15",
"16",
"17",
"18",
"19",
"20",
"21",
"22",
"X",
"Y",
"MT",
]
chroms = [str(i) for i in range(1, 23)]
chroms.extend(["X", "Y", "MT"])

assembly_mapping_data = source_assembly + "_" + target_assembly
destination = os.path.join(
Expand Down
8 changes: 6 additions & 2 deletions src/snps/snps.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def __init__(

if assign_par_snps:
self._assign_par_snps()
self.sort_snps()
else:
logger.warning("no SNPs loaded...")

Expand Down Expand Up @@ -897,6 +898,9 @@ def remap_snps(self, target_assembly, complement_bases=True):
----------
1. Ensembl, Assembly Map Endpoint,
http://rest.ensembl.org/documentation/info/assembly_map
2. Yates et. al. (doi:10.1093/bioinformatics/btu613),
`<http://europepmc.org/search/?query=DOI:10.1093/bioinformatics/btu613>`_
3. Zerbino et. al. (doi.org/10.1093/nar/gkx1098), https://doi.org/10.1093/nar/gkx1098
"""
chromosomes_remapped = []
chromosomes_not_remapped = []
Expand Down Expand Up @@ -997,8 +1001,8 @@ def _remapper(self, task):
for mapping in mappings["mappings"]:
# skip if mapping is outside of range of SNP positions
if (
mapping["original"]["end"] <= pos_start
or mapping["original"]["start"] >= pos_end
mapping["original"]["end"] < pos_start
or mapping["original"]["start"] > pos_end
):
continue

Expand Down

0 comments on commit 22bbdad

Please sign in to comment.