Search in sources :

Example 1 with Synonym

use of gov.nih.nci.ctd2.dashboard.model.Synonym in project nci-ctd2-dashboard by CBIIT.

the class DashboardDaoImpl method createObservedSubjectInfo.

private List<SubjectItem> createObservedSubjectInfo(Integer observationId) {
    Session session1 = getSession();
    @SuppressWarnings("unchecked") org.hibernate.query.Query<Object[]> query1 = session1.createNativeQuery("SELECT d2.displayName AS role, observed_subject_role.displayText AS description, d1.displayName AS name, subject.id, columnName, stableURL" + " FROM observed_subject join subject on observed_subject.subject_id=subject.id" + " JOIN dashboard_entity d1 ON subject.id=d1.id" + " JOIN observed_subject_role ON observed_subject.observedSubjectRole_id = observed_subject_role.id" + " JOIN subject_role ON observed_subject_role.subjectRole_id=subject_role.id" + " JOIN dashboard_entity AS d2 ON subject_role.id=d2.id" + " where observation_id=" + observationId);
    List<Object[]> subjects = query1.list();
    List<SubjectItem> list = new ArrayList<SubjectItem>();
    for (Object[] obj : subjects) {
        String role = (String) obj[0];
        String description = (String) obj[1];
        String name = (String) obj[2];
        Integer subjectId = (Integer) obj[3];
        String columnName = (String) obj[4];
        String stableURL = (String) obj[5];
        @SuppressWarnings("unchecked") org.hibernate.query.Query<String> query2 = session1.createNativeQuery("SELECT displayName FROM subject_synonym_map " + " JOIN synonym ON subject_synonym_map.synonyms_id=synonym.id " + " JOIN dashboard_entity ON synonym.id = dashboard_entity.id" + " WHERE SubjectImpl_id=" + subjectId);
        List<String> synonyms = query2.list();
        @SuppressWarnings("unchecked") org.hibernate.query.Query<Object[]> query3 = session1.createNativeQuery("SELECT databaseId, databaseName FROM subject_xref_map" + " JOIN xref ON subject_xref_map.xrefs_id=xref.id " + " WHERE SubjectImpl_id=" + subjectId);
        List<Object[]> xrefs = query3.list();
        List<XRefItem> xrefItems = new ArrayList<XRefItem>();
        for (Object[] x : xrefs) {
            xrefItems.add(new XRefItem((String) x[1], (String) x[0]));
        }
        SubjectItem subjectItem = new SubjectItem(stableURL, role, description, name, synonyms.toArray(new String[0]), xrefItems.toArray(new XRefItem[0]), columnName);
        list.add(subjectItem);
    }
    session1.close();
    return list;
}
Also used : ArrayList(java.util.ArrayList) XRefItem(gov.nih.nci.ctd2.dashboard.api.XRefItem) SubjectItem(gov.nih.nci.ctd2.dashboard.api.SubjectItem) BigInteger(java.math.BigInteger) FullTextSession(org.hibernate.search.FullTextSession) Session(org.hibernate.Session)

Example 2 with Synonym

use of gov.nih.nci.ctd2.dashboard.model.Synonym in project nci-ctd2-dashboard by CBIIT.

the class TissueSampleSynonymsDataFieldSetMapper method mapFieldSet.

public TissueSample mapFieldSet(FieldSet fieldSet) throws BindException {
    String nciThesaurusCode = fieldSet.readString(NCI_THESAURUS_CODE);
    TissueSample tissueSample = tissueSampleMap.get(nciThesaurusCode);
    if (tissueSample != null) {
        Synonym synonym = dashboardFactory.create(Synonym.class);
        synonym.setDisplayName(fieldSet.readString(SYNONYM));
        tissueSample.getSynonyms().add(synonym);
    }
    return tissueSample;
}
Also used : TissueSample(gov.nih.nci.ctd2.dashboard.model.TissueSample) Synonym(gov.nih.nci.ctd2.dashboard.model.Synonym)

Example 3 with Synonym

use of gov.nih.nci.ctd2.dashboard.model.Synonym in project nci-ctd2-dashboard by CBIIT.

the class GeneDataFieldSetMapper method mapFieldSet.

public Gene mapFieldSet(FieldSet fieldSet) throws BindException {
    Gene gene = dashboardFactory.create(Gene.class);
    String entrezGeneId = fieldSet.readString(1);
    gene.setEntrezGeneId(entrezGeneId);
    gene.setDisplayName(fieldSet.readString(2));
    // create synonym back to self
    Synonym synonym = dashboardFactory.create(Synonym.class);
    synonym.setDisplayName(fieldSet.readString(2));
    gene.getSynonyms().add(synonym);
    // create xref back to ncbi
    Xref xref = dashboardFactory.create(Xref.class);
    xref.setDatabaseId(entrezGeneId);
    xref.setDatabaseName(NCBI_GENE_DATABASE);
    gene.getXrefs().add(xref);
    for (String synonymName : fieldSet.readString(4).split("\\|")) {
        synonym = dashboardFactory.create(Synonym.class);
        synonym.setDisplayName(synonymName);
        gene.getSynonyms().add(synonym);
    }
    for (String synonymName : fieldSet.readString(13).split("\\|")) {
        synonym = dashboardFactory.create(Synonym.class);
        synonym.setDisplayName(synonymName);
        gene.getSynonyms().add(synonym);
    }
    // hgnc parsing
    for (String dbXrefs : fieldSet.readString(5).split("\\|")) {
        String[] parts = dbXrefs.split("\\:");
        if (parts[0].equals("HGNC")) {
            gene.setHGNCId(parts[1]);
            break;
        }
    }
    // set organism
    String taxonomyId = fieldSet.readString(0);
    Organism organism = organismMap.get(taxonomyId);
    if (organism == null) {
        List<Organism> organisms = dashboardDao.findOrganismByTaxonomyId(taxonomyId);
        if (organisms.size() == 1)
            organism = organisms.get(0);
        organismMap.put(taxonomyId, organism);
    }
    if (organism != null)
        gene.setOrganism(organism);
    String map_location = fieldSet.readString(7);
    gene.setMapLocation(map_location);
    String description = fieldSet.readString(8);
    gene.setFullName(description);
    String type_of_gene = fieldSet.readString(9);
    GeneType geneType = geneTypeMap.get(type_of_gene);
    if (geneType == null) {
        geneType = dashboardFactory.create(GeneType.class);
        geneType.setDisplayName(type_of_gene);
        geneTypeMap.put(type_of_gene, geneType);
        dashboardDao.save(geneType);
    }
    gene.setGeneType(geneType);
    return gene;
}
Also used : Xref(gov.nih.nci.ctd2.dashboard.model.Xref) Organism(gov.nih.nci.ctd2.dashboard.model.Organism) Gene(gov.nih.nci.ctd2.dashboard.model.Gene) Synonym(gov.nih.nci.ctd2.dashboard.model.Synonym) GeneType(gov.nih.nci.ctd2.dashboard.model.GeneType)

