Comments (1)
In case anyone stumbles across this. You can use the imputation bot to download your results.
A script could look something like this:
### THIS SCRIPT USES THE IMPUTATIONBOT TO SUBMIT OUR IMPUTATION JOB TO THE SERVER AND DOWNLOAD THE RESULTS.
### BEFORE YOU CAN RUN THIS SCRIPT, YOU HAVE TO PROPERLY SET UP THE IMPUTATION BOT, WHICH IS SHOWN HERE:
### https://imputationserver.readthedocs.io/en/latest/workshops/ASHG2020/Session5/
import subprocess
import os
import requests
import json
import time
def listdir_fullpath(d):
return [os.path.join(d, f) for f in os.listdir(d)]
# imputation server url
url = 'https://imputationserver.sph.umich.edu/api/v2'
token = "token"
# There should only be vcf files in that directory.
vcf_dir = "processed_vcfs"
vcfs = listdir_fullpath(vcf_dir)
imputation_bot_exe = "/g/imputationbot/imputationbot"
# add token to header (see Authentication)
headers = {'X-Auth-Token': token}
data = {
'refpanel': 'hrc-r1.1',
'population': 'eur',
"mode": "imputation",
"phasing": "eagle",
"build": "hg19",
"r2Filter": "0.3"
}
# submit new job
# open the files
files = [("files", open(i, "rb")) for i in vcfs]
print("Submitting Job")
r = requests.post(url + "/jobs/submit/minimac4", files=files, data=data, headers=headers)
if r.status_code != 200:
print(r.json()['message'])
raise Exception('POST /jobs/submit/minimac4 {}'.format(r.status_code))
# print message
job_id = (r.json()['id'])
print(f"Job was sucessfully submitted with id: {job_id}")
while True:
# monitor the job status, as soon as it starts running execute the download command.
r = requests.get(f"{url}/jobs/{job_id}", headers=headers).json()["running"]
if r.status_code != 200:
print(r.json()["message"])
print("Continuing")
continue
# r -> True -> job is running
# r -> False -> job is not running yet
if r:
print("Job started running. Downloading it as soon as it finishes")
subprocess.run(f"{imputation_bot_exe} download {job_id}", shell=True)
print(
f"Encrypted zip files are located in {job_id} directory. The password necessary to decrypt the file was sent to the email you registered with")
break
else:
subprocess.run(f"{imputation_bot_exe} jobs", shell=True)
print("Job is still in the queuing.")
time.sleep(45)
from imputationserver.
Related Issues (20)
- Calculating QC Statistics failed. HOT 1
- HLA type results are disappear in Genotype Imputation HLA HOT 3
- How to disable low call rate exclusion?
- construct HLA imputation server
- the uncorrect recognition of prefix when using hg38 build
- show fail logs
- A lot of variants site have no variations
- Internal Server Error
- 400 Error during input parameter parsing
- rsq Filter Choices Justification
- No Variant is TYPED_ONLY
- Original Variant Identifiers Are Destroyed
- Chromosome X imputation problem!
- Imputation on chromosome 6 failed. Imputation was stopped!!!
- Incorrect job log path HOT 3
- Imputation failed due to strand flip errors HOT 1
- How are multiallelic sites handled?
- Higher zip file corruption rates with aes256 option enabled HOT 1
- Imputation vs TOPMED data using API?
- Unable to upload more than 1 file via sftp HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from imputationserver.