Skip to content

Commit

Permalink
Merge pull request #9914 from jagnathan/fix-9461-mutations-api-endpoi…
Browse files Browse the repository at this point in the history
…nt-final

Fix 9461 mutations api endpoint final
  • Loading branch information
dippindots authored Mar 14, 2023
2 parents d9d1029 + 9ca0563 commit ec2236f
Show file tree
Hide file tree
Showing 22 changed files with 278 additions and 666 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Set;
Expand Down Expand Up @@ -116,7 +115,7 @@ private static Set<CosmicMutationFrequency> filterTruncatingCosmicByPosition(

Set<CosmicMutationFrequency> ret = new HashSet<CosmicMutationFrequency>();
Pattern p = Pattern.compile("[0-9]+");
int mutPos = mut.getOncotatorProteinPosStart();
int mutPos = mut.getProteinPosStart();
for (CosmicMutationFrequency cmf : cmfs) {
String aa = cmf.getAminoAcidChange();
Matcher m = p.matcher(aa);
Expand Down
40 changes: 13 additions & 27 deletions core/src/main/java/org/mskcc/cbio/portal/dao/DaoMutation.java
Original file line number Diff line number Diff line change
Expand Up @@ -145,23 +145,16 @@ public static int addMutationEvent(ExtendedMutation.MutationEvent event) throws
event.getTumorSeqAllele(),
event.getProteinChange(),
event.getMutationType(),
event.getFunctionalImpactScore(),
Float.toString(event.getFisValue()),
event.getLinkXVar(),
event.getLinkPdb(),
event.getLinkMsa(),
event.getNcbiBuild(),
event.getStrand(),
event.getVariantType(),
event.getDbSnpRs(),
event.getDbSnpValStatus(),
event.getOncotatorDbSnpRs(),
event.getOncotatorRefseqMrnaId(),
event.getOncotatorCodonChange(),
event.getOncotatorUniprotName(),
event.getOncotatorUniprotAccession(),
Integer.toString(event.getOncotatorProteinPosStart()),
Integer.toString(event.getOncotatorProteinPosEnd()),
event.getRefseqMrnaId(),
event.getCodonChange(),
event.getUniprotAccession(),
Integer.toString(event.getProteinPosStart()),
Integer.toString(event.getProteinPosEnd()),
boolToStr(event.isCanonicalTranscript()),
keyword==null ? "\\N":(event.getGene().getHugoGeneSymbolAllCaps()+" "+keyword));
return 1;
Expand Down Expand Up @@ -800,24 +793,17 @@ private static ExtendedMutation.MutationEvent extractMutationEvent(ResultSet rs)
event.setEndPosition(rs.getLong("END_POSITION"));
event.setProteinChange(rs.getString("PROTEIN_CHANGE"));
event.setMutationType(rs.getString("MUTATION_TYPE"));
event.setFunctionalImpactScore(rs.getString("FUNCTIONAL_IMPACT_SCORE"));
event.setFisValue(rs.getFloat("FIS_VALUE"));
event.setLinkXVar(rs.getString("LINK_XVAR"));
event.setLinkPdb(rs.getString("LINK_PDB"));
event.setLinkMsa(rs.getString("LINK_MSA"));
event.setNcbiBuild(rs.getString("NCBI_BUILD"));
event.setStrand(rs.getString("STRAND"));
event.setVariantType(rs.getString("VARIANT_TYPE"));
event.setDbSnpRs(rs.getString("DB_SNP_RS"));
event.setDbSnpValStatus(rs.getString("DB_SNP_VAL_STATUS"));
event.setReferenceAllele(rs.getString("REFERENCE_ALLELE"));
event.setOncotatorDbSnpRs(rs.getString("ONCOTATOR_DBSNP_RS"));
event.setOncotatorRefseqMrnaId(rs.getString("ONCOTATOR_REFSEQ_MRNA_ID"));
event.setOncotatorCodonChange(rs.getString("ONCOTATOR_CODON_CHANGE"));
event.setOncotatorUniprotName(rs.getString("ONCOTATOR_UNIPROT_ENTRY_NAME"));
event.setOncotatorUniprotAccession(rs.getString("ONCOTATOR_UNIPROT_ACCESSION"));
event.setOncotatorProteinPosStart(rs.getInt("ONCOTATOR_PROTEIN_POS_START"));
event.setOncotatorProteinPosEnd(rs.getInt("ONCOTATOR_PROTEIN_POS_END"));
event.setRefseqMrnaId(rs.getString("REFSEQ_MRNA_ID"));
event.setCodonChange(rs.getString("CODON_CHANGE"));
event.setUniprotAccession(rs.getString("UNIPROT_ACCESSION"));
event.setProteinPosStart(rs.getInt("PROTEIN_POS_START"));
event.setProteinPosEnd(rs.getInt("PROTEIN_POS_END"));
event.setCanonicalTranscript(rs.getBoolean("CANONICAL_TRANSCRIPT"));
event.setTumorSeqAllele(rs.getString("TUMOR_SEQ_ALLELE"));
event.setKeyword(rs.getString("KEYWORD"));
Expand Down Expand Up @@ -1391,12 +1377,12 @@ public static Collection<Map<String, Object>> countSamplesWithProteinPosStarts(
if (geneIdSet.size() == 0 || internalProfileIds.size() == 0) return new ArrayList<Map<String, Object>>(); //empty IN() clause would be a SQL error below
try {
con = JdbcUtil.getDbConnection(DaoMutation.class);
String sql = "SELECT ONCOTATOR_PROTEIN_POS_START, GENETIC_PROFILE_ID, mutation.ENTREZ_GENE_ID, count(DISTINCT SAMPLE_ID) " +
String sql = "SELECT PROTEIN_POS_START, GENETIC_PROFILE_ID, mutation.ENTREZ_GENE_ID, count(DISTINCT SAMPLE_ID) " +
"FROM mutation INNER JOIN mutation_event ON mutation.MUTATION_EVENT_ID=mutation_event.MUTATION_EVENT_ID " +
"WHERE mutation.ENTREZ_GENE_ID IN (" + StringUtils.join(geneIdSet, ",") + ") " +
"AND GENETIC_PROFILE_ID IN (" + StringUtils.join(internalProfileIds, ",") + ") " +
"AND (mutation.ENTREZ_GENE_ID, ONCOTATOR_PROTEIN_POS_START) IN (" + StringUtils.join(proteinPosStarts, ",") + ") " +
"GROUP BY ONCOTATOR_PROTEIN_POS_START, GENETIC_PROFILE_ID, mutation.ENTREZ_GENE_ID";
"AND (mutation.ENTREZ_GENE_ID, PROTEIN_POS_START) IN (" + StringUtils.join(proteinPosStarts, ",") + ") " +
"GROUP BY PROTEIN_POS_START, GENETIC_PROFILE_ID, mutation.ENTREZ_GENE_ID";
pstmt = con.prepareStatement(sql);
rs = pstmt.executeQuery();
Collection<Map<String, Object>> data = new ArrayList<Map<String, Object>>();
Expand Down
Loading

0 comments on commit ec2236f

Please sign in to comment.