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;
}
Aggregations