Search in sources :

Example 11 with Transcript

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

the class TRCshRNADataFieldSetMapper method getTranscript.

private Transcript getTranscript(String columnEntry) {
    // split individual RefSeq IDs and sort naturally to test more mature RefSeq IDs first
    // natural order sorts leading zeros and things like .2 < .10 properly
    // natural order sorts by length properly, i.e. "NM_02044" < "NM_001001556"
    // natural order not only sorts NM < XM also lower IDs first (lower RefSeq IDs are more mature)
    String[] transcriptIds = columnEntry.split(REFSEQ_DELIMITER);
    Arrays.sort(transcriptIds, new NaturalOrderComparator());
    // strip off RefSeq versions
    for (int i = 0; i < transcriptIds.length; i++) {
        transcriptIds[i] = transcriptIds[i].replaceFirst("\\.\\d+$", "");
    }
    // first look in hashmap
    for (String transcriptId : transcriptIds) {
        if (transcriptMap.containsKey(transcriptId)) {
            return transcriptMap.get(transcriptId);
        }
    }
    // now look in database
    for (String transcriptId : transcriptIds) {
        List<Transcript> transcripts = dashboardDao.findTranscriptsByRefseqId(transcriptId);
        if (transcripts.size() == 1) {
            transcriptMap.put(transcriptId, transcripts.get(0));
            return transcripts.get(0);
        }
    }
    // made it here
    return null;
}
Also used : Transcript(gov.nih.nci.ctd2.dashboard.model.Transcript) NaturalOrderComparator(gov.nih.nci.ctd2.dashboard.util.NaturalOrderComparator)

Aggregations

Transcript (gov.nih.nci.ctd2.dashboard.model.Transcript)9 Organism (gov.nih.nci.ctd2.dashboard.model.Organism)3 Protein (gov.nih.nci.ctd2.dashboard.model.Protein)3 ShRna (gov.nih.nci.ctd2.dashboard.model.ShRna)3 Gene (gov.nih.nci.ctd2.dashboard.model.Gene)2 Synonym (gov.nih.nci.ctd2.dashboard.model.Synonym)2 Xref (gov.nih.nci.ctd2.dashboard.model.Xref)2 NaturalOrderComparator (gov.nih.nci.ctd2.dashboard.util.NaturalOrderComparator)2 StableURL (gov.nih.nci.ctd2.dashboard.util.StableURL)2 DashboardDao (gov.nih.nci.ctd2.dashboard.dao.DashboardDao)1 AnimalModel (gov.nih.nci.ctd2.dashboard.model.AnimalModel)1 Annotation (gov.nih.nci.ctd2.dashboard.model.Annotation)1 CellSample (gov.nih.nci.ctd2.dashboard.model.CellSample)1 Compound (gov.nih.nci.ctd2.dashboard.model.Compound)1 DashboardEntity (gov.nih.nci.ctd2.dashboard.model.DashboardEntity)1 ObservationTemplate (gov.nih.nci.ctd2.dashboard.model.ObservationTemplate)1 Subject (gov.nih.nci.ctd2.dashboard.model.Subject)1 TissueSample (gov.nih.nci.ctd2.dashboard.model.TissueSample)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1