Skip to content

Instantly share code, notes, and snippets.

@popucui
Last active June 3, 2018 13:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save popucui/4efc365febbc16f38ad7b4a598de3b89 to your computer and use it in GitHub Desktop.
Save popucui/4efc365febbc16f38ad7b4a598de3b89 to your computer and use it in GitHub Desktop.
# variant_demo_simplify.tsv hold basic info of variant, looks like:
# chr1 69511 . A G
# chr1 865694 . C T
# 1. split input tsv file, cause if records are too many, a server error will be returned,
## although offical site stat that up to 50000 VCF rows may be posted one time
# 2. use NCBI variation services API to post all rows which are stored in a file
split -l 10000 /path/to/variant_demo_simplify.tsv
for s in $(echo "xa?"); do
curl -X POST \
--header "Content-Type: text/plain; charset=utf-8" --header "Accept: text/plain; charset=utf-8" \
--data-binary "@${s}" \
"https://api.ncbi.nlm.nih.gov/variation/v0/vcf/file/set_rsids?assembly=GCF_000001405.25" \
> variant_demo_${s}_recalibrated.tsv
done
# Here I'm using hg19, if you are using hg38, you should use another assembly version in API url
# If add "-i" a header will appear in the returned result
# For more info, please refer to offical website at: https://api.ncbi.nlm.nih.gov/variation/v0/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment