Hi,
Maybe this could help you to understand the problem.
I changed my Java version to the
Oracle Java version "1.6.0_43"
I created the register.xml file with the MartConfigurator adding the Ensembl
source.
I use this java code checking the dataset, filter and attribute previously to
verify if I am reading well the register.xml file:
public void getmarts(String xmlPath) {
MartRegistryFactory factory = new XmlMartRegistryFactory(xmlPath,
null);
Portal portal = new Portal(factory);
List<Mart> marts = portal.getMarts(null);
System.out.println(String.format("Got %s marts", marts.size()));
List<Dataset> datasets = portal.getDatasets(marts.get(0).getName());
System.out.println(String.format("Got %s datasets", datasets.size()));
for (Dataset d : datasets) {
if (d.getName().equals("oprinceps_gene_ensembl")) {
System.out.println("Dataset: " + d.getName() + " is present");
List<Filter> filters = portal.getFilters(d.getName(),
marts.get(0).getConfigName(), null);
System.out.println(String.format("Got %s filters",
filters.size()));
for (Filter f : filters) {
if (f.getName().equals("chromosome_name")) {
System.out.println("\tFilter " + f.getName() + " is
present");
}
}
List<Attribute> attributes = portal.getAttributes(d.getName(),
marts.get(0).getConfigName(), (String) null, false);
System.out.println(String.format("Got %s attributes",
attributes.size()));
for (Attribute a : attributes) {
if (a.getName().equals("ensembl_gene_id")) {
System.out.println("\tAttribute " + a.getName() + " is
present");
}
}
}
}
Query query = new Query(portal)
.setProcessor("TSV")
.setClient("test")
.setHeader(true)
.setLimit(10)
.addDataset("oprinceps_gene_ensembl",
"oprinceps_gene_ensembl_config")
.addFilter("chromosome_name", "1")
.addAttribute("ensembl_gene_id")
.end();
query.getResults(System.out);
System.exit(0);
}
The result is this:
ProteinCUDA1:biomartExamples> java -cp $a:dist/biomartExamples.jar
biomartexamples.BiomartExamples /home/roberto/biomart/register.xml
2013-03-08 10:25:57,250 INFO [main:Log.java:164]: Loading resources from
org/biomart/configurator/resources/messages
2013-03-08 10:25:57,268 INFO [main:Log.java:164]: Done loading resources
2013-03-08 10:26:09,805 INFO [main:Log.java:164]: Loading resources from
org/biomart/configurator/resources/messages
2013-03-08 10:26:09,805 INFO [main:Log.java:164]: Done loading resources
Got 61 marts
Got 1 datasets
Dataset: oprinceps_gene_ensembl is present
Got 18 filters
Filter chromosome_name is present
Got 1499 attributes
Attribute ensembl_gene_id is present
2013-03-08 10:26:39,539 INFO [main:Log.java:164]: Incoming XML query: <?xml
version="1.0" encoding="UTF-8"?>
<!DOCTYPE Query>
<Query client="test" processor="TSV" limit="10" header="1"><Dataset
name="oprinceps_gene_ensembl" config="oprinceps_gene_ensembl_config"><Filter
name="chromosome_name" value="1" /><Attribute name="ensembl_gene_id"
/></Dataset></Query>
2013-03-08 10:26:39,557 ERROR [main:Log.java:220]: Error during querying
org.biomart.common.exceptions.ValidationException
at
org.biomart.queryEngine.QueryController.<init>(QueryController.java:113)
at
org.biomart.queryEngine.QueryController.<init>(QueryController.java:118)
at org.biomart.api.Portal.executeQuery(Portal.java:218)
at org.biomart.api.Query.getResults(Query.java:108)
at biomartexamples.BiomartExamples.getmarts(BiomartExamples.java:61)
at biomartexamples.BiomartExamples.main(BiomartExamples.java:71)
Caused by: org.biomart.common.exceptions.ValidationException
at
org.biomart.queryEngine.QueryController.initializeProcessor(QueryController.java:256)
at
org.biomart.queryEngine.QueryController.<init>(QueryController.java:86)
... 5 more
Caused by: java.lang.NullPointerException
at
org.biomart.queryEngine.QueryController.initializeProcessor(QueryController.java:229)
... 6 more
Exception in thread "main" org.biomart.api.BioMartApiException
at org.biomart.api.Portal.executeQuery(Portal.java:222)
at org.biomart.api.Query.getResults(Query.java:108)
at biomartexamples.BiomartExamples.getmarts(BiomartExamples.java:61)
at biomartexamples.BiomartExamples.main(BiomartExamples.java:71)
ProteinCUDA1:biomartExamples>
Regards,
Roberto
On Friday, March 08, 2013 08:49:08 AM you wrote:
> Hi,
>
> Thank you very much for your answer.
>
> I am using:
>
> Opensuse Linux 12.2 with kernel 3.4.28-2.20-desktop
> Oracle Java version "1.7.0_17"
> Apache Ant(TM) version 1.8.2
> BioMart release 0.8 candidate 6
>
> I tried from a local Biomart and from the live server and I have the same
> exception.
>
> I am thinking that the error should be a problem with the libraries included
> into the BioMart's dist folder and my Java version. If this is true it can
> be solved if the BioMart use Maven instead of Ant.
>
> Are you planning to move BioMart from Ant to Maven? Maven is a better option
> for the distribution of java software.
>
> Regards,
> Roberto
>
> On Thursday, March 07, 2013 06:51:10 PM you wrote:
> > Roberto.
> >
> > couple of questions:
> >
> > 1- which release version of biomart v0.8 are you using ? try release
> > candidate 6 in case you are using release candidate 7.
> > 2- Since you installed Biomart locally and accessing Zebra fish from
> > local instance, can you not access the same data from Biomart or
> > Ensembl's live server ?
> >
> > Syed
> >
> > On 5 March 2013 11:20, Roberto Vera <[email protected]> wrote:
> > > Dear Sr.
> > >
> > > I am trying to use the BioMart from java.
> > >
> > > I made a simple test but it doesn't run.
> > >
> > > This is the steps that I followed:
> > >
> > > 1- Download and compile the BioMart
> > > 2- Run the ./scripts/martconfigurator.sh
> > > 3- Add the default source http://www.biomart.org/biomart/martservice
> > > 4- Add an access point for the Danio Rerio genes (Zv9)
> > > 5- Start the server and save the register.xml file.
> > > 6- From the web site all runs well. So I receive the result list.
> > > 7- Copy the java code from the web site and set the register XML
> > > previously
> > > saved.
> > > 8- Add all lib to my CLASSPATH
> > > 9- Run the java code:
> > >
> > > ProteinCUDA1:biomartExamples> java -cp
> > > $CLASSPATH:dist/biomartExamples.jar
> > > biomartexamples.BiomartExamples /home/roberto/biomart/register.xml
> > > 2013-03-05 12:01:36,248 INFO [main:Log.java:164]: Loading resources
> > > from
> > > org/biomart/configurator/resources/messages
> > > 2013-03-05 12:01:36,269 INFO [main:Log.java:164]: Done loading
> > > resources
> > > 2013-03-05 12:01:44,062 INFO [main:Log.java:164]: Loading resources
> > > from
> > > org/biomart/configurator/resources/messages
> > > 2013-03-05 12:01:44,063 INFO [main:Log.java:164]: Done loading
> > > resources
> > > 2013-03-05 12:01:56,783 INFO [main:Log.java:164]: Incoming XML query:
> > > <?xml version="1.0" encoding="UTF-8"?>
> > > <!DOCTYPE Query>
> > > <Query client="biomartclient" processor="TSV" limit="-1"
> > > header="1"><Dataset name="drerio_gene_ensembl"
> > > config="drerio_gene_ensembl_config"><Filter name="with_uniprotsptrembl"
> > > value="only" /><Attribute name="entrezgene" /><Attribute
> > > name="uniprot_swissprot" /></Dataset></Query>
> > >
> > > 2013-03-05 12:01:56,800 ERROR [main:Log.java:220]: Error during querying
> > > org.biomart.common.exceptions.ValidationException
> > >
> > > at
> > >
> > > org.biomart.queryEngine.QueryController.<init>(QueryController.java:113)
> > >
> > > at
> > >
> > > org.biomart.queryEngine.QueryController.<init>(QueryController.java:118)
> > >
> > > at org.biomart.api.Portal.executeQuery(Portal.java:218)
> > > at org.biomart.api.Query.getResults(Query.java:108)
> > > at biomartexamples.BiomartExamples.main(BiomartExamples.java:38)
> > >
> > > Caused by: org.biomart.common.exceptions.ValidationException
> > >
> > > at
> > >
> > > org.biomart.queryEngine.QueryController.initializeProcessor(QueryControl
> > > le
> > > r.java:256)>
> > >
> > > at
> > >
> > > org.biomart.queryEngine.QueryController.<init>(QueryController.java:86)
> > >
> > > ... 4 more
> > >
> > > Caused by: java.lang.NullPointerException
> > >
> > > at
> > >
> > > org.biomart.queryEngine.QueryController.initializeProcessor(QueryControl
> > > le
> > > r.java:229)>
> > >
> > > ... 5 more
> > >
> > > Exception in thread "main" org.biomart.api.BioMartApiException
> > >
> > > at org.biomart.api.Portal.executeQuery(Portal.java:222)
> > > at org.biomart.api.Query.getResults(Query.java:108)
> > > at biomartexamples.BiomartExamples.main(BiomartExamples.java:38)
> > >
> > > ProteinCUDA1:biomartExamples>
> > >
> > >
> > > What is wrong on this workflow?
> > >
> > > Thanking in advanced and best regards,
> > >
> > > Roberto Vera
> > >
> > > _______________________________________________
> > > Users mailing list
> > > [email protected]
> > > https://lists.biomart.org/mailman/listinfo/users
_______________________________________________
Users mailing list
[email protected]
https://lists.biomart.org/mailman/listinfo/users