Public
Edited
Feb 7, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
uniprot_info = {

var num_response = 100
// get Uniprot Accession Number
///////////////////////////////////
let base_url = 'https://www.ebi.ac.uk/proteins/api/proteins?offset=0&size=' + num_response + '&exact_gene=' + gene + '&organism=' + organism ;
let full_url = base_url // + gene_of_interest + '';
const accession_response_await = await fetch(
full_url, {
method: 'GET',
headers: {
"Accept" : "application/json",
'Content-Type': 'application/json',
}
}
);

var accession_response = await accession_response_await.json()

// console.log(accession_response)

var real_protein = accession_response
// has evidence at protein level
.filter(d => d.proteinExistence === 'Evidence at protein level')
// has a comments section
.filter(d => 'comments' in d)
// has a FUNCTION section in the comments
.filter(d => d.comments.map(c => c.type).includes('FUNCTION'))
// has gene
.filter(d => 'gene' in d)
// matches gene name in first entry (lowercase string)
.filter(d => d.gene[0].name.value.toLowerCase() === gene.toLowerCase())

// console.log('here')
// console.log(real_protein)
var inst_accession = real_protein[0].accession

// get Uniprot Information
///////////////////////////////////
let base_url_info = 'https://rest.uniprot.org/uniprotkb/' + inst_accession + '.json' ;
let full_url_info = base_url_info ;
const info_response_await = await fetch(
full_url_info, {
method: 'GET',
headers: {
"Accept" : "application/json",
'Content-Type': 'application/json',
}
}
);

var info_response = await info_response_await.json()
var full_name = info_response.proteinDescription.recommendedName.fullName.value
var description = info_response.comments[0].texts[0].value
return {
full_name,
description
};
}
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more