Hi Andrea,
I wonder why you have not tried the webservice querying and if that
works. e.g send the XML query to this URL:
http://central.biomart.org/martservice/results?query=<XML_query>
just replace the <XML_query> with actual XML e.g the one that you sent
on the list.
HTH,
Syed
On 09/02/2012 12:21, Andrea Gangi wrote:
Hi, i want to use our service for my Java application.
I need to access PRIDE data. The query XML automatically generated by
central.biomart.org <http://central.biomart.org> is:
<!DOCTYPE Query>
<Query client="true" processor="TSV" limit="-1" header="1">
<Dataset name="pride" config="pride_config">
<Attribute name="experiment_ac"/>
<Attribute name="experiment_title"/>
<Attribute name="pubmed_id"/>
<Attribute name="uniprot_id"/>
<Attribute name="submitted_accession"/>
</Dataset
</Query>
How can I use this query from my Java application?
Alternatively: I have generated this Java code too. But where can I find
the BiomartAPI for Java? I need to install anything or is there a .jar
file that include Biomart JAVA api?
import org.biomart.api.factory.*;
import org.biomart.api.Portal;
import org.biomart.api.Query;
/*
* This is a runnable Java class that executes the query.
* Please adapt this code as needed, and DON'T forget to change the
xmlPath.
*/
public class QueryTest {
public static void main(String[] args) throws Exception {
String xmlPath = "/path/to/registry_xml"; // Needs to be changed
MartRegistryFactory factory = new XmlMartRegistryFactory(xmlPath, null);
Portal portal = new Portal(factory, null);
Query query = new Query(portal);
query.setProcessor("TSV");
query.setClient("biomartclient");
query.setLimit(-1);
query.setHeader(true);
Query.Dataset ds = query.addDataset("pride", "pride_config");
ds.addAttribute("experiment_ac");
ds.addAttribute("experiment_title");
ds.addAttribute("pubmed_id");
ds.addAttribute("uniprot_id");
ds.addAttribute("submitted_accession");
// Print to System.out, but you can pass in any java.io.OutputStream
query.getResults(System.out);
System.exit(0);
}
}
How can I easily access this information by my application?
Thank you
Bye
_______________________________________________
Users mailing list
[email protected]
https://lists.biomart.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
https://lists.biomart.org/mailman/listinfo/users