use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class BioModelTestReader method visitBioModel.
public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
KeyValue currentKey = bioModel.getVersion().getVersionKey();
BioModelInfo bmInfo = bioModelInfoHash.get(currentKey);
logFilePrintStream.append(" == SUCEEDED IN READING BIOMODEL " + bmInfo.getVersion().getName() + "; key : " + currentKey.toString() + "\n");
unparsedBioModels.remove(currentKey);
for (Iterator<KeyValue> iterator = unparsedBioModels.iterator(); iterator.hasNext(); ) {
KeyValue key = iterator.next();
bmInfo = bioModelInfoHash.get(key);
logFilePrintStream.append(" == FAILED TO READ BIOMODEL : " + bmInfo.getVersion().getName() + "; key : " + key.toString() + "\n");
iterator.remove();
}
return;
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class RuleBasedTest method main.
public static void main(String[] args) {
try {
PropertyLoader.loadProperties();
} catch (Exception e) {
e.printStackTrace();
}
final int numTrials = 40;
VCDatabaseVisitor vcDatabaseVisitor = new VCDatabaseVisitor() {
@Override
public void visitMathModel(MathModel mathModel, PrintStream logFilePrintStream) {
throw new IllegalArgumentException("Not Implemented");
}
@Override
public void visitGeometry(Geometry geometry, PrintStream logFilePrintStream) {
throw new IllegalArgumentException("Not Implemented");
}
@Override
public void visitBioModel(BioModel bioModel, PrintStream logFilePrintStream) {
SimulationContext[] simulationContexts = bioModel.getSimulationContexts();
for (SimulationContext simContext : simulationContexts) {
if ((simContext.getApplicationType() == Application.NETWORK_STOCHASTIC) && simContext.getGeometry().getDimension() == 0) {
File baseDirectory = createDirFile(simContext);
try {
checkNonspatialStochasticSimContext(simContext, baseDirectory, numTrials);
} catch (Exception e) {
e.printStackTrace();
if (!e.getMessage().contains("Only Mass Action Kinetics supported ")) {
writeMessageTofile(baseDirectory, e.getMessage());
}
}
}
}
}
@Override
public boolean filterMathModel(MathModelInfo mathModelInfo) {
return false;
}
@Override
public boolean filterGeometry(GeometryInfo geometryInfo) {
return false;
}
@Override
public boolean filterBioModel(BioModelInfo bioModelInfo) {
return // bioModelInfo.getVersion().getName().equals("model");
bioModelInfo.getVersion().getName().equals("simpleModel_Network_orig");
}
};
String currentUserID = "schaff";
String[] allUsers = new String[] { /*-all*/
currentUserID, "-" };
VCDatabaseScanner.scanBioModels(allUsers, vcDatabaseVisitor, false);
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class LoginChecker method attemptLogin.
private static boolean attemptLogin(SiteInfo si, String user, String password) {
long start = 0;
try {
if (VERBOSE) {
start = System.currentTimeMillis();
}
String url = si.bootStrapUrl();
VCellBootstrap vcellBootstrap = (VCellBootstrap) java.rmi.Naming.lookup(url);
DigestedPassword dp = new UserLoginInfo.DigestedPassword(password);
UserLoginInfo uli = new UserLoginInfo(user, dp);
VCellConnection vcellConnection = vcellBootstrap.getVCellConnection(uli);
if (vcellConnection == null) {
if (VERBOSE) {
System.out.println("no connection on " + si + " in " + elapsed(start) + " seconds");
}
return false;
}
UserMetaDbServer dataServer = vcellConnection.getUserMetaDbServer();
@SuppressWarnings("unused") BioModelInfo[] bmi = dataServer.getBioModelInfos(true);
if (VERBOSE) {
System.out.println("success on " + si + " in " + elapsed(start) + " seconds");
}
return true;
} catch (MalformedURLException e) {
e.printStackTrace();
throw new Error("bad code");
} catch (Exception e) {
if (VERBOSE) {
System.out.println("failed in " + elapsed(start) + " seconds");
}
e.printStackTrace();
return false;
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class ClientRobot method run.
/**
* Insert the method's description here.
* Creation date: (3/8/01 3:04:15 PM)
*/
public void run() {
try {
String[] args = { host, userid, password };
setManagerManager(cbit.vcell.client.test.ClientTester.mainInit(args, "ClientRobot", null));
for (int i = 0; i < 10; i++) {
log.print("Robot " + getName() + "starting loop : " + i);
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelFile));
String newName = "bioModel_" + getName() + "_" + Math.random();
log.print("Saving bioModel \"" + newName + "\"");
getManagerManager().getDocumentManager().saveAsNew(bioModel, newName, null);
BioModelInfo[] bioModelInfos = getManagerManager().getDocumentManager().getBioModelInfos();
if (bioModelInfos != null && bioModelInfos.length > 0) {
for (int j = 0; j < bioModelInfos.length; j++) {
log.print("bioModelInfo[" + j + "] = " + bioModelInfos[j]);
}
}
}
} catch (Throwable e) {
log.exception(e);
} finally {
log.alert("Robot " + getName() + " exiting");
}
}
use of org.vcell.util.document.BioModelInfo in project vcell by virtualcell.
the class SBMLExportTest method getBiomodelByName.
static BioModel getBiomodelByName(VCellConnection vcn, String name) throws RemoteProxyException, DataAccessException, XmlParseException {
EscapedName eName = new EscapedName(name);
UserMetaDbServer dataServer = vcn.getUserMetaDbServer();
for (BioModelInfo bmi : dataServer.getBioModelInfos(false)) {
String mName = bmi.getVersion().getName();
if (eName.matches(mName)) {
KeyValue bioModelKey = bmi.getVersion().getVersionKey();
BigString bioModelXML = dataServer.getBioModelXML(bioModelKey);
BioModel bioModel = XmlHelper.XMLToBioModel(new XMLSource(bioModelXML.toString()));
return bioModel;
}
}
// if not found, list what's available
for (BioModelInfo bmi : dataServer.getBioModelInfos(false)) {
String mName = bmi.getVersion().getName();
System.out.println(mName);
}
return null;
}
Aggregations