Get Started Wizard
Opened this issue · 4 comments
- Should we limit the number of query genes (e.g. 20)?
- What about the the number of gene cards?
By the way, Pathway Commons has an API endpoint for gene info--including a nice description and useful link outs--which is used by the PC web app to show the gene info when clicking a node:
If you use an app such as Postman to send a POST
to https://apps.pathwaycommons.org/api/search/genes
with {"query":"TP53"}
as the request body, it returns this json:
[
{
"query": "TP53",
"geneSymbol": "TP53",
"summary": {
"namespace": "ncbigene",
"displayName": "tumor protein p53",
"localId": "7157",
"description": "This gene encodes a tumor suppressor protein containing transcriptional activation, DNA binding, and oligomerization domains. The encoded protein responds to diverse cellular stresses to regulate expression of target genes, thereby inducing cell cycle arrest, apoptosis, senescence, DNA repair, or changes in metabolism. Mutations in this gene are associated with a variety of human cancers, including hereditary cancers such as Li-Fraumeni syndrome. Alternative splicing of this gene and the use of alternate promoters result in multiple transcript variants and isoforms. Additional isoforms have also been shown to result from the use of alternate translation initiation codons from identical transcript variants (PMIDs: 12032546, 20937277). [provided by RefSeq, Dec 2016]",
"aliases": [
"cellular tumor antigen p53",
"antigen NY-CO-13",
"mutant tumor protein 53",
"phosphoprotein p53",
"transformation-related protein 53",
"tumor protein 53",
"tumor supressor p53"
],
"aliasIds": [
"BCC7",
"BMFS5",
"LFS1",
"P53",
"TRP53"
],
"xrefLinks": [
{
"namespace": "hgnc.symbol",
"uri": "http://bioregistry.io/hgnc.symbol:TP53"
},
{
"namespace": "genecards",
"uri": "http://bioregistry.io/genecards:TP53"
},
{
"namespace": "ncbigene",
"uri": "http://bioregistry.io/ncbigene:7157"
},
{
"uri": "http://bioregistry.io/uniprot:P04637.300",
"namespace": "uniprot"
}
]
}
}
]
However, when I tried to fetch it from the Cytoscape Home UI, I got this error:
Access to fetch at 'https://apps.pathwaycommons.org/api/search/genes' from origin
'http://localhost:5173' has been blocked by CORS policy: Response to preflight request
doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present
on the requested resource.
If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch
the resource with CORS disabled.
Setting mode to 'no-cors', as suggested, did not work--it just returns this error:
https://apps.pathwaycommons.org/api/search/genes 500 (Internal Server Error)
This is the JS code:
const response = await fetch('https://apps.pathwaycommons.org/api/search/genes', {
method: 'POST',
mode: 'no-cors',
body: JSON.stringify({
query: 'TP53',
}),
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
},
});
Anyway, It would be nice to use this endpoint for the gene cards, but because the fetch is done by the client side, the browser is blocking this cross-domain request.
I guess we only have 2 options here:
- Add a server (e.g. Express) to our project, so it can be used as a proxy to avoid the browser's preflight request and the consequent CORS issue.
- Change the Pathway Commons server to allow requests by our app's domain, though I'm not sure what we need to configure for it to accept requests from our development ('localhost') instances as well.