Example 4 with Synonym

use of gov.nih.nci.ctd2.dashboard.model.Synonym in project nci-ctd2-dashboard by CBIIT.

the class CompoundSynonymsFieldSetMapper method mapFieldSet.

public Compound mapFieldSet(FieldSet fieldSet) throws BindException {
    String compoundId = fieldSet.readString(CPD_ID);
    String compoundName = fieldSet.readString(CPD_NAME);
    // find compound by xref (broad)
    Compound compound = compoundMap.get(compoundId);
    if (compound != null) {
        Synonym synonym = dashboardFactory.create(Synonym.class);
        synonym.setDisplayName(compoundName);
        compound.getSynonyms().add(synonym);
    }
    return compound;
}
Also used : Compound(gov.nih.nci.ctd2.dashboard.model.Compound) Synonym(gov.nih.nci.ctd2.dashboard.model.Synonym)

Example 5 with Synonym

use of gov.nih.nci.ctd2.dashboard.model.Synonym in project nci-ctd2-dashboard by CBIIT.

the class siRNADataFieldSetMapper method mapFieldSet.

public ShRna mapFieldSet(FieldSet fieldSet) throws BindException {
    ShRna shRNA = dashboardFactory.create(ShRna.class);
    shRNA.setType("sirna");
    shRNA.setDisplayName(fieldSet.readString(REAGENT_NAME_COL_INDEX));
    shRNA.setReagentName(shRNA.getDisplayName());
    // create synonym back to self
    Synonym synonym = dashboardFactory.create(Synonym.class);
    synonym.setDisplayName(fieldSet.readString(REAGENT_NAME_COL_INDEX));
    shRNA.getSynonyms().add(synonym);
    // set target seq
    shRNA.setTargetSequence(fieldSet.readString(TARGET_SEQ_COL_INDEX));
    // set organism
    if (fieldSet.readString(ORGANISM_COL_INDEX).equals("Homo sapiens")) {
        Organism organism = organismMap.get("9606");
        if (organism == null) {
            List<Organism> organisms = dashboardDao.findOrganismByTaxonomyId("9606");
            if (organisms.size() == 1)
                organism = organisms.get(0);
            organismMap.put("9606", organism);
        }
        if (organism != null)
            shRNA.setOrganism(organism);
    }
    // set transcript
    Transcript transcript = getTranscript(fieldSet.readString(TARGET_GENE_COL_INDEX), fieldSet.readString(TRANSCRIPT_ID_COL_INDEX));
    if (transcript != null)
        shRNA.setTranscript(transcript);
    return shRNA;
}
Also used : Transcript(gov.nih.nci.ctd2.dashboard.model.Transcript) ShRna(gov.nih.nci.ctd2.dashboard.model.ShRna) Organism(gov.nih.nci.ctd2.dashboard.model.Organism) Synonym(gov.nih.nci.ctd2.dashboard.model.Synonym)

Aggregations

Synonym (gov.nih.nci.ctd2.dashboard.model.Synonym)10 Xref (gov.nih.nci.ctd2.dashboard.model.Xref)7 Organism (gov.nih.nci.ctd2.dashboard.model.Organism)5 Compound (gov.nih.nci.ctd2.dashboard.model.Compound)3 ShRna (gov.nih.nci.ctd2.dashboard.model.ShRna)3 Subject (gov.nih.nci.ctd2.dashboard.model.Subject)3 Transcript (gov.nih.nci.ctd2.dashboard.model.Transcript)3 ArrayList (java.util.ArrayList)3 Session (org.hibernate.Session)3 FullTextSession (org.hibernate.search.FullTextSession)3 CellSample (gov.nih.nci.ctd2.dashboard.model.CellSample)2 Gene (gov.nih.nci.ctd2.dashboard.model.Gene)2 ObservedSubject (gov.nih.nci.ctd2.dashboard.model.ObservedSubject)2 Protein (gov.nih.nci.ctd2.dashboard.model.Protein)2 TissueSample (gov.nih.nci.ctd2.dashboard.model.TissueSample)2 HashSet (java.util.HashSet)2 Matcher (java.util.regex.Matcher)2 SubjectItem (gov.nih.nci.ctd2.dashboard.api.SubjectItem)1 XRefItem (gov.nih.nci.ctd2.dashboard.api.XRefItem)1 DashboardDao (gov.nih.nci.ctd2.dashboard.dao.DashboardDao)1