use of org.vcell.api.common.BiomodelRepresentation in project vcell by virtualcell.
the class VCellModelService method getModels.
public Task<List<VCellModel>, String> getModels(VCellService vCellService) {
final Task<List<VCellModel>, String> task = new Task<List<VCellModel>, String>() {
@Override
protected List<VCellModel> doInBackground() throws Exception {
boolean bIgnoreCertProblems = true;
boolean bIgnoreHostMismatch = true;
VCellApiClient vCellApiClient = null;
List<VCellModel> vCellModels = new ArrayList<VCellModel>();
try {
vCellApiClient = new VCellApiClient(HOST, PORT, bIgnoreCertProblems, bIgnoreHostMismatch);
vCellApiClient.authenticate("ImageJ", "richarddberlin", false);
BioModelsQuerySpec querySpec = new BioModelsQuerySpec();
querySpec.owner = "tutorial";
final BiomodelRepresentation[] biomodelReps = vCellApiClient.getBioModels(querySpec);
final int modelsToLoad = biomodelReps.length;
int modelsLoaded = 0;
for (BiomodelRepresentation biomodelRep : biomodelReps) {
setSubtask(biomodelRep.getName());
ApplicationRepresentation[] applicationReps = biomodelRep.getApplications();
if (applicationReps.length > 0) {
String vcml = getVCML(biomodelRep);
if (vcml != null) {
SBMLDocument sbml = vCellService.getSBML(vcml, applicationReps[0].getName());
VCellModel vCellModel = new VCellModel(biomodelRep.getName(), biomodelRep.getBmKey(), sbml);
vCellModels.add(vCellModel);
modelsLoaded++;
setProgress(modelsLoaded * 100 / modelsToLoad);
} else {
System.err.println("failed to return VCML for " + biomodelRep.bmKey);
}
}
}
} catch (Exception e) {
e.printStackTrace(System.out);
}
return vCellModels;
}
};
return task;
}
Aggregations