Skip to main content

Getting Uniprot Data from Uniprot Accession ID through Uniprot REST API

Project description

UniProt Database Web Parser Project

TLDR: This parser can be used to parse UniProt accession id and obtain related data from the UniProt web database.

To parse UniProt accession

from uniprotparser.parser import UniprotSequence

protein_id = "seq|P06493|swiss"

acc_id = UniprotSequence(protein_id, parse_acc=True)

#Access ACCID
acc_id.accession

#Access isoform id
acc_id.isoform

To get additional data from UniProt online database

from uniprotparser.parser import UniprotParser
from io import StringIO
#Install pandas first to handle tabulated data
import pandas as pd

protein_accession = "P06493"

parser = UniprotParser([protein_accession])

#To get tabulated data
result = []
for i in parser.parse("tab"):
    tab_data = pd.read_csv(i, sep="\t")
    last_column_name = tab_data.columns[-1]
    tab_data.rename(columns={last_column_name: "query"}, inplace=True)
    result.append(tab_data)
fin = pd.concat(result, ignore_index=True)

#To get fasta sequence
with open("fasta_output.fasta", "wt") as fasta_output:
    for i in parser.parse():
        fasta_output.write(i)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uniprotparser-1.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

uniprotparser-1.0.2-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file uniprotparser-1.0.2.tar.gz.

File metadata

  • Download URL: uniprotparser-1.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.6 Windows/10

File hashes

Hashes for uniprotparser-1.0.2.tar.gz
Algorithm Hash digest
SHA256 3558f64c696b4a332b54e2fe6573b890c3fde5ff2011d0b39ee2c1a995a00a3c
MD5 0f73d685f9499a8a5877ee26a0972ee6
BLAKE2b-256 00b40a24753a0cb212528f12acf188cc9b780d6fa36476f4a62d6dfd8782bd36

See more details on using hashes here.

File details

Details for the file uniprotparser-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: uniprotparser-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.12 CPython/3.9.6 Windows/10

File hashes

Hashes for uniprotparser-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 926305292db75e5cd12c7976a15770e9b48bc87e9df70f0b39e2170d00589adb
MD5 59df9fb5683d7fbde2f03118db50d85f
BLAKE2b-256 36f4ede07bee0b9441c1796dc40d147481a93f6352b89066f56b10795f660c0f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page