[MOBY-guts] biomoby commit

Paul Gordon gordonp at dev.open-bio.org
Fri Jun 8 14:04:27 UTC 2007


gordonp
Fri Jun  8 10:04:27 EDT 2007
Update of /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util
In directory dev.open-bio.org:/tmp/cvs-serv28675/src/main/ca/ucalgary/seahawk/util

Modified Files:
	HTMLUtils.java MobyUtils.java 
Added Files:
	DataRecorder.java MobyDataTransferable.java RegistryCache.java 
	SeahawkOptions.java 
Log Message:
Commit of Seahawk 1.0 updates and associated core updates
moby-live/Java/src/main/ca/ucalgary/seahawk/util DataRecorder.java,NONE,1.1 MobyDataTransferable.java,NONE,1.1 RegistryCache.java,NONE,1.1 SeahawkOptions.java,NONE,1.1 HTMLUtils.java,1.2,1.3 MobyUtils.java,1.6,1.7
===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java	2007/04/26 15:15:45	1.2
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/HTMLUtils.java	2007/06/08 14:04:27	1.3
@@ -180,21 +180,25 @@
 		
 	    org.w3c.dom.Element data = db.parse(new ByteArrayInputStream(xmltext.getBytes())).getDocumentElement();
 	    if(data.getLocalName().equals(MobyTags.MOBY)){
-		content = MobyDataUtils.fromXMLDocument(data);
+		content = MobyDataUtils.fromXMLDocument(data, SeahawkOptions.getRegistry());
 	    }
 	    else if(data.getLocalName().equals(MobyTags.MOBYCONTENT)){
-		content = new MobyContentInstance(data);
+		content = new MobyContentInstance(data, SeahawkOptions.getRegistry());
 	    }
 	    else if(data.getLocalName().equals(MobyTags.MOBYDATA)){
 		content = new MobyContentInstance();
-		content.parseDataGroup(data);
+		content.parseDataGroup(data, SeahawkOptions.getRegistry());
 	    }
 	    else{
 		// Any other data can be processed by the base object class 
-		content = new MobyContentInstance(MobyDataObject.createInstanceFromDOM(data), "Drag 'n' Drop data");
+		content = new MobyContentInstance(MobyDataObject.createInstanceFromDOM(data, SeahawkOptions.getRegistry()), 
+						  "Drag 'n' Drop data");
 	    }
 	} catch(Exception e){
 	    e.printStackTrace();
+	    System.err.println("This issue may be related to your choice of registry ("+
+			       (SeahawkOptions.getRegistry() == null ? "MOBY default" : SeahawkOptions.getRegistry().getSynonym())
+			       +")");
 	}
 	return content;
     }

===================================================================
RCS file: /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MobyUtils.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MobyUtils.java	2007/04/18 15:55:18	1.6
+++ /home/repository/moby/moby-live/Java/src/main/ca/ucalgary/seahawk/util/MobyUtils.java	2007/06/08 14:04:27	1.7
@@ -4,10 +4,12 @@
 import ca.ucalgary.seahawk.gui.MobyServicesGUI;
 import ca.ucalgary.seahawk.services.MobyClient;
 
+import org.biomoby.registry.meta.Registry;
 import org.biomoby.shared.data.*;
 import org.biomoby.shared.MobyDataType;
 import org.biomoby.shared.MobyNamespace;
 
+import java.awt.datatransfer.Transferable;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
 import java.net.URL;
@@ -24,6 +26,10 @@
 
     private static MobyContentGUI mobyContentGUI = null;
     private static MobyServicesGUI mobyServicesGUI = null;
