From 167476e350f385aa0fcb334b79722ddaa1b3a368 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 18 Jul 2008 15:05:30 +0000 Subject: [PATCH] resolve 1:many mappings from feature sequence ID to alignment sequence(s) with same ID --- src/jalview/io/FeaturesFile.java | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index 03a7a83..3e0314a 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -148,7 +148,7 @@ public class FeaturesFile extends AlignFile } continue; } - + String seqId=""; while (st.hasMoreElements()) { @@ -156,8 +156,8 @@ public class FeaturesFile extends AlignFile { // Still possible this is an old Jalview file, // which does not have type colours at the beginning - token = st.nextToken(); - seq = align.findName(token, true); + seqId = token = st.nextToken(); + seq = align.findName(seqId, true); if (seq != null) { desc = st.nextToken(); @@ -205,7 +205,10 @@ public class FeaturesFile extends AlignFile } seq.addSequenceFeature(sf); - + while ((seq=align.findName(seq, seqId, true))!=null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } break; } } @@ -231,11 +234,12 @@ public class FeaturesFile extends AlignFile if (!token.equals("ID_NOT_SPECIFIED")) { - seq = align.findName(token, true); + seq = align.findName(seqId=token, true); st.nextToken(); } else { + seqId=null; try { index = Integer.parseInt(st.nextToken()); @@ -266,8 +270,6 @@ public class FeaturesFile extends AlignFile sf = new SequenceFeature(type, desc, "", start, end, featureGroup); - seq.addSequenceFeature(sf); - if (groupLink != null && removeHTML) { sf.addLink(groupLink); @@ -281,6 +283,12 @@ public class FeaturesFile extends AlignFile parseDescriptionHTML(sf, removeHTML); + seq.addSequenceFeature(sf); + + while (seqId!=null && (seq=align.findName(seq, seqId, false))!=null) + { + seq.addSequenceFeature(new SequenceFeature(sf)); + } // If we got here, its not a GFFFile GFFFile = false; } -- 1.7.10.2