X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fws%2FDBRefFetcher.java;h=7b06a710ad1f1695434b4491f345ce7c76ce4274;hb=55a3fa00d81fe3156c55d4748eabfadeb25a97ed;hp=1cbc821439080e0f62e4a42cf02493f0a5356ccf;hpb=4cea7a0328724b90a6a7c16ae8c926e0cc12cedd;p=jalview.git diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 1cbc821..7b06a71 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -1,6 +1,6 @@ /* - * 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.1) + * Copyright (C) 2014 The Jalview Authors * * This file is part of Jalview. * @@ -14,6 +14,7 @@ * 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 . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.ws; @@ -77,6 +78,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() { } @@ -123,6 +129,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); @@ -371,7 +379,7 @@ public class DBRefFetcher implements Runnable if (retrieved != null) { transferReferences(sdataset, dbsource.getDbSource(), - retrieved); + retrieved,trimDsSeqs); } } else @@ -468,12 +476,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; @@ -567,6 +577,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("-. ", @@ -647,11 +658,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++) {