From: amwaterhouse Date: Wed, 26 Oct 2005 16:22:50 +0000 (+0000) Subject: Parsing updates X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=009fc42205272de69744c96a04852241b9b03e85;p=jalview.git Parsing updates --- diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 630dc6c..c41666e 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -171,6 +171,7 @@ public abstract class AlignFile extends FileParse */ Sequence parseId(String id) { + id = id.trim(); Sequence seq = new Sequence("",""); int space = id.indexOf(" "); if(space>-1) @@ -183,9 +184,12 @@ public abstract class AlignFile extends FileParse StringTokenizer st; st = new StringTokenizer(id, "|"); - while (st.countTokens()>2) + while (st.countTokens()>1) { - seq.addDBRef( new DBRefEntry( st.nextToken(), "0", st.nextToken())); + String a = st.nextToken(); + String b = st.nextToken(); + System.out.print(a+" "+b+" "); + seq.addDBRef( new DBRefEntry( a, "0", b)); } if(st.hasMoreTokens()) diff --git a/src/jalview/io/FastaFile.java b/src/jalview/io/FastaFile.java index f1ce1fc..37c96f6 100755 --- a/src/jalview/io/FastaFile.java +++ b/src/jalview/io/FastaFile.java @@ -18,8 +18,6 @@ */ package jalview.io; -import jalview.analysis.*; - import jalview.datamodel.*; import java.io.*; @@ -80,19 +78,16 @@ public class FastaFile extends AlignFile { if (line.length() > 0) { - // Do we have an id line? - // JBPNote - this code needs to be standardised to EBI/whatever for the - // >dbref/dbref/dbref|refid1|refid2|refid3 'human-readable' style of naming (should it really exist) if (line.charAt(0)=='>') { - seq = parseId(line.substring(1)); - if (count != 0) { seq.setSequence(sb.toString()); seqs.addElement(seq); } + seq = parseId(line.substring(1)); + count++; sb = new StringBuffer(); }