X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;fp=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=d8858a928da000aee0c8ceeaccd31d02a581bf04;hb=d043ce47fc710d3eb2629ba926a8a7417bd67d8c;hp=67b44d73b220edbda12416ae7900cc676c6f0303;hpb=49db0dff1da16c3355b43a41498c1fc93ef47e91;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 67b44d7..d8858a9 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -37,6 +37,7 @@ import java.util.regex.Pattern; import jalview.analysis.AlignSeq; import jalview.api.FeatureSettingsModelI; import jalview.bin.Cache; +import jalview.bin.Console; import jalview.datamodel.AlignmentI; import jalview.datamodel.DBRefEntry; import jalview.datamodel.DBRefSource; @@ -305,8 +306,7 @@ public class DBRefFetcher implements Runnable e.printStackTrace(); } - Vector sdataset = new Vector<>( - Arrays.asList(dataset)); + Vector sdataset = new Vector<>(Arrays.asList(dataset)); List warningMessages = new ArrayList<>(); // clear any old feature display settings recorded from past sessions @@ -362,10 +362,10 @@ public class DBRefFetcher implements Runnable AlignmentI retrieved = null; try { - if (Cache.log.isDebugEnabled()) + if (Console.isDebugEnabled()) { - Cache.log.debug("Querying " + dbsource.getDbName() - + " with : '" + queryString.toString() + "'"); + Console.debug("Querying " + dbsource.getDbName() + " with : '" + + queryString.toString() + "'"); } retrieved = dbsource.getSequenceRecords(queryString.toString()); } catch (Exception ex) @@ -378,8 +378,8 @@ public class DBRefFetcher implements Runnable } if (retrieved != null) { - transferReferences(sdataset, dbsource, retrieved, - trimDsSeqs, warningMessages); + transferReferences(sdataset, dbsource, retrieved, trimDsSeqs, + warningMessages); } } else @@ -398,7 +398,7 @@ public class DBRefFetcher implements Runnable { for (int j = 0, n = uprefs.size(); j < n; j++) { - DBRefEntry upref = uprefs.get(j); + DBRefEntry upref = uprefs.get(j); addSeqId(sequence, upref.getAccessionId()); queries.addElement( upref.getAccessionId().toUpperCase(Locale.ROOT)); @@ -406,10 +406,10 @@ public class DBRefFetcher implements Runnable } else { - Pattern possibleIds = Pattern.compile("[A-Za-z0-9_]+"); + Pattern possibleIds = Pattern.compile("[A-Za-z0-9_]+"); // generate queries from sequence ID string Matcher tokens = possibleIds.matcher(sequence.getName()); - int p=0; + int p = 0; while (tokens.find(p)) { String token = tokens.group(); @@ -509,9 +509,8 @@ public class DBRefFetcher implements Runnable * a list of messages to add to */ boolean transferReferences(Vector sdataset, - DbSourceProxy dbSourceProxy, - AlignmentI retrievedAl, boolean trimDatasetSeqs, - List warningMessages) + DbSourceProxy dbSourceProxy, AlignmentI retrievedAl, + boolean trimDatasetSeqs, List warningMessages) { // System.out.println("trimming ? " + trimDatasetSeqs); if (retrievedAl == null || retrievedAl.getHeight() == 0) @@ -543,7 +542,7 @@ public class DBRefFetcher implements Runnable } for (int j = 0, n = entryRefs.size(); j < n; j++) { - DBRefEntry ref = entryRefs.get(j); + DBRefEntry ref = entryRefs.get(j); String accessionId = ref.getAccessionId(); // match up on accessionId if (seqRefs.containsKey(accessionId.toUpperCase(Locale.ROOT))) @@ -740,7 +739,8 @@ public class DBRefFetcher implements Runnable .toUpperCase(Locale.ROOT); int oldstrt = alseqs[alsq].getStart(); alseqs[alsq].setStart(sequence.getSequenceAsString() - .toUpperCase(Locale.ROOT).indexOf(ngAlsq) + sequence.getStart()); + .toUpperCase(Locale.ROOT).indexOf(ngAlsq) + + sequence.getStart()); if (oldstrt != alseqs[alsq].getStart()) { alseqs[alsq].setEnd( @@ -781,15 +781,17 @@ public class DBRefFetcher implements Runnable /** * - * @return any feature settings associated with sources that have provided sequences + * @return any feature settings associated with sources that have provided + * sequences */ - public ListgetFeatureSettingsModels() + public List getFeatureSettingsModels() { return featureDisplaySettings == null ? Arrays.asList(new FeatureSettingsModelI[0]) : Arrays.asList(featureDisplaySettings.values() .toArray(new FeatureSettingsModelI[1])); } + /** * Adds the message to the list unless it already contains it * @@ -812,11 +814,11 @@ public class DBRefFetcher implements Runnable */ private SequenceI[] recoverDbSequences(SequenceI[] sequencesArray) { - int n; - if (sequencesArray == null || (n = sequencesArray.length) == 0) - return sequencesArray; + int n; + if (sequencesArray == null || (n = sequencesArray.length) == 0) + return sequencesArray; ArrayList nseq = new ArrayList<>(); - for (int i = 0;i < n; i++) + for (int i = 0; i < n; i++) { nseq.add(sequencesArray[i]); List dbr = sequencesArray[i].getDBRefs(); @@ -831,11 +833,12 @@ public class DBRefFetcher implements Runnable { nseq.add(map.getTo()); } - } + } } } } - // BH 2019.01.25 question here if this is the right logic. Return the original if nothing found? + // BH 2019.01.25 question here if this is the right logic. Return the + // original if nothing found? if (nseq.size() > 0) { return nseq.toArray(new SequenceI[nseq.size()]);