* fetch and transfer genomic sequence features,
* fetch protein product and add as cross-reference
*/
- for (String accId : allIds)
+ for (int i = 0, n = allIds.size(); i < n; i++)
{
- addFeaturesAndProduct(accId, alignment);
+ addFeaturesAndProduct(allIds.get(i), alignment);
}
- for (SequenceI seq : alignment.getSequences())
+ List<SequenceI> seqs = alignment.getSequences();
+ for (int i = 0, n = seqs.size(); i < n; i++)
{
- getCrossReferences(seq);
+ getCrossReferences(seqs.get(i));
}
return alignment;
SequenceI genomicSequence = null;
EnsemblFeatures gffFetcher = new EnsemblFeatures(getDomain());
EnsemblFeatureType[] features = getFeaturesToFetch();
+
+ Platform.timeCheck("ESP.getsequencerec1", Platform.TIME_MARK);
+
+
AlignmentI geneFeatures = gffFetcher.getSequenceRecords(accId,
features);
if (geneFeatures != null && geneFeatures.getHeight() > 0)
{
genomicSequence = geneFeatures.getSequenceAt(0);
}
+
+ Platform.timeCheck("ESP.getsequencerec2", Platform.TIME_MARK);
+
if (genomicSequence != null)
{
/*
* fetch and map protein product, and add it as a cross-reference
* of the retrieved sequence
*/
+ Platform.timeCheck("ESP.transferFeatures", Platform.TIME_MARK);
addProteinProduct(querySeq);
}
}
System.err.println(
"Error transferring Ensembl features: " + e.getMessage());
}
+ Platform.timeCheck("ESP.addfeat done", Platform.TIME_MARK);
}
/**
*/
protected void getCrossReferences(SequenceI seq)
{
+
+ Platform.timeCheck("ESP. getdataseq ", Platform.TIME_MARK);
+
+
while (seq.getDatasetSequence() != null)
{
seq = seq.getDatasetSequence();
}
+
+ Platform.timeCheck("ESP. getxref ", Platform.TIME_MARK);
+
EnsemblXref xrefFetcher = new EnsemblXref(getDomain(), getDbSource(),
getEnsemblDataVersion());
List<DBRefEntry> xrefs = xrefFetcher.getCrossReferences(seq.getName());
for (int i = 0, n = xrefs.size(); i < n; i++)
{
+// Platform.timeCheck("ESP. getxref + " + (i) + "/" + n, Platform.TIME_MARK);
// BH 2019.01.25 this next method was taking 174 ms PER addition for a 266-reference example.
// DBRefUtils.ensurePrimaries(seq)
// was at the end of seq.addDBRef, so executed after ever addition!
// This method was moved to seq.getPrimaryDBRefs()
seq.addDBRef(xrefs.get(i));
}
+
+// System.out.println("primaries are " + seq.getPrimaryDBRefs().toString());
/*
* and add a reference to itself
*/
+
+// Platform.timeCheck("ESP. getxref self ", Platform.TIME_MARK);
+
DBRefEntry self = new DBRefEntry(getDbSource(), getEnsemblDataVersion(),
seq.getName());
+
+// Platform.timeCheck("ESP. getxref self add ", Platform.TIME_MARK);
+
seq.addDBRef(self);
+
+ Platform.timeCheck("ESP. seqprox done ", Platform.TIME_MARK);
+
}
/**
inProgress = false;
throw new JalviewException("ENSEMBL Rest API not available.");
}
+ Platform.timeCheck("EnsemblSeqProx.fetchSeq ", Platform.TIME_MARK);
+
List<SequenceI> seqs = parseSequenceJson(ids);
if (seqs == null)
return alignment;
* for now, assumes only one sequence returned; refactor if needed
* in future to handle a JSONArray with more than one
*/
+
+ Platform.timeCheck("ENS seqproxy", Platform.TIME_MARK);
Map<String, Object> val = (Map<String, Object>) getJSON(null, ids, -1, MODE_MAP, null);
if (val == null)
return null;
System.err.println("Error processing JSON response: " + e.toString());
// ignore
}
+ Platform.timeCheck("ENS seqproxy2", Platform.TIME_MARK);
return result;
}
*/
protected abstract List<SequenceFeature> getIdentifyingFeatures(
SequenceI seq, String accId);
-
+
+ int bhtest = 0;
+
/**
* Transfers the sequence feature to the target sequence, locating its start
* and end range based on the mapping. Features which do not overlap the
if (mappedRange != null)
{
+// Platform.timeCheck(null, Platform.TIME_SET);
String group = sf.getFeatureGroup();
if (".".equals(group))
{
}
int newBegin = Math.min(mappedRange[0], mappedRange[1]);
int newEnd = Math.max(mappedRange[0], mappedRange[1]);
- SequenceFeature copy = new SequenceFeature(sf, newBegin, newEnd,
- group, sf.getScore());
+// Platform.timeCheck(null, Platform.TIME_MARK);
+ bhtest++;
+ // 280 ms/1000 here:
+ SequenceFeature copy = new SequenceFeature(sf, newBegin, newEnd, group, sf.getScore());
+ // 0.175 ms here:
targetSequence.addSequenceFeature(copy);
/*
MapList mapping = getGenomicRangesFromFeatures(sourceSequence,
accessionId, targetSequence.getStart());
if (mapping == null)
- {
+ {
return false;
}
+
+ Platform.timeCheck("ESP. xfer " + sfs.size(), Platform.TIME_MARK);
+
+
boolean result = transferFeatures(sfs, targetSequence, mapping,
accessionId);
// System.out.println("transferFeatures (" + (sfs.size()) + " --> "
SequenceFeatures.sortFeatures(sfs, forwardStrand);
boolean transferred = false;
- for (SequenceFeature sf : sfs)
+
+ for (int i = 0, n = sfs.size(); i < n; i++)
{
+
+ if ((i%1000) == 0) {
+// Platform.timeCheck("Feature " + bhtest, Platform.TIME_GET);
+ Platform.timeCheck("ESP. xferFeature + " + (i) + "/" + n, Platform.TIME_MARK);
+ }
+
+ SequenceFeature sf = sfs.get(i);
if (retainFeature(sf, parentId))
{
transferFeature(sf, targetSequence, mapping, forwardStrand);
transferred = true;
}
}
+
return transferred;
}