-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update civic API #4775
Update civic API #4775
Conversation
42dd186
to
993d9cf
Compare
@leexgh Thanks for fixing this! Looks like it's not yet working for copy number data: https://cbioportal.mskcc.org/patient?studyId=ucec_tcga_pub&caseId=TCGA-BK-A0CC |
Looks like we are querying the civic API separately for each gene in the CNA and mutation tables on patient view. Maybe that's why the CNA table is failing? |
hugoSymbols.forEach(hugoSymbol => | ||
promises.push(civicClient.getCivicGenesBatch(hugoSymbol)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not a batch query anymore. We are making a separate API call for each hugo symbol. This may cause a rate limit issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes that's the problem right now. I don't see a way to send "POST" queries that can accept a list of hugo gene symbols. As far as I can see it can only accept single gene or giving the "start civic id" and "end civic id", the response will then include all genes between this range, but we still need to send extra queries to get the civic id, so it's still not ideal.
For results view it only sends one gene, but for copy number alterations on patients view it sends too many requests. I already asked civic team to see if they have a better way to handle it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is solved. Civic team just made a new release yesterday, they can support a list of hugo symbols now in their genes API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
Just added a few minor suggestions.
a871a1c
to
48b8b46
Compare
✅ Deploy Preview for cbioportalfrontend ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few minor suggestions
packages/react-mutation-mapper/src/component/civic/CivicCard.tsx
Outdated
Show resolved
Hide resolved
@leexgh i'd like to suggest that we not use Apollo client for this. It's a rather heavy dependency to bring into the project just for one fetch and brings a lot of unecessary code/complication. We should be able to fetch data from a graphql endpoint using fetch. We just have to find the data format the endpoint expects and generate/serialize it. I'm happy to help with this and it shouldn't take more than an hour i wouldn't think.
|
level: EvidenceLevel; | ||
drugs: string[]; | ||
disease?: string; | ||
export interface EvidenceCountsByType { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lets put Civic in the name since it's particular to Civic, right?
let geneSymbol = mutation.gene.hugoGeneSymbol; | ||
let geneEntry = civicGenes[geneSymbol]; | ||
let proteinChanges = [mutation.proteinChange]; | ||
const geneToProteinChangeSet: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@leexgh just took another look at this code and i think it could use a few unit tests. it doesn't seem like the split protein changes are covered by the current spec, but i could be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add unit tests for this
}, {} as { [geneSymbol: string]: Set<String> }); | ||
|
||
for (const geneSymbol in geneToProteinChangeSet) { | ||
if (geneSymbol in civicGenes) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think you are really just iterating through civicGenes, so no need for the outer for loop.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, all genes in civicGenes should be in mutationSpecs, so we could change it to iterating through civicGenes
const proteinChangeSet = geneToProteinChangeSet[geneSymbol]; | ||
const geneVariants = civicGenes[geneSymbol].variants; | ||
for (const variantName in geneVariants) { | ||
if (proteinChangeSet.has(variantName)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
again, if proteinChangeSet is a subjset of geneVarits, then you could just iterate through proteinChangeSet and make this code clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
proteinChangeSet is not a subset of geneVarits, they both contain some variants that are not in the other set. We can do something like find shared variants from the two sets and iterate from that list, but it doesn't make the logic easier, so maybe we can keep this
bd8f301
to
4a1d818
Compare
Fix: cBioPortal/cbioportal#9521
Civic stops supporting v1 API and switches to v2 graphql API. This PR changes civic rest API to graphql API, other things remain the same.
Now we only need to call one API to get civic gene information and all variants associated with the gene, not need to keep two calls for gene and variant separately.