From c11a4dfd307ba4a13d1b4cd7d5a21f8a56a06da9 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 29 Aug 2006 15:21:39 +0000 Subject: [PATCH] SequenceMapping updated --- src/jalview/datamodel/AlignmentAnnotation.java | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java index 62de696..470497e 100755 --- a/src/jalview/datamodel/AlignmentAnnotation.java +++ b/src/jalview/datamodel/AlignmentAnnotation.java @@ -262,7 +262,9 @@ public class AlignmentAnnotation * @param seqRef * @param startRes */ - public void createSequenceMapping(SequenceI seqRef, int startRes) + public void createSequenceMapping(SequenceI seqRef, + int startRes, + boolean alreadyMapped) { if(seqRef == null) return; @@ -270,30 +272,22 @@ public class AlignmentAnnotation sequenceMapping = new java.util.Hashtable(); sequenceRef = seqRef; - - if(startRes < sequenceRef.getStart()) - startRes = sequenceRef.getStart(); - int seqPos; - int fileOffset = 0; - if(startRes > sequenceRef.getStart()) - { - fileOffset = startRes - sequenceRef.getStart(); - } - for(int i = 0; i < annotations.length; i++) { - seqPos = sequenceRef.findPosition(i + fileOffset); if (annotations[i] != null) { - sequenceMapping.put(new Integer(seqPos), - annotations[i]); + if(alreadyMapped) + seqPos = seqRef.findPosition(i); + else + seqPos = i+startRes; + + sequenceMapping.put(new Integer(seqPos), annotations[i]); } } adjustForAlignment(); - } public void adjustForAlignment() -- 1.7.10.2