+
+    public static Transferable createTransferable(MobyContentInstance contents){
+	return null;
+    }
     
     /**
      * The purpose of this method is to create a MOBY document to encapsulate
@@ -47,20 +53,22 @@
 
 	// Find MOBY Objects in it
 	MobyDataObject[] foundObjects = client.getMobyObjects(bytes.toByteArray(), 
-							      MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE));
+							      MobyDataType.getDataType(MobyDataBytes.BASE64_DATATYPE, 
+                                                                                       SeahawkOptions.getRegistry()));
 	// Did we unambiguously find one binary object?
 	if(foundObjects != null && foundObjects.length == 1){
 	    MobyContentInstance mci = new MobyContentInstance();
 	    String[] dataName = url.getPath().split("/");
 	    MobyDataJob job = new MobyDataJob();
 	    job.put(dataName[dataName.length-1], foundObjects[0]);
+	    System.err.println("Namespace of found object was " + foundObjects[0].getPrimaryNamespace().getName());
 	    mci.put(dataName[dataName.length-1], job); // name the data by the last part of the URL path
 	    return mci;
 	}
 	return null;
     }
 
-    public static MobyDataInstance[] convertStringToObjects(String data, boolean reverseSelected){
+    public static MobyDataInstance[] convertStringToObjects(String data){
 	if(data == null){
 	    return new MobyDataInstance[0];
 	}
@@ -74,23 +82,13 @@
 	}
 	
 	// Can always use the data as a string
-	MobyDataString strObject = new MobyDataString(objectName, data);
+	MobyDataString strObject = new MobyDataString(objectName, data, SeahawkOptions.getRegistry());
 	strObject.setPrimaryNamespace(new MobyNamespace("seahawk"));
 	objects.add(strObject);
 
 	// See if it's sequence
 	MobyDataComposite mdc = createMobySequence(data, "user-selection");
 	if(mdc != null){
-	    // reverse complement DNA if necessary
-	    if(reverseSelected &&
-	       (mdc.getDataType() == MobyDataType.getDataType("DNASequence") || 
-		mdc.getDataType() == MobyDataType.getDataType("RNASequence"))){
-
-		MobyDataComposite nucObject = (MobyDataComposite) mdc;
-		MobyDataString seq = (MobyDataString) nucObject.get("SequenceString");
-		seq.setValue(Sequence.reverseComplement(seq.toString()));
-	    }
-
 	    mdc.setName(objectName);
 	    objects.add(mdc);
 	}
@@ -99,8 +97,9 @@
 	    if(data.trim().matches("^[A-Za-z0-9_-]{3,35}$")){
 		objects.add(new MobyDataComposite("Global_Keyword",
 						  "dummy_name", 
-						  "seahawk", 
-						  data.trim()));
+						  "unknown", 
+						  data.trim(),
+						  SeahawkOptions.getRegistry()));
 	    }
 	}
 
@@ -163,19 +162,22 @@
 	    sequence = new MobyDataComposite("DNASequence", 
 					     "dummy_name", 
 					     "seahawk", 
-					     id);
+					     id,
+					     SeahawkOptions.getRegistry());
 	}
 	else if(Sequence.isRNA(sequenceData)){
 	    sequence = new MobyDataComposite("RNASequence", 
 					     "dummy_name", 
 					     "seahawk", 
-					     id);
+					     id,
+					     SeahawkOptions.getRegistry());
 	}
 	else if(Sequence.isProtein(sequenceData)){
 	    sequence = new MobyDataComposite("AminoAcidSequence", 
 					     "dummy_name", 
 					     "seahawk", 
-					     id);
+					     id,
+					     SeahawkOptions.getRegistry());
 	}
 	// Not a recognized type of sequence
 	else{
@@ -183,8 +185,8 @@
 	}
 
 	sequenceData = sequenceData.replaceAll("[ \t\r\n0-9]", "");  // strip whitespace and possible milestone digits
-	sequence.put("SequenceString", new MobyDataString(sequenceData));
-	sequence.put("Length", new MobyDataInt(sequenceData.length()));
+	sequence.put("SequenceString", new MobyDataString(sequenceData, SeahawkOptions.getRegistry()));
+	sequence.put("Length", new MobyDataInt(sequenceData.length(), SeahawkOptions.getRegistry()));
 
 	return sequence;
     }




More information about the MOBY-guts mailing list