From f47cbc54ccc008c3e4eefd4b0e514036b7ace708 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Tue, 21 Jun 2016 10:21:23 +0100 Subject: [PATCH] =?utf8?q?JAL-1369=20ensure=20*real*=20alignment=E2=80=99s=20?= =?utf8?q?metadata=20written=20in=20Jalview2XML=20when=20view=20contains=20h?= =?utf8?q?idden=20sequences?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- src/jalview/gui/Jalview2XML.java | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/jalview/gui/Jalview2XML.java b/src/jalview/gui/Jalview2XML.java index a3604d6..5fb8e62 100644 --- a/src/jalview/gui/Jalview2XML.java +++ b/src/jalview/gui/Jalview2XML.java @@ -634,11 +634,15 @@ public class Jalview2XML object.setVersion(jalview.bin.Cache.getDefault("VERSION", "Development Build")); - jalview.datamodel.AlignmentI jal = av.getAlignment(); + /** + * rjal is full height alignment, jal is actual alignment with full metadata + * but excludes hidden sequences. + */ + jalview.datamodel.AlignmentI rjal = av.getAlignment(), jal = rjal; if (av.hasHiddenRows()) { - jal = jal.getHiddenSequences().getFullAlignment(); + rjal = jal.getHiddenSequences().getFullAlignment(); } SequenceSet vamsasSet = new SequenceSet(); @@ -655,6 +659,7 @@ public class Jalview2XML { // switch jal and the dataset jal = jal.getDataset(); + rjal = jal; } } if (jal.getProperties() != null) @@ -674,9 +679,9 @@ public class Jalview2XML Set calcIdSet = new HashSet(); // SAVE SEQUENCES - for (int i = 0; i < jal.getHeight(); i++) + for (int i = 0; i < rjal.getHeight(); i++) { - final SequenceI jds = jal.getSequenceAt(i); + final SequenceI jds = rjal.getSequenceAt(i); final SequenceI jdatasq = jds.getDatasetSequence() == null ? jds : jds.getDatasetSequence(); String id = seqHash(jds); @@ -715,20 +720,21 @@ public class Jalview2XML // Store any sequences this sequence represents if (av.hasHiddenRows()) { + // use rjal, contains the full height alignment jseq.setHidden(av.getAlignment().getHiddenSequences() .isHidden(jds)); - if (av.isHiddenRepSequence(jal.getSequenceAt(i))) + if (av.isHiddenRepSequence(rjal.getSequenceAt(i))) { jalview.datamodel.SequenceI[] reps = av - .getRepresentedSequences(jal.getSequenceAt(i)) - .getSequencesInOrder(jal); + .getRepresentedSequences(rjal.getSequenceAt(i)) + .getSequencesInOrder(rjal); for (int h = 0; h < reps.length; h++) { - if (reps[h] != jal.getSequenceAt(i)) + if (reps[h] != rjal.getSequenceAt(i)) { - jseq.addHiddenSequences(jal.findIndex(reps[h])); + jseq.addHiddenSequences(rjal.findIndex(reps[h])); } } } -- 1.7.10.2