X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fio%2FBLCFile.java;h=624e134a0632d2a0f8f8e8c91df1726af590c707;hb=3d9d1f6c1c1da3b2657f9ebb95430d0bc8dde873;hp=a7cc1eadf490f4b5b4ae6bec70c23b5de664d71b;hpb=55e2e9b22b133db8b9ff0979b0338a33081fc8fd;p=jalview.git diff --git a/src/jalview/io/BLCFile.java b/src/jalview/io/BLCFile.java index a7cc1ea..624e134 100755 --- a/src/jalview/io/BLCFile.java +++ b/src/jalview/io/BLCFile.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer -* Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle +* Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -42,15 +42,6 @@ public class BLCFile extends AlignFile { } - /** - * Creates a new BLCFile object. - * - * @param inStr DOCUMENT ME! - */ - public BLCFile(String inStr) - { - super(inStr); - } /** * Creates a new BLCFile object. @@ -77,18 +68,13 @@ public class BLCFile extends AlignFile /** * DOCUMENT ME! */ - public void parse() + public void parse() throws IOException { boolean idsFound = false; - Vector ids = new Vector(); StringBuffer[] seqstrings; - Vector starts = new Vector(); - Vector ends = new Vector(); String line = null; - try - { do { line = nextLine(); @@ -105,27 +91,18 @@ public class BLCFile extends AlignFile if (abracket > -1) { - if (line.indexOf(" ") > -1) // - { - line = line.substring(abracket + 1, - line.indexOf(" ", abracket + 1)); - } - else - line = line.substring(abracket+1); - + line = line.substring(abracket+1); Sequence seq = parseId(line); - ids.addElement(seq.getName()); - starts.addElement(seq.getStart() + ""); - ends.addElement(seq.getEnd() + ""); + seqs.addElement(seq); } } while (!idsFound); int starCol = line.indexOf("*"); - seqstrings = new StringBuffer[ids.size()]; + seqstrings = new StringBuffer[seqs.size()]; - for (int i = 0; i < ids.size(); i++) + for (int i = 0; i < seqs.size(); i++) { if (seqstrings[i] == null) { @@ -135,7 +112,7 @@ public class BLCFile extends AlignFile while ((line = nextLine()).indexOf("*") == -1) { - for (int i = 0; i < ids.size(); i++) + for (int i = 0; i < seqs.size(); i++) { if (line.length() > (i + starCol)) { @@ -144,19 +121,13 @@ public class BLCFile extends AlignFile } } - for (int i = 0; i < ids.size(); i++) + for (int i = 0; i < seqs.size(); i++) { - Sequence newSeq = new Sequence(ids.elementAt(i).toString(), - seqstrings[i].toString(), - Integer.parseInt(starts.elementAt(i).toString()), - Integer.parseInt(ends.elementAt(i).toString())); - seqs.addElement(newSeq); + Sequence newSeq = (Sequence) seqs.elementAt(i); + + newSeq.setSequence(seqstrings[i].toString()); } - } - catch (Exception ex) - { - ex.printStackTrace(); - } + } /** @@ -191,11 +162,15 @@ public class BLCFile extends AlignFile while ((i < s.length) && (s[i] != null)) { - out.append(">" + printId(s[i]) +"\n"); + out.append(">" + printId(s[i])); + if(s[i].getDescription()!=null) + out.append(" "+s[i].getDescription()); + + out.append("\n"); - if (s[i].getSequence().length() > max) + if (s[i].getSequence().length > max) { - max = s[i].getSequence().length(); + max = s[i].getSequence().length; } i++; @@ -209,9 +184,9 @@ public class BLCFile extends AlignFile while ((i < s.length) && (s[i] != null)) { - if (s[i].getSequence().length() > j) + if (s[i].getSequence().length > j) { - out.append(s[i].getSequence().substring(j, j + 1)); + out.append(s[i].getSequenceAsString(j, j + 1)); } else {