FastaReader build into the datamodel
authorpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 28 Apr 2011 10:47:29 +0000 (10:47 +0000)
committerpvtroshin <pvtroshin@e3abac25-378b-4346-85de-24260fe3988d>
Thu, 28 Apr 2011 10:47:29 +0000 (10:47 +0000)
git-svn-id: link to svn.lifesci.dundee.ac.uk/svn/barton/ptroshin/JABA2@4045 e3abac25-378b-4346-85de-24260fe3988d

build.xml
datamodel/compbio/data/sequence/FastaReader.java
website/archive/datamodel-1.2.jar [new file with mode: 0644]
website/archive/datamodel-src-1.2.jar [new file with mode: 0644]

index 9b30d3a..fc99421 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -8,8 +8,8 @@
        <!-- Distributive file names-->\r
        <property name="distdir" value="website/archive"/>\r
        <mkdir dir="${distdir}" />\r
-       <property name="datamodel" value="${distdir}/datamodel-1.1.jar"/>\r
-       <property name="datamodel-src" value="${distdir}/datamodel-src-1.1.jar"/>\r
+       <property name="datamodel" value="${distdir}/datamodel-1.2.jar"/>\r
+       <property name="datamodel-src" value="${distdir}/datamodel-src-1.2.jar"/>\r
        <property name="min-jaba-client" value="${distdir}/min-jaba-client.jar"/>\r
        <property name="aacon-ws-client" value="${distdir}/aacon-ws-client.jar"/>\r
        <property name="full-jaba-client" value="${distdir}/full-jaba-client.jar"/>\r
index ed91e93..2e1357f 100644 (file)
@@ -135,26 +135,24 @@ public class FastaReader implements Iterator<FastaSequence> {
        }\r
 \r
        private static FastaSequence toFastaSequence(final String singleFastaEntry) {\r
-               final Scanner sc = new Scanner(singleFastaEntry);\r
-               // Use new line delimiter\r
-               sc.useDelimiter("\n");\r
-               if (!sc.hasNext()) {\r
+\r
+               assert !Util.isEmpty(singleFastaEntry) : "Empty String where FASTA sequence is expected!";\r
+\r
+               int nlineidx = singleFastaEntry.indexOf("\n");\r
+               if (nlineidx < 0) {\r
                        throw new AssertionError(\r
                                        "The FASTA sequence must contain the header information"\r
                                                        + " separated by the new line from the sequence. Given sequence does not appear to "\r
                                                        + "contain the header! Given data:\n "\r
                                                        + singleFastaEntry);\r
                }\r
-               String header = sc.next();\r
+               String header = singleFastaEntry.substring(0, nlineidx);\r
+\r
                // Get rid of the new line chars (should cover common cases)\r
                header = header.replaceAll("\r", "");\r
 \r
-               sc.useDelimiter("\\s*");\r
-               final StringBuilder sb = new StringBuilder();\r
-               while (sc.hasNext()) {\r
-                       sb.append(sc.next());\r
-               }\r
-               final String sequence = sb.toString();\r
+               String sequence = singleFastaEntry.substring(nlineidx);\r
+\r
                if (Util.isEmpty(sequence)) {\r
                        throw new AssertionError(\r
                                        "Empty sequences are not allowed! Please make sure the "\r
diff --git a/website/archive/datamodel-1.2.jar b/website/archive/datamodel-1.2.jar
new file mode 100644 (file)
index 0000000..4c7cffc
Binary files /dev/null and b/website/archive/datamodel-1.2.jar differ
diff --git a/website/archive/datamodel-src-1.2.jar b/website/archive/datamodel-src-1.2.jar
new file mode 100644 (file)
index 0000000..6b324de
Binary files /dev/null and b/website/archive/datamodel-src-1.2.jar differ