X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAlignFile.java;h=f933961b3c6886330bcdc2f2520aa195913cd66f;hb=2f1b1f33d31e1b068cea66d66f0bed29a4585cf7;hp=842f2fc8545667959178a4bc3b0d7d0f8d2a2bd7;hpb=c2fb0cbc97e0dc8f1c0d13f9bd6cba24df7e34d3;p=jalview.git diff --git a/src/jalview/io/AlignFile.java b/src/jalview/io/AlignFile.java index 842f2fc..f933961 100755 --- a/src/jalview/io/AlignFile.java +++ b/src/jalview/io/AlignFile.java @@ -39,7 +39,6 @@ public abstract class AlignFile extends FileParse Vector headers; long start; long end; - boolean dbPrefix = true; boolean jvSuffix = true; /** @@ -152,77 +151,31 @@ public abstract class AlignFile extends FileParse */ public abstract String print(); - public void addDBPrefix(boolean b) - { - dbPrefix = b; - } - public void addJVSuffix(boolean b) { jvSuffix = b; } /** - * A general parser for ids. Will look for dbrefs in - * Uniprot format source|id - * And also Jalview /start-end + * A general parser for ids. * * @String id Id to be parsed */ Sequence parseId(String id) { + Sequence seq = null; id = id.trim(); - Sequence seq = new Sequence("",""); int space = id.indexOf(" "); if(space>-1) { + seq = new Sequence(id.substring(0, space),""); seq.setDescription(id.substring(space+1)); - id = id.substring(0, space); } - - // Read in any DB refs first - StringTokenizer st; - st = new StringTokenizer(id, "|"); - - while (st.countTokens()>1) + else { - String a = st.nextToken(); - String b = st.nextToken(); - seq.addDBRef( new DBRefEntry( a, "0", b)); + seq = new Sequence(id, ""); } - if(st.hasMoreTokens()) - id = st.nextToken(); - - - // Remove /start-end from sequence - if (id.indexOf("/") > 0) - { - st = new StringTokenizer(id, "/"); - String limits=null; - try{ - if (st.countTokens() == 2) - { - id = st.nextToken(); - - limits = st.nextToken(); - - st = new StringTokenizer(limits, "-"); - - if (st.countTokens() == 2) - { - seq.setStart(Integer.valueOf(st.nextToken()).intValue()); - seq.setEnd(Integer.valueOf(st.nextToken()).intValue()); - } - } - }catch(NumberFormatException ex) - { - // Problem parsing sequence limits. Just add it back to the - // Id so we dont lose this info - id += "/" + limits; - } - } - seq.setName(id); return seq; } @@ -235,25 +188,7 @@ public abstract class AlignFile extends FileParse */ String printId(SequenceI seq) { - StringBuffer result = new StringBuffer(); - if(dbPrefix && seq.getDBRef()!=null) - { - Vector dbrefs = seq.getDBRef(); - for(int i=0; i