Skip to content

Commit

Permalink
Merge pull request #1472 from BRCAChallenge/repair_vrids
Browse files Browse the repository at this point in the history
Repair vrids
  • Loading branch information
melissacline authored Nov 9, 2023
2 parents cc010d3 + 9c34f23 commit b99b8f5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
3 changes: 2 additions & 1 deletion pipeline/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ start-local-uta: ## starting local uta docker container
[ `docker ps -f name=$(UTA_CONTAINER) | wc -l` -gt 1 ] || docker run -dit --name $(UTA_CONTAINER) -p $(UTA_PORT):5432 $(UTA_DOCKER_IMAGE)

start-seqrepo-rest-service:
[ `docker ps -f name="seqrepo-rest-service" | wc -l` -gt 1 ] || docker run --name seqrepo-rest-service --detach --rm -p 5000:5000 -v $(SEQ_REPO_DIR):/usr/local/share/seqrepo/ biocommons/seqrepo-rest-service /usr/local/share/seqrepo
[ `docker ps -f name="seqrepo-rest-service" | wc -l` -gt 1 ] || \
utilities/lauch_seqrepo.sh

.ONESHELL:
setup-files: ## setup various directories to run pipeline
Expand Down
11 changes: 11 additions & 0 deletions pipeline/utilities/launch_seqrepo.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env bash

SEQ_REPO_DIR="${1:-/usr/local/share/seqrepo/latest}"

#
# Launch the seqrepo rest API docker container
docker run --name seqrepo-rest-service \
--detach --rm -p 5000:5000 \
-v ${SEQ_REPO_DIR}:/mnt/seqrepo \
biocommons/seqrepo-rest-service \
/mnt/seqrepo
9 changes: 7 additions & 2 deletions pipeline/vr/appendVRIds.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import csv
import socket
import urllib3
import subprocess
import time

from ga4gh.core import sha512t24u, ga4gh_digest, ga4gh_identify, ga4gh_serialize
from ga4gh.vrs import __version__, models, normalize
Expand All @@ -15,7 +17,7 @@
csv.field_size_limit(10000000)

SEQREPO_REST_SERVICE_URL = "http://localhost:5000/seqrepo"
#SEQREPO_REST_SERVICE_URL = "https://services.genomicmedlab.org/seqrepo"

DP = SeqRepoRESTDataProxy(base_url=SEQREPO_REST_SERVICE_URL)
TLR = Translator(data_proxy=DP,
translate_sequence_identifiers=True,
Expand Down Expand Up @@ -88,7 +90,10 @@ def get_vrs_id(hgvs, max_repeats=5):
continue
else:
allele_dict = allele.as_dict()
return(allele_dict['_id'])
if 'id' in allele_dict:
return(allele_dict['id'])
elif '_id' in allele_dict:
return(allele_dict['_id'])
return '-'


Expand Down
14 changes: 4 additions & 10 deletions pipeline/vr/appendvrids.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,7 @@ SEQ_REPO_DIR="${4:-/usr/local/share/seqrepo}"
# ----------------------------------------------------

[ `docker ps -f name="seqrepo-rest-service" | wc -l` -gt 1 ] \
|| docker run \
--name seqrepo-rest-service \
--user=`id -u`:`id -g` \
--detach --rm -p 5000:5000 \
--network=host \
-v ${SEQ_REPO_DIR}:/usr/local/share/seqrepo \
biocommons/seqrepo-rest-service \
seqrepo-rest-service /usr/local/share/seqrepo
|| ../utilities/launch_seqrepo.sh ${SEQ_REPO_DIR}


# ...and wait for it to be available
Expand All @@ -31,5 +24,6 @@ SEQ_REPO_DIR="${4:-/usr/local/share/seqrepo}"
# ----------------------------------------------------
# --- 2. execute append-vr-ids
# ----------------------------------------------------
python3 appendVRIds.py -i ${ARTIFACT_DIR}/${INPUT_FILE} \
-o ${ARTIFACT_DIR}/${OUTPUT_FILE}
PATH=../utilities:${PATH} python3 appendVRIds.py \
-i ${ARTIFACT_DIR}/${INPUT_FILE} \
-o ${ARTIFACT_DIR}/${OUTPUT_FILE}
3 changes: 1 addition & 2 deletions pipeline/workflow/CompileVCFFiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -762,8 +762,7 @@ def run(self):
artifacts_dir_host,
'built_with_priors_clean.tsv',
'built_with_vr_ids.tsv',
self.cfg.vr_docker_image_name,
self.cfg.seq_repo_dir
self.cfg.seq_repo_dir
]

pipeline_utils.run_process(args)
Expand Down

0 comments on commit b99b8f5

Please sign in to comment.