Access Keys:
Skip to content (Access Key - 0)

Implementation of the Analytical Method



  • Open for editing the file C:\CaGridTutorialService\src\gov\nih\nci\cagrid\tutorial\service\CaGridTutorialServiceImpl.java. You will see that there is a new method called findGenesSharedPathways which is not yet implemented.

Replace:

//TODO: Implement this autogenerated method
throw new RemoteException("Not yet implemented");

With:

try {
	String caBioURL;
	try {
		caBioURL = getConfiguration()
				.getCqlQueryProcessorConfig_appserviceUrl();
	} catch (Exception e) {
		throw new RemoteException(
				"Unable to load service configuration");
	}
	gov.nih.nci.system.applicationservice.ApplicationService appService = gov.nih.nci.system.applicationservice.ApplicationService.getRemoteInstance(caBioURL);

	String gClass = gov.nih.nci.cabio.domain.Gene.class.getName();
	String hql = "SELECT DISTINCT g2 FROM "
			+ gClass
			+ " as g1, "
			+ gClass
			+ " as g2 WHERE g1.symbol='"
			+ gene.getSymbol()
			+ "' AND g2.pathwayCollection.id IN g1.pathwayCollection.id";
	java.util.List rList = appService.query(
			new gov.nih.nci.common.util.HQLCriteria(hql),
			gov.nih.nci.cabio.domain.Gene.class.getName());
	gov.nih.nci.cabio.domain.Gene[] geneArray = new gov.nih.nci.cabio.domain.Gene[rList.size()];
	System.arraycopy(rList.toArray(), 0, geneArray, 0, rList.size());
	return geneArray;
} catch (gov.nih.nci.system.applicationservice.ApplicationException e) {
	e.printStackTrace();
	throw new RemoteException("Error trying to find shared pathways");
}
  • Save the modified file.

Modify the Client to Test the Service


  • Open for editing the file C:\CaGridTutorialService\src\gov\nih\nci\cagrid\tutorial\client\CaGridTutorialServiceClient.java. In the main method replace:
gov.nih.nci.cagrid.cqlquery.CQLQuery query = new gov.nih.nci.cagrid.cqlquery.CQLQuery();
gov.nih.nci.cagrid.cqlquery.Object target = new gov.nih.nci.cagrid.cqlquery.Object();
target.setName(gov.nih.nci.cabio.domain.Gene.class.getName());
gov.nih.nci.cagrid.cqlquery.Attribute att = new gov.nih.nci.cagrid.cqlquery.Attribute();
att.setName("symbol");
att.setValue("BRCA%");
att.setPredicate(gov.nih.nci.cagrid.cqlquery.Predicate.LIKE);
target.setAttribute(att);
query.setTarget(target);

gov.nih.nci.cagrid.cqlresultset.CQLQueryResults results = client.query(query);

java.util.Iterator iter = new gov.nih.nci.cagrid.data.utilities.CQLQueryResultsIterator(
          results, CaGridTutorialServiceClient.class.getResourceAsStream("client-config.wsdd"));
while (iter.hasNext()) {
          Object o = iter.next();
          System.out.println(((gov.nih.nci.cabio.domain.Gene) o).getFullName());
}
System.out.println("Query Complete.");

With:

gov.nih.nci.cabio.domain.Gene gene = new gov.nih.nci.cabio.domain.Gene();
gene.setSymbol("BRCA1");
gov.nih.nci.cabio.domain.Gene[] results = client.findGenesSharePathways(gene);

for (int i = 0; i < results.length; i++) {
          System.out.println(results[i].getSymbol());
}
  • Save the Modified Client
Last edited by
Sarah Honacki (1172 days ago)
Adaptavist Theme Builder Powered by Atlassian Confluence