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=9c98d4bd666346f6ad3892c5394b7da3be82d93e;hp=4705fe565bd1155bccc09327256fcb3666f5af9c;hpb=c7b2143c9cf7c5e05ad63251f7d3910751b16d20;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 4705fe5..d8858a9 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -306,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 @@ -365,8 +364,8 @@ public class DBRefFetcher implements Runnable { if (Console.isDebugEnabled()) { - Console.debug("Querying " + dbsource.getDbName() - + " with : '" + queryString.toString() + "'"); + Console.debug("Querying " + dbsource.getDbName() + " with : '" + + queryString.toString() + "'"); } retrieved = dbsource.getSequenceRecords(queryString.toString()); } catch (Exception ex) @@ -379,8 +378,8 @@ public class DBRefFetcher implements Runnable } if (retrieved != null) { - transferReferences(sdataset, dbsource, retrieved, - trimDsSeqs, warningMessages); + transferReferences(sdataset, dbsource, retrieved, trimDsSeqs, + warningMessages); } } else @@ -399,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)); @@ -407,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(); @@ -510,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) @@ -544,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))) @@ -741,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( @@ -782,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 * @@ -813,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(); @@ -832,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()]);