From b3a1578f1b29594527e347534f39ffc4e5b37298 Mon Sep 17 00:00:00 2001 From: hansonr Date: Sat, 26 Jan 2019 10:58:04 -0600 Subject: [PATCH] Platform.timecheck calls removed or commented out. --- src/jalview/datamodel/DBRefEntry.java | 13 ++++++-- src/jalview/datamodel/Sequence.java | 2 +- src/jalview/ext/ensembl/EnsemblGene.java | 21 ------------- src/jalview/ext/ensembl/EnsemblRestClient.java | 9 +++--- src/jalview/ext/ensembl/EnsemblSeqProxy.java | 40 ++---------------------- 5 files changed, 19 insertions(+), 66 deletions(-) diff --git a/src/jalview/datamodel/DBRefEntry.java b/src/jalview/datamodel/DBRefEntry.java index 1993516..8520e5c 100755 --- a/src/jalview/datamodel/DBRefEntry.java +++ b/src/jalview/datamodel/DBRefEntry.java @@ -24,7 +24,6 @@ import jalview.api.DBRefEntryI; import jalview.util.DBRefUtils; import jalview.util.MapList; -import java.util.Arrays; import java.util.List; public class DBRefEntry implements DBRefEntryI @@ -40,7 +39,9 @@ public class DBRefEntry implements DBRefEntryI String source = ""; - String version = "", ucversion; + String version = ""; + + private String ucversion; String accessionId = ""; @@ -386,6 +387,14 @@ public class DBRefEntry implements DBRefEntryI return accessionId != null && accessionId.startsWith(CHROMOSOME + ":"); } + /** + * stores the upper-case canonical name of the source for use in + * Sequence.getPrimaryDBRefs(). + * + * @author Bob Hanson + * + * @return + */ public Object getCanonicalSourceName() { return canonicalSourceName; } diff --git a/src/jalview/datamodel/Sequence.java b/src/jalview/datamodel/Sequence.java index 6e9e1cd..0acf701 100755 --- a/src/jalview/datamodel/Sequence.java +++ b/src/jalview/datamodel/Sequence.java @@ -80,7 +80,7 @@ SequenceI datasetSequence; String vamsasId; - private DBModList dbrefs; // controlled acces + private DBModList dbrefs; // controlled access /** * a flag to let us know that elements have changed in dbrefs diff --git a/src/jalview/ext/ensembl/EnsemblGene.java b/src/jalview/ext/ensembl/EnsemblGene.java index dd2547b..7904df3 100644 --- a/src/jalview/ext/ensembl/EnsemblGene.java +++ b/src/jalview/ext/ensembl/EnsemblGene.java @@ -138,26 +138,16 @@ public class EnsemblGene extends EnsemblSeqProxy - Platform.timeCheck("EG " + query, Platform.TIME_MARK); - /* * convert to a non-duplicated list of gene identifiers */ List geneIds = getGeneIds(query); - - - Platform.timeCheck("EG genIds " + geneIds.size(), Platform.TIME_MARK); - AlignmentI al = null; for (String geneId : geneIds) { /* * fetch the gene sequence(s) with features and xrefs */ - - Platform.timeCheck("EG fetch " + geneId, Platform.TIME_MARK); - - AlignmentI geneAlignment = super.getSequenceRecords(geneId); if (geneAlignment == null) { @@ -168,15 +158,7 @@ public class EnsemblGene extends EnsemblSeqProxy { // ensure id has 'correct' case for the Ensembl identifier geneId = geneAlignment.getSequenceAt(0).getName(); - - - Platform.timeCheck("EG loci " + geneId, Platform.TIME_MARK); - - findGeneLoci(geneAlignment.getSequenceAt(0), geneId); - - Platform.timeCheck("EG transcript " + geneId, Platform.TIME_MARK); - getTranscripts(geneAlignment, geneId); } if (al == null) @@ -188,9 +170,6 @@ public class EnsemblGene extends EnsemblSeqProxy al.append(geneAlignment); } } - - Platform.timeCheck("EG done", Platform.TIME_MARK); - return al; } diff --git a/src/jalview/ext/ensembl/EnsemblRestClient.java b/src/jalview/ext/ensembl/EnsemblRestClient.java index b3113f9..da9d2e5 100644 --- a/src/jalview/ext/ensembl/EnsemblRestClient.java +++ b/src/jalview/ext/ensembl/EnsemblRestClient.java @@ -457,8 +457,9 @@ boolean checkEnsembl() StringBuilder postBody = new StringBuilder(64); postBody.append("{\"ids\":["); first = true; - for (String id : ids) + for (int i = 0, n = ids.size(); i < n; i++) { + String id = ids.get(i); if (!first) { postBody.append(","); @@ -500,17 +501,17 @@ boolean checkEnsembl() if (url == null) url = getUrl(ids); - Platform.timeCheck("EnsembleRestClient.getJSON0 " + url, Platform.TIME_MARK); +// Platform.timeCheck("EnsembleRestClient.getJSON0 " + url, Platform.TIME_MARK); Reader br = null; try { br = (url == null ? null : getHttpResponse(url, ids, msDelay)); - Platform.timeCheck("EnsembleRestClient.getJSON1 parsing... ", Platform.TIME_MARK); +// Platform.timeCheck("EnsembleRestClient.getJSON1 parsing... ", Platform.TIME_MARK); Object ret = (br == null ? null : JSONUtils.parse(br)); - Platform.timeCheck("EnsembleRestClient.getJSON2 ...done ", Platform.TIME_MARK); +// Platform.timeCheck("EnsembleRestClient.getJSON2 ...done ", Platform.TIME_MARK); if (ret != null && mapKey != null) ret = ((Map) ret).get(mapKey); diff --git a/src/jalview/ext/ensembl/EnsemblSeqProxy.java b/src/jalview/ext/ensembl/EnsemblSeqProxy.java index 1d6b354..a558ad2 100644 --- a/src/jalview/ext/ensembl/EnsemblSeqProxy.java +++ b/src/jalview/ext/ensembl/EnsemblSeqProxy.java @@ -208,29 +208,19 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient */ SequenceI genomicSequence = null; EnsemblFeatures gffFetcher = new EnsemblFeatures(getDomain()); - EnsemblFeatureType[] features = getFeaturesToFetch(); - - Platform.timeCheck("ESP.getsequencerec1", Platform.TIME_MARK); - - + EnsemblFeatureType[] features = getFeaturesToFetch(); 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) { /* * transfer features to the query sequence */ SequenceI querySeq = alignment.findName(accId, true); - - Platform.timeCheck("ESP.transferfeat", Platform.TIME_MARK); - if (transferFeatures(accId, genomicSequence, querySeq)) { @@ -238,7 +228,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * fetch and map protein product, and add it as a cross-reference * of the retrieved sequence */ - Platform.timeCheck("ESP.addprotein", Platform.TIME_MARK); addProteinProduct(querySeq); } } @@ -247,7 +236,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient System.err.println( "Error transferring Ensembl features: " + e.getMessage()); } - Platform.timeCheck("ESP.addfeat done", Platform.TIME_MARK); } /** @@ -360,47 +348,28 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient */ 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 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.getName()); seq.addDBRef(self); - - Platform.timeCheck("ESP. seqprox done ", Platform.TIME_MARK); - } /** @@ -421,8 +390,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient inProgress = false; throw new JalviewException("ENSEMBL Rest API not available."); } - Platform.timeCheck("EnsemblSeqProx.fetchSeq ", Platform.TIME_MARK); - List seqs = parseSequenceJson(ids); if (seqs == null) return alignment; @@ -488,8 +455,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient * 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 val = (Map) getJSON(null, ids, -1, MODE_MAP, null); if (val == null) return null; @@ -515,7 +480,6 @@ public abstract class EnsemblSeqProxy extends EnsemblRestClient System.err.println("Error processing JSON response: " + e.toString()); // ignore } - Platform.timeCheck("ENS seqproxy2", Platform.TIME_MARK); return result; } -- 1.7.10.2