use of cbit.vcell.biomodel.meta.VCMetaData in project vcell by virtualcell.
the class ObservablePropertiesPanel method updateInterface.
private void updateInterface() {
boolean bNonNullObservable = observable != null && bioModel != null;
// annotationTextArea.setEditable(bNonNullObservable);
if (bNonNullObservable) {
VCMetaData vcMetaData = bioModel.getModel().getVcMetaData();
// annotationTextArea.setText(vcMetaData.getFreeTextAnnotation(observable));
} else {
// annotationTextArea.setText(null);
}
updateShape();
}
use of cbit.vcell.biomodel.meta.VCMetaData in project vcell by virtualcell.
the class DocumentWindow method showEditAnnotationWindow.
// /**
// * Comment
// */
// private void showBNGWindow() {
// getWindowManager().showBNGWindow();
// }
/**
* Comment
*/
private void showEditAnnotationWindow() {
try {
if (getWindowManager() != null) {
VCDocument vcDoc = getWindowManager().getVCDocument();
if (vcDoc != null) {
try {
// initialize fields - different for biomodel and mathmodel, geometry
String oldAnnotation = null;
if (vcDoc instanceof BioModel) {
oldAnnotation = ((BioModel) vcDoc).getVCMetaData().getFreeTextAnnotation((BioModel) vcDoc);
} else {
oldAnnotation = vcDoc.getDescription();
}
// show the editor
String newAnnotation = DialogUtils.showAnnotationDialog(this, oldAnnotation);
if (org.vcell.util.BeanUtils.triggersPropertyChangeEvent(oldAnnotation, newAnnotation)) {
// if VCDocument is a Biomodel, set the vcMetadata, else edit VCDoc.description for now
if (vcDoc instanceof BioModel) {
// update free text annotation in VCMetaData
VCMetaData vcMetaData = ((BioModel) vcDoc).getVCMetaData();
vcMetaData.setFreeTextAnnotation((BioModel) vcDoc, newAnnotation);
} else {
// Update VCDocument annotation
vcDoc.setDescription(newAnnotation);
}
}
} catch (UtilCancelException e) {
// Do Nothing
}
} else {
throw new Exception("No Document to Edit");
}
}
} catch (Throwable exc) {
exc.printStackTrace(System.out);
PopupGenerator.showErrorDialog(this, "Failed to edit annotation!\n" + exc.getMessage(), exc);
}
}
use of cbit.vcell.biomodel.meta.VCMetaData in project vcell by virtualcell.
the class ReactionRuleKineticsPropertiesPanel method updateInterface.
protected void updateInterface() {
boolean bNonNullRule = reactionRule != null && bioModel != null;
// annotationTextArea.setEditable(bNonNullRule);
// getKineticsTypeComboBox().setEnabled(bNonNullRule); // TODO: here!!!
// TODO: here!!!
getKineticsTypeComboBox().setEnabled(false);
if (bNonNullRule) {
// initKineticChoices();
VCMetaData vcMetaData = bioModel.getModel().getVcMetaData();
// annotationTextArea.setText(vcMetaData.getFreeTextAnnotation(reactionRule));
nameTextField.setEditable(true);
nameTextField.setText(reactionRule.getName());
getKineticsTypeComboBox().setSelectedItem(getRateLawType(reactionRule.getKineticLaw()));
if (reactionRule.getKineticLaw().getRateLawType() == RateLawType.Saturable) {
isReversibleCheckBox.setSelected(false);
isReversibleCheckBox.setEnabled(false);
} else if (reactionRule.getKineticLaw().getRateLawType() == RateLawType.MichaelisMenten) {
isReversibleCheckBox.setSelected(false);
isReversibleCheckBox.setEnabled(false);
} else {
// MassAction
isReversibleCheckBox.setSelected(reactionRule.isReversible());
isReversibleCheckBox.setEnabled(true);
}
} else {
// annotationTextArea.setText(null);
nameTextField.setEditable(false);
nameTextField.setText(null);
isReversibleCheckBox.setSelected(false);
isReversibleCheckBox.setEnabled(true);
}
listLinkedPathwayObjects();
}
use of cbit.vcell.biomodel.meta.VCMetaData in project vcell by virtualcell.
the class AnnotationMapping method getRefInfo.
private HashMap<String, String> getRefInfo(BioModel bioModel, Identifiable identifiable) {
HashMap<String, String> info = new HashMap<String, String>();
VCMetaData vcMetaData = bioModel.getVCMetaData();
MiriamManager miriamManager = vcMetaData.getMiriamManager();
TreeMap<Identifiable, Map<MiriamRefGroup, MIRIAMQualifier>> miriamDescrHeir = miriamManager.getMiriamTreeMap();
Map<MiriamRefGroup, MIRIAMQualifier> refGroupMap = miriamDescrHeir.get(identifiable);
if (refGroupMap != null) {
for (MiriamRefGroup refGroup : refGroupMap.keySet()) {
MIRIAMQualifier qualifier = refGroupMap.get(refGroup);
String[] quaTemp = qualifier.toString().split("/");
String bioQualifier = quaTemp[quaTemp.length - 1];
bioQualifier = bioQualifier.substring(0, bioQualifier.length() - 1);
for (MiriamResource miriamResource : refGroup.getMiriamRefs()) {
String refSource = miriamResource.getMiriamURN();
String[] temp = refSource.split(":");
String sourceInfo = temp[2] + ":" + bioQualifier;
String refId = miriamResource.getIdentifier();
info.put(refId, sourceInfo);
// System.out.println(refId + "*********" + sourceInfo);
}
}
}
return info;
}
use of cbit.vcell.biomodel.meta.VCMetaData in project vcell by virtualcell.
the class PathwayMapping method createMolecularTypeFromBioPaxObject.
// TODO: not in use
// public void createBioModelEntitiesFromBioPaxObjects(BioModel bioModel, Object[] selectedObjects) throws Exception
// {
// for(int i = 0; i < selectedObjects.length; i++) {
// if(selectedObjects[i] instanceof BioPaxObject) {
// BioPaxObject bioPaxObject = (BioPaxObject)selectedObjects[i];
// if(bioPaxObject instanceof PhysicalEntity && !(bioPaxObject instanceof Complex)) {
// createMolecularTypeFromBioPaxObject(bioModel, (PhysicalEntity)bioPaxObject);
// }
// } else if(selectedObjects[i] instanceof ConversionTableRow) {
// ConversionTableRow ctr = (ConversionTableRow)selectedObjects[i];
// if(ctr.getBioPaxObject() instanceof PhysicalEntity && !(ctr.getBioPaxObject() instanceof Complex)) {
// createMolecularTypeFromBioPaxObject(bioModel, (PhysicalEntity)ctr.getBioPaxObject());
// }
// }
// }
//
// for(int i = 0; i < selectedObjects.length; i++) {
// if(selectedObjects[i] instanceof BioPaxObject) {
// BioPaxObject bioPaxObject = (BioPaxObject)selectedObjects[i];
// if(bioPaxObject instanceof PhysicalEntity) {
// createSpeciesContextFromBioPaxObject(bioModel, (PhysicalEntity)bioPaxObject);
// } else if(bioPaxObject instanceof Conversion) {
// createReactionStepsFromBioPaxObject(bioModel, (Conversion)bioPaxObject);
// }
// } else if(selectedObjects[i] instanceof ConversionTableRow) {
// ConversionTableRow ctr = (ConversionTableRow)selectedObjects[i];
// if(ctr.getBioPaxObject() instanceof PhysicalEntity) {
// createSpeciesContextFromTableRow(bioModel, (PhysicalEntity)ctr.getBioPaxObject(), ctr.stoich(), ctr.id(), ctr.location());
// } else if(ctr.getBioPaxObject() instanceof Conversion) {
// createReactionStepsFromTableRow(bioModel, (Conversion)ctr.getBioPaxObject(), ctr.stoich(), ctr.id(), ctr.location());
// }
// }
// }
// }
private MolecularType createMolecularTypeFromBioPaxObject(BioModel bioModel, PhysicalEntity bioPaxObject, boolean addSubunits) {
String name;
if (bioPaxObject.getName().size() == 0) {
name = getSafetyName(bioPaxObject.getID());
} else {
name = getSafetyName(bioPaxObject.getName().get(0));
}
RbmModelContainer rbmmc = bioModel.getModel().getRbmModelContainer();
if (rbmmc.getMolecularType(name) != null) {
// already exists
MolecularType mt = rbmmc.getMolecularType(name);
// check whether it links to pathway object, create relationship object if not
if (!bioModel.getRelationshipModel().isRelationship(mt, bioPaxObject)) {
RelationshipObject ro = new RelationshipObject(mt, bioPaxObject);
bioModel.getRelationshipModel().addRelationshipObject(ro);
}
return mt;
}
int numSubunits = 0;
if (addSubunits) {
for (String comment : bioPaxObject.getComments()) {
numSubunits = StringUtils.countMatches(comment, "SUBUNIT:");
}
}
MolecularType mt = new MolecularType(name, bioModel.getModel());
try {
for (int i = 0; i < numSubunits; i++) {
MolecularComponent mc = new MolecularComponent("Subunit" + i);
mt.addMolecularComponent(mc);
}
rbmmc.addMolecularType(mt, true);
// we know for sure that a relationship can't exist, so we make one
RelationshipObject ro = new RelationshipObject(mt, bioPaxObject);
bioModel.getRelationshipModel().addRelationshipObject(ro);
} catch (ModelException | PropertyVetoException e) {
e.printStackTrace();
}
ArrayList<String> commentList = bioPaxObject.getComments();
final String htmlStart = "<html><font face = \"Arial\"><font size =\"-2\">";
final String htmlEnd = "</font></font></html>";
if (commentList != null && !commentList.isEmpty()) {
String comment = commentList.get(0);
if (!comment.isEmpty()) {
String text = FormatDetails(comment);
mt.setComment(htmlStart + text + htmlEnd);
}
} else {
mt.setComment("");
}
VCMetaData vcMetaData = bioModel.getVCMetaData();
MiriamManager miriamManager = vcMetaData.getMiriamManager();
MIRIAMQualifier qualifier = MIRIAMQualifier.MODEL_isDescribedBy;
ArrayList<Xref> xrefList = bioPaxObject.getxRef();
for (Xref xref : xrefList) {
String url = xref.getURL();
if (url == null || url.isEmpty()) {
continue;
}
System.out.println(xref.getDb() + ": " + xref.getId());
try {
HashSet<MiriamResource> miriamResources = new HashSet<MiriamResource>();
// http://www.ncbi.nlm.nih.gov/protein/NP_005429 unrecognized (not a valid DataType)
// http://www.uniprot.org/uniprot/P17275 good
// TODO: find a mechanism to store the unrecognized ones - they often do work
MiriamResource mr = miriamManager.createMiriamResource(url);
miriamResources.add(mr);
miriamManager.addMiriamRefGroup(mt, qualifier, miriamResources);
} catch (URNParseFailureException e) {
e.printStackTrace();
}
System.out.println(xref.getDisplayName());
}
return mt;
}
Aggregations