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