From 26816cdcb7617e74fad006d2c675efb298e0d9b1 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 22 Sep 2020 15:09:51 +0100 Subject: [PATCH] =?utf8?q?JAL-3748=20don=E2=80=99t=20trash=20start/end=20on=20?= =?utf8?q?SequenceI=20reconstructed=20from=20a=20SeqCigar=20via=20SeqsetUtil?= =?utf8?q?s.SeqCharacterUnhash?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/analysis/SeqsetUtils.java | 20 +++++++++++++++++--- src/jalview/datamodel/SeqCigar.java | 2 +- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/jalview/analysis/SeqsetUtils.java b/src/jalview/analysis/SeqsetUtils.java index fdca89d..891e295 100755 --- a/src/jalview/analysis/SeqsetUtils.java +++ b/src/jalview/analysis/SeqsetUtils.java @@ -84,6 +84,20 @@ public class SeqsetUtils */ public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo) { + return SeqCharacterUnhash(sq, sqinfo, false, false); + } + + /** + * restore some characteristics for a sequence from its hash + * @param sq + * @param sqinfo + * @param excludeLimits - when true, start/end is left unmodified + * @param excludeFeatures - when true, features are not restored from stashed vector + * @return true if sequence's name was modified + */ + + public static boolean SeqCharacterUnhash(SequenceI sq, Hashtable sqinfo, boolean excludeLimits,boolean excludeFeatures) + { boolean namePresent = true; if (sqinfo == null) { @@ -110,13 +124,13 @@ public class SeqsetUtils sq.setPDBId(pdbid); } - if ((start != null) && (end != null)) + if (!excludeLimits && (start != null) && (end != null)) { sq.setStart(start.intValue()); sq.setEnd(end.intValue()); } - - if (sfeatures != null && !sfeatures.isEmpty()) + // TODO: drop this completely since we should not manipulate sequenceFeatures as a vector any more + if (!excludeFeatures && sfeatures != null && !sfeatures.isEmpty()) { sq.setSequenceFeatures(sfeatures); } diff --git a/src/jalview/datamodel/SeqCigar.java b/src/jalview/datamodel/SeqCigar.java index c282d6e..34697b3 100644 --- a/src/jalview/datamodel/SeqCigar.java +++ b/src/jalview/datamodel/SeqCigar.java @@ -587,7 +587,7 @@ public class SeqCigar extends CigarSimple + (bounds[2] == 0 ? -1 : bounds[2])); seqs[i].setDatasetSequence(ref); seqs[i].setDescription(ref.getDescription()); - SeqsetUtils.SeqCharacterUnhash(seqs[i],alseqs[i].seqProps); + SeqsetUtils.SeqCharacterUnhash(seqs[i],alseqs[i].seqProps,true,true); } if (segments != null) { -- 1.7.10.2