File: get_uniprot.py

package info (click to toggle)
fasta3 36.3.8i.14-Nov-2020-3
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 7,016 kB
  • sloc: ansic: 77,269; perl: 10,677; python: 2,461; sh: 428; csh: 86; sql: 55; makefile: 40
file content (21 lines) | stat: -rwxr-xr-x 409 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python3

import sys
import re
import requests

ARGV = sys.argv[1:];

for acc_arg in ARGV :

## check for acc format
  if (re.search(r'\|',acc_arg)):
    acc_info=acc_arg.split('|')  # sp|P09488|GSTM1_HUMAN
    acc = acc_info[1]            # P09488
  else:
    acc = acc_arg

  url = "https://www.uniprot.org/uniprot/" + acc + ".fasta"
#  print url
  fa_req = requests.get(url)
  print(fa_req.text)