Skip to content

Instantly share code, notes, and snippets.

@inodb
Created August 27, 2015 22:57
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 inodb/bb89efdf39baa0de9075 to your computer and use it in GitHub Desktop.
Save inodb/bb89efdf39baa0de9075 to your computer and use it in GitHub Desktop.
Get region from ensembl rest and translate one-liner

Ensembl REST API

Get region from ensembl REST and translate in one line

curl 'http://grch37.rest.ensembl.org/sequence/region/human/17:41267755:41267763:-1' -H 'Content-type:text/x-fasta' \
    | python <(echo -e "import sys\nfrom Bio import SeqIO\nprint [r.seq.translate() for r in SeqIO.to_dict(SeqIO.parse(sys.stdin, 'fasta')).values()][0]")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment