Use of the DTP JAVA classes requires DTPDatawarehouse.jar and the JDBC drivers for the database(s) that will be used (oracle.jar and/or postgresql.jar). If chemical structures are used, additional jars are necessary: DTPcml2.jar, xmlParserAPIs.jar, and xercesImpl.jar. The last two jars are from Apache XML Project. The first is part of the CML Document Object Model (CML DOM) from the Chemical Markup Language project. The integration of these jars with the DTP Datawarehouse project is still being worked on and subject to change. Contact Dan Zaharevitz for up to the minute details.
import gov.nih.nci.dtp.jdbc.*;
DTPConnect db = new DTPConnect(); db.makeConnect();Note: the identity of the default database is contained in the gov.nih.nci.dtp.jdbc.DTPjdbc.properties file. This file can be changed without the need to recompile the class.
oracle or postgres
DTPConnect db = new DTPConnect(host, datab, port, usr, pwd, dtype); db.makeConnect();
DTPConnect db = new DTPConnect();
DbLogin dlog = new DbLogin(null);
dlog.showDialog(db);
db.makeConnect();
import gov.nih.nci.dtp.*;
NSC nsc1 = new NSC(123127);
String strg = "123127";
NSC nsc2 = new NSC(strg);
CAS cas1 = new CAS(59052);
String strg = "59-05-2";
CAS cas2 = new CAS(strg);
NCICellLine cell1 = new NCICellLine(5,14,"Breast","T-47D");
import gov.nih.nci.dtp.db.*;
DTPConnect db = new DTPConnect(); db.makeConnect(); DTPTestmaster chemnames = new DTPTestmaster(DTPConstants.CHEMNAMEDATA, db);for more constants that predefine standard data sets, see DTPConstants
DTPConnect db = new DTPConnect();
db.makeConnect();
DTPTestmaster chemnames = new DTPTestmaster(DTPConstants.CHEMNAMEDATA, db);
DTPResultSearch search = new DTPResultSearch();
NSC nsc1 = new NSC(123127);
DTPTestResult [] names = search.getData(chemnames, nsc1);
for ( int idx=0; idx < names.length; idx++)
{
System.out.println("Chemical Name is " + names[idx].getTextResult() );
}
import gov.nih.nci.dtp.structures.DBStoCML;
and the classes from the CML-DOM
import org.xmlcml.cml.CMLMolecule;
import org.xmlcml.cmlimpl.DocumentFactoryImpl;
import org.xmlcml.cml.CMLException;
import org.xmlcml.legacy.molecule.MDLConverter;
import org.xmlcml.cml.CMLList;
DTPConnect db = new DTPConnect();
db.makeConnect();
DTPTestmaster chem2D = new DTPTestmaster(DTPConstants.CHEM_2DDATA, db);
DTPResultSearch search = new DTPResultSearch();
NSC nsc1 = new NSC(123127);
DBStoCML dbsReader = new DBStoCML(db);
AbstractCMLDocument multiDoc = (AbstractCMLDocument) DocumentFactoryImpl.newInstance().createDocument();
DTPTestResult [] result_2D = search.getData(chem2D, nsc1);
if ( result_2D.length > 0 )
{
/* Note that there may be more than one structure returned for this call.
Use of the priority field means that the first one will be the "best"
version almost certainly the structure to use when one structure is called for,
but it is possible to get all the structures and compare.
*/
StructureNbr snbr = result_2D[0].getStructNbr();
if ( snbr.idValue() != 0 )
{
CMLMolecule mol = null;
try
{
mol = dbsReader.ReadStructure(snbr);
}
catch (Exception ex)
{
System.out.println("2D structure retrieve failed\n" + ex.getMessage());
}
if ( mol != null )
{
/* write out as CML */
mol.writeXML(xmlfile);
/* write out as MDL mol file */
MDLConverter mdlcv = new MDLConverter();
try
{
mdlcv.write(mdlfile, mol);
}
catch (Exception ex)
{
System.out.println("ERROR writing Mol file");
System.out.print(ex);
}
}
else
{
System.out.println("Null 2D structure retrieved for NSC " + nsc1.idValue());
}
}
else
{
System.out.println("2D Structure number is zero for NSC " + nsc1.idValue());
}
}
else
{
System.out.println("No 2D structures found for NSC " + idValue());
}