[MOBY-l] DataInputs for complex services

Paul Gordon gordonp at ucalgary.ca
Thu Aug 9 14:51:33 UTC 2007


Hi Ola,

The key, if you are using the org.biomoby.shared.data package, is that 
everything is a primitive, or a composite. 
Composites are Java Maps, with member article names as the keys.  See 
the examples below.  May I suggest, if you have
not already, to join the moby-dev mailing list, as the moby-l mailing 
list is primarily for non-technical discussion
(I'm cross-posting this reply just in case you are not on moby-dev, and 
to show the moby-l-only folks that we are
doing real work ;-)).
> Hello,
>
> Thanks for a great framework, I am excited to add BioMoby features to  
> Bioclipse (http://www.bioclipse.net). However, I have some questions  
> to get things running:
>
> How do I set up the PrimaryDataInput and SecondaryDatainputs for a  
> more advanced service in jMoby?
> For example, the service 'runClustalwFast':
>
> MobyService templateService = new MobyService("runClustalwFast");
> MobyService[] validServices = worker.findService(templateService);
>
> This gives me the following info from the service:
>
> Primary inputs:
> Name: 'sequences' - DataType: 'GenericSequence'
>   
/** Here is the 'Generic' solution, untested and off the cuff */

MobyDataComposite seq = new MobyDataComposite("GenericSequence");
for(MobyRelationship child: seq.getDataType().getAllChildren()){
  String childTypeName = child.getDataTypeName();
  // Things are either primitive, or composite
  if(PrimitiveType.isPrimitive(childTypeName)){
    seq.put(child.getName(),
                MobyDataObject.createInstanceFromString(childTypeName,
                                                                                      
sourceDataStringForThisField));
  }
  else{
    // recursively populate the child as a MobyDataComposite
  }
}
> Primary outputs:
> Name: 'alignment' - DataType: 'Clustalw_Text'
>   
You don't need to do anything, the service will populate this for
you (via MobyRequest.invokeService()).

> Secondary inputs:
> Name: 'ktup' - DataType: 'Integer'
> Name: 'gapext' - DataType: 'Float'
> Name: 'transitions_weight' - DataType: 'Float'
> Name: 'window' - DataType: 'Integer'
> Name: 'topdiag' - DataType: 'Integer'
> Name: 'matrix' - DataType: 'String'
> Name: 'pairgap' - DataType: 'Integer'
> Name: 'endgaps' - DataType: 'String'
> Name: 'gapdist' - DataType: 'Integer'
> Name: 'gapopen' - DataType: 'Float'
>   
   public static void setSecondaries(MobyRequest mr, MobyService service){
        MobySecondaryData[] secondaryData = service.getSecondaryInputs();
        MobyDataSecondaryInstance[] secondaryInstances =
            new MobyDataSecondaryInstance[secondaryData.length];

        for(int i = 0; i < secondaryData.length; i++){
            MobySecondaryData param = secondaryData[i];
            // Set specific values for the following param, just as an 
example
            if(param.getName().equals("strand")){
                secondaryInstances[i] = new 
MobyDataSecondaryInstance(param, "Reverse");
            }
            // Use default value for other parameters (if any), is set 
to the registered default value automagically
            else{
                secondaryInstances[i] = new 
MobyDataSecondaryInstance(param);
            }
        }

        mr.setSecondaryInput(secondaryInstances);
    }

> How do I set up the inputs with MobyDataObject's for this service?  
> The sample clients in CVS only deal with simple setups (id and  
> namespace) so some lines of example code would be really helpful.
>
> Another question: How can I from the MobyDataType tell what format I  
> should expect to fill in? If it is 'GenericSequence', how can I tell  
> if i'm supposed to add a String? Can I look that up somewhere? 
This is covered in the first example, mobyDataType.getAllChildren();

> And do  
> the MobyDataType's have constraints (like min/max values) etc? 
No, only Secondary parameters have constraints on values in Moby.
> I have  
> also not really understood the key-value-datatype. Is it possible to  
> get the allowed keys from the MobyDataType in some way?
>   
Do you mean namespace/id?  You can get the list of valid namespaces with 
Central..|*getFullNamespaces 
<http://biomoby.open-bio.org/CVS_CONTENT/moby-live/Java/docs/API/org/biomoby/shared/Central.html#getFullNamespaces%28%29>*()| 
.
There is no way to validate IDs except by submitting them to services 
are seeing if they work.

Hope this helps!

-Paul
> Cheers,
>
>     .../Ola Spjuth
>
>
>
>
> _______________________________________________
> moby-l mailing list
> moby-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/moby-l
>
> !DSPAM:60005,46ba331480211783021950!
>
>
>
>   




More information about the moby-l mailing list