[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Sat Jun 9 18:13:38 UTC 2007


gordonp
Sat Jun  9 14:13:38 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data
In directory dev.open-bio.org:/tmp/cvs-serv4828/src/main/org/biomoby/shared/data

Modified Files:
	MobyDataXref.java 
Log Message:
Fixed DOM parsing so evidence abbrevation, rather than full code, is expected in XML attributes
moby-live/Java/src/main/org/biomoby/shared/data MobyDataXref.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java	2006/12/13 17:53:57	1.6
+++ /home/repository/moby/moby-live/Java/src/main/org/biomoby/shared/data/MobyDataXref.java	2007/06/09 18:13:38	1.7
@@ -71,7 +71,7 @@
 	     MobyPrefixResolver.getAttr(e, "serviceName"), 
 	     MobyPrefixResolver.getAttr(e, "authURI"));
 
-	setEvidenceCode(MobyPrefixResolver.getAttr(e, "evidenceCode"));
+	setEvidenceCodeByAbbrev(MobyPrefixResolver.getAttr(e, "evidenceCode"));
 	setXrefType(MobyPrefixResolver.getAttr(e, "xrefType"));
 
 	String d = e.getTextContent();
@@ -102,6 +102,10 @@
 	serviceDescription = desc;
     }
 
+    public void setEvidenceCodeByAbbrev(String abbrev) throws IllegalArgumentException{
+	setEvidenceCode(evidenceAbbrevToCode(abbrev));
+    }
+
     public void setEvidenceCode(String code) throws IllegalArgumentException{
 	if(code == null || code.length() == 0){
 	    throw new IllegalArgumentException("Evidence code for an Xref cannot be blank");
@@ -115,8 +119,59 @@
 	}
 	else{
 	    throw new IllegalArgumentException("Evidence code to be set (" + 
-					       code + " was not a valid GO code");
+					       code + ") was not a valid GO code");
+	}
+    }
+
+    /**
+     * Given one of the static final evidence codes from this class, returns the 2 or 3 letter
+     * GO evidence abbreviations.  See http://www.geneontology.org/doc/GO.evidence.html
+     */
+    public static String evidenceAbbrevToCode(String abbrev) throws IllegalArgumentException{
+	if(abbrev == null || abbrev.length() == 0){
+	    throw new IllegalArgumentException("Evidence code abbreviation for an Xref cannot be blank");
+	}
+	if(abbrev.equals("IC")){
+	    return IC;
+	}
+	if(abbrev.equals("IDA")){
+	    return IDA;
+	}
+	if(abbrev.equals("IEA")){
+	    return IEA;
+	}
+	if(abbrev.equals("IEP")){
+	    return IEP;
+	}
+	if(abbrev.equals("IGI")){
+	    return IGI;
+	}
+	if(abbrev.equals("IMP")){
+	    return IMP;
+	}
+	if(abbrev.equals("IPI")){
+	    return IPI;
+	}
+	if(abbrev.equals("ISS")){
+	    return ISS;
+	}
+	if(abbrev.equals("NAS")){
+	    return NAS;
+	}
+	if(abbrev.equals("ND")){
+	    return ND;
+	}
+	if(abbrev.equals("RCA")){
+	    return RCA;
+	}
+	if(abbrev.equals("TAS")){
+	    return TAS;
+	}
+	if(abbrev.equals("NR")){
+	    return NR;
 	}
+	throw new IllegalArgumentException("Evidence abbreviation to expand (" + 
+					   abbrev + " was not a valid GO code abbreviation");
     }
 
     /**




More information about the MOBY-guts mailing list