Fixed protein desc bug
authoramwaterhouse <Andrew Waterhouse>
Mon, 10 Apr 2006 11:10:06 +0000 (11:10 +0000)
committeramwaterhouse <Andrew Waterhouse>
Mon, 10 Apr 2006 11:10:06 +0000 (11:10 +0000)
src/jalview/datamodel/UniprotEntry.java
src/jalview/datamodel/UniprotProteinName.java [new file with mode: 0755]
src/jalview/gui/SequenceFetcher.java
src/jalview/io/SequenceFeatureFetcher.java

index d2f4dcf..dcdaee9 100755 (executable)
@@ -28,7 +28,7 @@ public class UniprotEntry
   Vector accession;\r
   Vector feature;\r
   Vector dbrefs;\r
-  Vector proteinName;\r
+  UniprotProteinName protName;\r
 \r
   public void setAccession(Vector items)\r
   {\r
@@ -50,14 +50,15 @@ public class UniprotEntry
      return accession;\r
    }\r
 \r
-   public void setProteinName(Vector items)\r
+   public void setProtein(UniprotProteinName names)\r
    {\r
-     proteinName = items;\r
+     protName = names;\r
    }\r
 \r
-   public Vector getProteinName()\r
+\r
+   public UniprotProteinName getProtein()\r
    {\r
-     return proteinName;\r
+     return protName;\r
    }\r
 \r
   public void setName(Vector na)\r
diff --git a/src/jalview/datamodel/UniprotProteinName.java b/src/jalview/datamodel/UniprotProteinName.java
new file mode 100755 (executable)
index 0000000..5146ab1
--- /dev/null
@@ -0,0 +1,38 @@
+/*\r
+ * Jalview - A Sequence Alignment Editor and Viewer\r
+ * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle\r
+ *\r
+ * This program is free software; you can redistribute it and/or\r
+ * modify it under the terms of the GNU General Public License\r
+ * as published by the Free Software Foundation; either version 2\r
+ * of the License, or (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program; if not, write to the Free Software\r
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA\r
+ */\r
+package jalview.datamodel;\r
+\r
+public class UniprotProteinName\r
+{\r
+    /**\r
+   * internal content storage\r
+   */\r
+  private java.util.Vector names;\r
+\r
+  public void setName(java.util.Vector names)\r
+  {\r
+    this.names = names;\r
+  }\r
+\r
+  public java.util.Vector getName()\r
+  {\r
+    return names;\r
+  }\r
+\r
+}\r
index 67a3eff..fc8f042 100755 (executable)
@@ -239,6 +239,7 @@ public class SequenceFetcher
   {\r
     EBIFetchClient ebi = new EBIFetchClient();\r
     File file = ebi.fetchDataAsFile("uniprot:" + id, "xml", null);\r
+   // File file = new File("H:/jalview/classes/fer1.xml");\r
     SequenceFeatureFetcher sff = new SequenceFeatureFetcher();\r
     Vector entries = sff.getUniprotEntries(file);\r
 \r
@@ -249,6 +250,7 @@ public class SequenceFetcher
       while (en.hasMoreElements())\r
       {\r
         UniprotEntry entry = (UniprotEntry) en.nextElement();\r
+\r
         StringBuffer name = new StringBuffer(">UniProt/Swiss-Prot");\r
         Enumeration en2 = entry.getAccession().elements();\r
         while (en2.hasMoreElements())\r
@@ -263,8 +265,10 @@ public class SequenceFetcher
           name.append(en2.nextElement());\r
         }\r
 \r
-        if (entry.getProteinName() != null)\r
-          name.append(" " + entry.getProteinName().elementAt(0));\r
+        if (entry.getProtein() != null)\r
+        {\r
+           name.append(" " + entry.getProtein().getName().elementAt(0));\r
+        }\r
 \r
         result.append(name + "\n" + entry.getUniprotSequence().getContent() +\r
                       "\n");\r
@@ -293,8 +297,9 @@ public class SequenceFetcher
           e = entry.getFeature().elements();\r
           while (e.hasMoreElements())\r
           {\r
-            sequence[i].getDatasetSequence().addSequenceFeature( (\r
-                SequenceFeature) e.nextElement());\r
+            SequenceFeature sf = (SequenceFeature) e.nextElement();\r
+            sf.setFeatureGroup("Uniprot");\r
+            sequence[i].getDatasetSequence().addSequenceFeature( sf );\r
           }\r
         }\r
       }\r
index 61b25f9..9bc214f 100755 (executable)
@@ -65,16 +65,19 @@ public class SequenceFeatureFetcher implements Runnable
       map.loadMapping(url);\r
 \r
       // 2. Unmarshal the data\r
-      Unmarshaller unmar = new Unmarshaller();\r
+      Unmarshaller unmar = new Unmarshaller(uni);\r
       unmar.setIgnoreExtraElements(true);\r
       unmar.setMapping(map);\r
-      uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
+   //   unmar.setDebug(true);\r
 \r
+      uni = (UniprotFile) unmar.unmarshal(new FileReader(file));\r
     }\r
     catch (Exception e)\r
     {\r
       System.out.println("Error getUniprotEntries() "+e);\r
     }\r
+\r
+\r
     return uni.getUniprotEntries();\r
   }\r
 \r