JAL-2805 added check for sequences already being present in tree nodes
authorkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 9 Jan 2018 14:23:43 +0000 (14:23 +0000)
committerkjvdheide <kjvanderheide@dundee.ac.uk>
Tue, 9 Jan 2018 14:23:43 +0000 (14:23 +0000)
src/jalview/ext/treeviewer/LoadedTreeSequenceAssociation.java

index 4229b50..3711e81 100644 (file)
@@ -59,9 +59,25 @@ public class LoadedTreeSequenceAssociation
         nodeSequence = algnIds.findIdMatch(nodeSequenceName);
         if (nodeSequence != null)
         {
-
+          // is there already a sequence present for the node?
+          // If so, does it actually match Jalview's sequence?
+          if (treeNode.getSequence() != null)
+          {
+            if (treeNode.getSequence().getSequenceAsString() != nodeSequence
+                    .getSequenceAsString())
+            {
+              System.err.println(
+                      "Sequence detected in tree node that does not match corresponding Jalview sequence:"
+                              + nodeSequenceName);
+              // which sequence gets precedence?
+
+            }
+
+          }
+          else
+          {
           treeNode.setSequence(nodeSequence);
-
+          }
           MappingUtils.putWithDuplicationCheck(alignmentWithNodes,
                   nodeSequence, treeNode);
           MappingUtils.putWithDuplicationCheck(nodesWithAlignment, treeNode,