Gui option for Cello Modeling
Added neccesary changes to make cello modeling an option for the user through the Gui interface
This commit is contained in:
parent
299bf44d17
commit
e301b76604
5 changed files with 71 additions and 32 deletions
|
|
@ -4586,7 +4586,8 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
// // TODO Auto-generated catch block
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
generateSBMLFromSBOL(selection, root);
|
||||
//TODO PEDRO revisit what boolean value to input here
|
||||
generateSBMLFromSBOL(selection, root, false);
|
||||
// TODO: update to attachment class
|
||||
String sedmlFile = null;
|
||||
for (Attachment attachment : selection.getAttachments()) {
|
||||
|
|
@ -4719,7 +4720,8 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
String filePath = filename.trim();
|
||||
org.sbolstandard.core2.SBOLDocument inputSBOLDoc = SBOLReader.read(new FileInputStream(filePath));
|
||||
inputSBOLDoc.setDefaultURIprefix(SBOLEditorPreferences.INSTANCE.getUserInfo().getURI().toString());
|
||||
int numGeneratedSBML = generateSBMLFromSBOL(inputSBOLDoc, filePath);
|
||||
//TODO PEDRO revisit what boolean value to input here
|
||||
int numGeneratedSBML = generateSBMLFromSBOL(inputSBOLDoc, filePath, false);
|
||||
getSBOLDocument().createCopy(inputSBOLDoc);
|
||||
writeSBOLDocument();
|
||||
JOptionPane.showMessageDialog(frame, "Successfully Imported SBOL file containing: \n"
|
||||
|
|
@ -5944,10 +5946,11 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
chosenDesign = s.getSelection();
|
||||
}
|
||||
|
||||
boolean celloModel = s.isCelloModel();
|
||||
|
||||
if(s.isVPRGenerator())
|
||||
{
|
||||
runVPRGenerator(filePath, fileName, chosenDesign);
|
||||
runVPRGenerator(filePath, fileName, chosenDesign, celloModel);
|
||||
}
|
||||
else if(s.isSBOLDesigner())
|
||||
{
|
||||
|
|
@ -5962,7 +5965,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
* @param fileName - The name of the SBOL file that the given SBOLDocument was created from.
|
||||
* @param chosenDesign - The chosen design that the user would like to perform VPR Model Generation from.
|
||||
*/
|
||||
private void runVPRGenerator(String filePath, String fileName, SBOLDocument chosenDesign)
|
||||
private void runVPRGenerator(String filePath, String fileName, SBOLDocument chosenDesign, boolean CelloModel)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
|
@ -5993,7 +5996,7 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
|
||||
VPRModelGenerator.generateModel(selectedRepo, chosenDesign, circuitID);
|
||||
//update SBOL library file with newly generated components that vpr model generator created.
|
||||
generateSBMLFromSBOL(chosenDesign, filePath);
|
||||
generateSBMLFromSBOL(chosenDesign, filePath, CelloModel);
|
||||
// TODO: should be using libSBOLj for this
|
||||
SBOLUtility.copyAllTopLevels(chosenDesign, sbolDocument);
|
||||
writeSBOLDocument();
|
||||
|
|
@ -6173,14 +6176,14 @@ public class Gui implements BioObserver, MouseListener, ActionListener, MouseMot
|
|||
* @param filePath - The file location where the SBOL document is located.
|
||||
* @return The number of SBML models that was converted from SBOL.
|
||||
*/
|
||||
public int generateSBMLFromSBOL(SBOLDocument inputSBOLDoc, String filePath) {
|
||||
public int generateSBMLFromSBOL(SBOLDocument inputSBOLDoc, String filePath, boolean CelloModel) {
|
||||
int numGeneratedSBML = 0;
|
||||
try {
|
||||
for (ModuleDefinition moduleDef : inputSBOLDoc.getRootModuleDefinitions()) {
|
||||
if (moduleDef.getModels().size()==0) {
|
||||
HashMap<String,BioModel> models;
|
||||
try {
|
||||
models = SBOL2SBML.generateModel(root, moduleDef, inputSBOLDoc);
|
||||
models = SBOL2SBML.generateModel(root, moduleDef, inputSBOLDoc, CelloModel);
|
||||
for (BioModel model : models.values()) {
|
||||
if (overwrite(root + File.separator + model.getSBMLDocument().getModel().getId() + ".xml",
|
||||
model.getSBMLDocument().getModel().getId() + ".xml")) {
|
||||
|
|
|
|||
|
|
@ -106,13 +106,15 @@ public class SBOLInputDialog extends InputDialog<SBOLDocument> {
|
|||
private static final Part ALL_PARTS = new Part("All parts", "All");
|
||||
|
||||
private JCheckBox showRootDefs;
|
||||
private JCheckBox celloModel;
|
||||
|
||||
private JRadioButton showModDefs, showCompDefs;
|
||||
|
||||
private JButton openSBOLDesigner, openVPRGenerator, optionsButton; //, cancelButton;
|
||||
|
||||
private SBOLDocument sbolDesigns;
|
||||
|
||||
private boolean sbolDesigner, vprGenerator;
|
||||
private boolean sbolDesigner, vprGenerator, CelloModel;
|
||||
|
||||
/**
|
||||
* An instance of the SBOL Design/Part selection dialog that will allow the user to open their selected design
|
||||
|
|
@ -213,6 +215,23 @@ public class SBOLInputDialog extends InputDialog<SBOLDocument> {
|
|||
filteredDesignPanel.add(showRootDefs);
|
||||
builder.add("", filteredDesignPanel);
|
||||
|
||||
celloModel = new JCheckBox("Cello Modeling");
|
||||
celloModel.setSelected(false);
|
||||
celloModel.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
if (celloModel.isSelected()) {
|
||||
CelloModel = true;
|
||||
}
|
||||
else if (!celloModel.isSelected()) {
|
||||
CelloModel = false;
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
filteredDesignPanel.add(celloModel);
|
||||
builder.add("", filteredDesignPanel);
|
||||
|
||||
typeSelection = new JComboBox<Types>(Types.values());
|
||||
typeSelection.setSelectedItem(Types.DNA);
|
||||
typeSelection.addActionListener(new ActionListener() {
|
||||
|
|
@ -406,6 +425,18 @@ public class SBOLInputDialog extends InputDialog<SBOLDocument> {
|
|||
return outputDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if Cello Modeling is to be performed
|
||||
*/
|
||||
public boolean isCelloModel() {
|
||||
|
||||
if (CelloModel == true) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private void updateRoleRefinement()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -586,7 +586,8 @@ public class SynthesisView extends JTabbedPane implements ActionListener, Runnab
|
|||
List<String> solutionFileIDs = new ArrayList<String>();
|
||||
for (ModuleDefinition moduleDef : solution.getRootModuleDefinitions())
|
||||
{
|
||||
HashMap<String,BioModel> models = SBOL2SBML.generateModel(solution_dir, moduleDef, solution);
|
||||
//TODO PEDRO revisit what boolean value to input here
|
||||
HashMap<String,BioModel> models = SBOL2SBML.generateModel(solution_dir, moduleDef, solution, false);
|
||||
solutionFileIDs.addAll(SBMLutilities.exportMultSBMLFile(models, solution_dir));
|
||||
}
|
||||
return solutionFileIDs;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue