[MOBY-dev] sequence datatypes

Paul Gordon gordonp at ucalgary.ca
Wed Dec 13 18:06:04 UTC 2006


Hi Yogaraj,

There are several fundamental issues wrong with your original program, 
but the most salient are:
-You don't have a sequence
-The sequence you tried to specify in amino acid, but the service you 
want to run (runGeneIDGFF) takes DNA
-You're executing the request before the data is set

Below is an example that does as close as I can tell to want you intended:

-Fetches a DNASequence from a genbank gi number (using the 
MOBYSHoundGetGenBankWhateverSequence)
-Executes runGeneIDGFF on the DNASequence
-The secondary parameters already existing in association with the 
service, so you don't need to create them from scratch

Enjoy!
P.S. Please do a CVS update, I made a few changes to deal with the 
crossreferences MOBYSHoundGetGenBankWhateverSequence returns

--------------

import org.biomoby.client.*;
import org.biomoby.shared.*;
import org.biomoby.shared.data.*;
/**
 *
 * @author Paul Gordon
 */
public class Moby {
   
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) throws Exception{
        Central worker = new CentralImpl();
    MobyRequest mr = new MobyRequest(worker);

    // Retrieve the DNASequence from the NCBI GI ID
    MobyService templateService = new 
MobyService("MOBYSHoundGetGenBankWhateverSequence");
        MobyService[] validServices = worker.findService(templateService);
    mr.setService(validServices[0]); // id -> dna
    mr.setInput(new MobyDataObject("NCBI_gi","54695"));
    MobyContentInstance responses = mr.invokeService();

    // Retrieve the GFF predictions for each DNASequence returned
    // (should be only one for this service, but the API doesn't know that)
        templateService = new MobyService("runGeneIDGFF");
    validServices = worker.findService(templateService);
    mr.setService(validServices[0]);  // dna -> gff

    for(MobyDataJob response: responses.values()){
        for(MobyDataObject dna: response.getPrimaryDataObjects()){
        mr.setInput(dna);
        setSecondaries(mr, validServices[0]);
        System.out.println(mr.invokeService().toString());
        }
    }
    }

    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 params
        if(param.getName().equals("strand")){
        secondaryInstances[i] = new MobyDataSecondaryInstance(param, 
"Reverse");
        }
        else if(param.getName().equals("profile")){
        secondaryInstances[i] = new MobyDataSecondaryInstance(param, 
"Arabidopsis thaliana (weed)");
        }
        else if(param.getName().equals("engine")){
        secondaryInstances[i] = new MobyDataSecondaryInstance(param, 
"Exon Mode");
        }
        else if(param.getName().equals("signals")){
        secondaryInstances[i] = new MobyDataSecondaryInstance(param, 
"Start codons");
        }
        else if(param.getName().equals("exons")){
        secondaryInstances[i] = new MobyDataSecondaryInstance(param, 
"All exons");
        }
        // Use default value for other parameters (if any)
        else{
        secondaryInstances[i] = new MobyDataSecondaryInstance(param);
        }
    }

        mr.setSecondaryInput(secondaryInstances);       
    }
}

> hi to  all,
> i got problem executing this web service can anyone help me
>
> /*
>  * Moby.java
>  *
>  * Created on December 3, 2006, 9:33 AM
>  *
>  * To change this template, choose Tools | Options and locate the template under
>  * the Source Creation and Management node. Right-click the template and choose
>  * Open. You can then make changes to the template in the Source Editor.
>  */
> import org.biomoby.client.*;
> import org.biomoby.shared.*;
> import org.biomoby.shared.data.*;
> /**
>  *
>  * @author yogaraj.khanal
>  */
> public class Moby {
>     
>     /** Creates a new instance of Moby */
>     public Moby() {
>     }
>     
>     /**
>      * @param args the command line arguments
>      */
>     public static void main(String[] args) throws Exception{
>         Central worker = new CentralImpl();
>         MobyService templateService = new MobyService("runGeneIDGFF");
>         System.out.println(templateService.getName());
>          System.out.println(templateService.getUniqueName());
>          System.out.println(templateService.getAuthority());
>         MobyPrimaryData[] priinput=templateService.getPrimaryInputs();
>         System.out.println(priinput);
>         
>         MobyService[] validServices = worker.findService(templateService.getId());
>         System.out.println(validServices);
>         MobyRequest mr = new MobyRequest(worker);
> 	//mr.setService(validServices[0]);
>        
> 	//mr.setInput(new MobyDataObject("", ""));
> 	System.out.println(mr.invokeService().toString());
>
> 	//MobyRequest mr = new MobyRequest(worker);
> 	mr.setService(validServices[10]);
>         
> 	mr.setInput(new MobyDataObject("NCBI_gi", "111076"));
>         MobyDataType dataType=new MobyDataType("AminoAcidSequence");
>         mr.setInput(new MobyDataObject("AminoAcidSequence"));
>         MobyDataSecondaryInstance[] secondaryData=new MobyDataSecondaryInstance[5];
>         MobySecondaryData p1=new MobySecondaryData("strand");
>         p1.setDataType("String");
>         p1.setDefaultValue("Reverse");
>         MobySecondaryData p2=new MobySecondaryData("profile");
>         p2.setDataType("String");
>         p2.setDefaultValue("Arabidopsis thalina(weed)");
>         MobySecondaryData p3=new MobySecondaryData("engine");
>         p3.setDataType("String");
>         p3.setDefaultValue("Exon Mode");
>         MobySecondaryData p4=new MobySecondaryData("signals");
>         p4.setDataType("String");
>         p4.setDefaultValue("Start condons");
>         MobySecondaryData p5=new MobySecondaryData("exons");
>         p5.setDataType("String");
>         p5.setDefaultValue("All exons");
>         
>         secondaryData[0]=new MobyDataSecondaryInstance(p1);
>         secondaryData[1]=new MobyDataSecondaryInstance(p2);
>         secondaryData[2]=new MobyDataSecondaryInstance(p3);
>         secondaryData[3]=new MobyDataSecondaryInstance(p4);
>         secondaryData[4]=new MobyDataSecondaryInstance(p5);
>         mr.setSecondaryInput(secondaryData);
>         
> 	System.out.println(mr.invokeService().toString());
>         // TODO code application logic here
>     }
>     
> }
>
> ----- Original Message -----
> From: Paul Gordon <gordonp at ucalgary.ca>
> Date: Tuesday, December 12, 2006 3:40 pm
> Subject: Re: [MOBY-dev] sequence datatypes
>
>   
>> Hi Nassib,
>>
>> I looked at the presentation, and I'm not sure why you can't just 
>> use a 
>> VirtualSequence instead.  You can then have all of the 
>> combinations you 
>> want, as long as you register the namespaces:
>>
>> <VirtualSequence articleName="foo" namespace="renci_global" id="bar">
>> <Integer articleName="Length" namespace="" id="">1500</Integer>
>> </VirtualSequence>
>>
>> <VirtualSequence articleName="foo" namespace="renci_user" id="baz">
>> <Integer articleName="Length" namespace="" id="">1500</Integer>
>> </VirtualSequence>
>>
>> <VirtualSequence articleName="foo" namespace="NCBI_gi" id="123456">
>> <Integer articleName="Length" namespace="" id="">1500</Integer>
>> </VirtualSequence>
>>
>> <DNASequence articleName="foo" namespace="any" id="qux">
>> <Integer articleName="Length" namespace="" id="">1500</Integer>
>> <String articleName="SequenceString" namespace="" 
>> id="">ATG...</String></DNASequence>
>>
>> etc., etc.
>>     
>>> Hi,
>>>
>>> I'd like to start explaining a little bit about our use of 
>>>       
>> biomoby and
>>     
>>> also request feedback...
>>>
>>> We're using biomoby mainly with taverna workflows, and gradually
>>> migrating current web services over to become biomoby services 
>>>       
>> (under> biomoby.renci.org).  The workflows we develop are talking 
>> to services
>>     
>>> that for the most part are based here within our servers.  As a 
>>>       
>> result> we end up passing a very large amount of duplicated 
>> sequence data over
>>     
>>> the network between taverna and services, often more data than 
>>>       
>> taverna> is happy about.  To get around this we have started 
>> passing sequences
>>     
>>> by reference using a FASTA-like format that is non-standard but fits
>>> well into our system and the taverna UI.  I'm calling this the 
>>>       
>> "RENCI> sequence" format, and it's basically similar to GenBank, while
>>     
>>> allowing an "abbreviated" (truncated) form that consists of only a
>>> partial header line with at least one namespace/id.  (The 
>>>       
>> architecture> is described in 
>> http://www.renci.org/~nassar/sequence_registry.ppt )
>>     
>>> We've added some new datatypes under "RenciSequence" for this 
>>>       
>> purpose,> analogous to the existing "GenericSequence".  In general 
>> we are using
>>     
>>> the existing biomoby datatypes, but for sequences our format seems
>>> unusual enough that we thought it needed its own datatype to avoid
>>> confusion.
>>>
>>> Nassib
>>> _______________________________________________
>>> MOBY-dev mailing list
>>> MOBY-dev at lists.open-bio.org
>>> http://lists.open-bio.org/mailman/listinfo/moby-dev
>>>
>>>
>>>   
>>>       
>> _______________________________________________
>> MOBY-dev mailing list
>> MOBY-dev at lists.open-bio.org
>> http://lists.open-bio.org/mailman/listinfo/moby-dev
>>
>>     
>
> _______________________________________________
> MOBY-dev mailing list
> MOBY-dev at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/moby-dev
>
>
>   




More information about the MOBY-dev mailing list