X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=e8494e4271da581915e4f062cfe7be8602f17fc4;hb=47168f025aefdaa044802bd5f8f510ffe43a4808;hp=17c1bc9a68b94ca698a2392abeee79da3531d4f6;hpb=67bb04bf601a6f5bc2bf2d568a1bd73a8656072a;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 17c1bc9..e8494e4 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -1,19 +1,22 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8) - * Copyright (C) 2012 J Procter, AM Waterhouse, LM Lui, J Engelhardt, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.ws; @@ -30,6 +33,7 @@ import jalview.gui.CutAndPasteTransfer; import jalview.gui.Desktop; import jalview.gui.IProgressIndicator; import jalview.gui.OOMWarning; +import jalview.util.MessageManager; import jalview.ws.dbsources.das.api.jalviewSourceI; import jalview.ws.seqfetcher.DbSourceProxy; @@ -76,6 +80,11 @@ public class DBRefFetcher implements Runnable private SequenceI[] alseqs; + /** + * when true - retrieved sequences will be trimmed to cover longest derived alignment sequence + */ + private boolean trimDsSeqs=true; + public DBRefFetcher() { } @@ -122,6 +131,8 @@ public class DBRefFetcher implements Runnable this.dataset = ds; // TODO Jalview 2.5 lots of this code should be in the gui package! sfetcher = jalview.gui.SequenceFetcher.getSequenceFetcherSingleton(af); + // set default behaviour for transferring excess sequence data to the dataset + trimDsSeqs = Cache.getDefault("TRIM_FETCHED_DATASET_SEQS", true); if (sources == null) { // af.featureSettings_actionPerformed(null); @@ -370,7 +381,7 @@ public class DBRefFetcher implements Runnable if (retrieved != null) { transferReferences(sdataset, dbsource.getDbSource(), - retrieved); + retrieved,trimDsSeqs); } } else @@ -449,17 +460,15 @@ public class DBRefFetcher implements Runnable } // all databases have been queries. if (sbuffer.length() > 0) { - output.setText("Your sequences have been verified against known sequence databases. Some of the ids have been\n" - + "altered, most likely the start/end residue will have been updated.\n" - + "Save your alignment to maintain the updated id.\n\n" + output.setText(MessageManager.getString("label.your_sequences_have_been_verified") + sbuffer.toString()); - Desktop.addInternalFrame(output, "Sequence names updated ", 600, 300); + Desktop.addInternalFrame(output, MessageManager.getString("label.sequence_names_updated"), 600, 300); // The above is the dataset, we must now find out the index // of the viewed sequence } - af.setProgressBar("DBRef search completed", startTime); + af.setProgressBar(MessageManager.getString("label.dbref_search_completed"), startTime); // promptBeforeBlast(); running = false; @@ -469,12 +478,14 @@ public class DBRefFetcher implements Runnable /** * Verify local sequences in seqRefs against the retrieved sequence database * records. + * @param trimDatasetSeqs * */ void transferReferences(Vector sdataset, String dbSource, - AlignmentI retrievedAl) // File + AlignmentI retrievedAl, boolean trimDatasetSeqs) // File // file) { + System.out.println("trimming ? "+trimDatasetSeqs); if (retrievedAl == null || retrievedAl.getHeight() == 0) { return; @@ -568,6 +579,7 @@ public class DBRefFetcher implements Runnable // mappings are made (but content matches retrieved set) boolean updateRefFrame = sequence.getDBRef() == null || sequence.getDBRef().length == 0; + // TODO: // verify sequence against the entry sequence String nonGapped = AlignSeq.extractGaps("-. ", @@ -648,11 +660,19 @@ public class DBRefFetcher implements Runnable // unknownSequences.remove(sequence); int absEnd = absStart + nonGapped.length(); absStart += 1; + if (!trimDatasetSeqs) { + // insert full length sequence from record + sequence.setSequence(entry.getSequenceAsString()); + sequence.setStart(entry.getStart()); + } if (updateRefFrame) { // finally, update local sequence reference frame if we're allowed - sequence.setStart(absStart); - sequence.setEnd(absEnd); + if (trimDatasetSeqs) { + // just fix start/end + sequence.setStart(absStart); + sequence.setEnd(absEnd); + } // search for alignment sequences to update coordinate frame for for (int alsq = 0; alsq < alseqs.length; alsq++) {