From d3cb4999ba0f3a1b58b3f17277ea216f67da7d9f Mon Sep 17 00:00:00 2001 From: gmungoc Date: Mon, 14 Sep 2015 13:10:05 +0100 Subject: [PATCH] JAL-1851 add retrieved sequence's start (-1) to match offset for start of trimmed sequence --- src/jalview/ws/DBRefFetcher.java | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/jalview/ws/DBRefFetcher.java b/src/jalview/ws/DBRefFetcher.java index 5f03ec7..03632c8 100644 --- a/src/jalview/ws/DBRefFetcher.java +++ b/src/jalview/ws/DBRefFetcher.java @@ -125,9 +125,13 @@ public class DBRefFetcher implements Runnable { alseqs[i] = seqs[i]; if (seqs[i].getDatasetSequence() != null) + { ds[i] = seqs[i].getDatasetSequence(); + } else + { ds[i] = seqs[i]; + } } this.dataset = ds; // TODO Jalview 2.5 lots of this code should be in the gui package! @@ -596,9 +600,9 @@ public class DBRefFetcher implements Runnable sequence.getSequenceAsString()).toUpperCase(); int absStart = entrySeq.indexOf(nonGapped); - int mapStart = entry.getStart(); - jalview.datamodel.Mapping mp; + Mapping mp; + final int sequenceStart = sequence.getStart(); if (absStart == -1) { // Is local sequence contained in dataset sequence? @@ -619,8 +623,8 @@ public class DBRefFetcher implements Runnable // create valid mapping between matching region of local sequence and // the mapped sequence mp = new Mapping(null, new int[] { - sequence.getStart() + absStart, - sequence.getStart() + absStart + entrySeq.length() - 1 }, + sequenceStart + absStart, + sequenceStart + absStart + entrySeq.length() - 1 }, new int[] { entry.getStart(), entry.getStart() + entrySeq.length() - 1 }, 1, 1); updateRefFrame = false; // mapping is based on current start/end so @@ -645,7 +649,7 @@ public class DBRefFetcher implements Runnable if (sequence.getSequenceFeatures() != null) { SequenceFeature[] sf = sequence.getSequenceFeatures(); - int start = sequence.getStart(); + int start = sequenceStart; int end = sequence.getEnd(); int startShift = 1 - absStart - start; // how much the features // are @@ -667,8 +671,8 @@ public class DBRefFetcher implements Runnable + " from " + dbSource + " sequence : " + entry.getName()); sequence.transferAnnotation(entry, mp); // unknownSequences.remove(sequence); - int absEnd = absStart + nonGapped.length(); - absStart += 1; + absStart += entry.getStart(); + int absEnd = absStart + nonGapped.length() - 1; if (!trimDatasetSeqs) { // insert full length sequence from record -- 1.7.10.2