本文整理汇总了Java中org.sbolstandard.core2.ComponentDefinition类的典型用法代码示例。如果您正苦于以下问题:Java ComponentDefinition类的具体用法?Java ComponentDefinition怎么用?Java ComponentDefinition使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ComponentDefinition类属于org.sbolstandard.core2包,在下文中一共展示了ComponentDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processDNAComponents
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
private void processDNAComponents(SBase sbmlElement, SBOLFileManager fileManager) throws SBOLException {
//NOTE: Get all DnaComponent
AnnotationUtility.parseSBOLAnnotation(sbmlElement, compURIs);
List<ComponentDefinition> dnaComps = fileManager.resolveURIs(compURIs);
nucleotideCount = SBOLUtility.countNucleotides(dnaComps);
Set<URI> soFilterTypes = new HashSet<URI>();
soFilterTypes.add(SequenceOntology.CDS);
soFilterTypes.add(SequenceOntology.PROMOTER);
//NOTE: get dnaComps with the specified SO types of CDS and PROMOTER.
List<ComponentDefinition> signalComps = SBOLUtility.filterDNAComponents(dnaComps, soFilterTypes);
//TODO: Why only get the first DnaComponent signal? Assume that signalComps always return 1 or 0?
if (signalComps.size() > 0)
signal = signalComps.get(0).getIdentity().toString(); //TODO: signal will store the uri of the 1st DnaComponent?
else
signal = "";
}
示例2: createGeneComponent
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
public static FunctionalComponent createGeneComponent(String geneID, AccessType access, DirectionType direction,
ModuleDefinition moduleDef, SBOLDocument sbolDoc, String defaultURIPrefix) {
FunctionalComponent gene = createDNAComponent(geneID, MyersOntology.GENE, access, direction,
moduleDef, sbolDoc, defaultURIPrefix);
ComponentDefinition geneDef = sbolDoc.getComponentDefinition(gene.getDefinitionURI());
Component rbs = createRBSComponent("RBS", AccessType.PRIVATE, geneDef, sbolDoc, defaultURIPrefix);
String cdsID = geneID;
if (cdsID.equals("rfp")) {
cdsID = "c" + cdsID.toUpperCase();
} else {
cdsID = "c" + cdsID.substring(0, 1).toUpperCase() + geneID.substring(1);
}
Component cds = createCDSComponent(cdsID, AccessType.PRIVATE, geneDef, sbolDoc, defaultURIPrefix);
Component terminator = createTerminatorComponent("Terminator", AccessType.PRIVATE, geneDef, sbolDoc, defaultURIPrefix);
int constraintCount = 1;
createPrecedes(constraintCount, rbs, cds, geneDef);
constraintCount++;
createPrecedes(constraintCount, cds, terminator, geneDef);
return gene;
}
示例3: resolveURIs
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
public List<ComponentDefinition> resolveURIs(List<URI> uris) throws SBOLException {
boolean error = false;
List<ComponentDefinition> resolvedComps = new LinkedList<ComponentDefinition>();
for (URI uri : uris) {
ComponentDefinition resolvedComp = null;
resolvedComp = SBOLDOC.getComponentDefinition(uri);
if (resolvedComp == null) {
error = true;
resolvedComps.clear();
String message = "DNA component with URI " + uri.toString() +
" could not be found in project SBOL files.";
String messageTitle = "DNA Component Not Found";
throw new SBOLException(message, messageTitle);
}
else if (!error)
resolvedComps.add(resolvedComp);
}
return resolvedComps;
}
示例4: saveDNAComponent
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
public void saveDNAComponent(ComponentDefinition dnaComp, SBOLIdentityManager identityManager, SBOLDocument tempSbolDoc) throws SBOLValidationException, FileNotFoundException, SBOLConversionException {
BioModel biomodel = identityManager.getBioModel();
String targetFilePath = biomodel.getSBOLSaveFilePath();
if (biomodel.getSBOLSaveFilePath() != null)
targetFilePath = biomodel.getSBOLSaveFilePath();
else if (identityManager.getBioSimComponent() != null)
targetFilePath = "";
else
targetFilePath = fileDocMap.keySet().iterator().next();
// Save component to local SBOL files
for (String sbolFilePath : fileDocMap.keySet())
{
SBOLDocument sbolDoc = fileDocMap.get(sbolFilePath);
if (sbolFilePath.equals(targetFilePath))
{
for(Sequence s : tempSbolDoc.getSequences())
SBOLUtility.addSequence(s, sbolDoc, false);
for(ComponentDefinition c : tempSbolDoc.getComponentDefinitions())
SBOLUtility.addDNAComponent(c, sbolDoc, false);
}
SBOLUtility.writeSBOLDocument(sbolFilePath, sbolDoc);
System.out.println("Wrote sbolAnnot to this file: " + sbolFilePath);
}
}
示例5: recurseComponentDefinition
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Creates a copy of an SBOL ComponentDefintion from the given ComponentDefinition's Component if it does not already exist within the given SBOL Document.
*
* @param sbolDoc - The SBOL Document that will store the created ComponentDefintion.
* @param cd - The ComponentDefinition's Component to be created.
* @throws SBOLValidationException - SBOL validation exception while creating an SBOL object for SBML2SBOL conversion.
*/
private static void recurseComponentDefinition(SBOLDocument sbolDoc, ComponentDefinition cd) throws SBOLValidationException {
for (org.sbolstandard.core2.Component comp : cd.getComponents()) {
if (sbolDoc.getComponentDefinition(comp.getDefinitionURI()) == null) {
ComponentDefinition compDef = comp.getDefinition();
sbolDoc.createCopy(compDef);
for (Sequence sequence : compDef.getSequences()) {
if (sbolDoc.getSequence(sequence.getIdentity()) == null) {
sbolDoc.createCopy(sequence);
}
}
recurseComponentDefinition(sbolDoc,compDef);
}
}
}
示例6: annotateSpecies
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Annotate SBML species with SBOL component, component definition, and any existing, annotating
* DNA components or strand sign.
*
* @param species - The SBML species to be annotated with SBOL FunctionalComponent
* @param comp - The SBOL FunctionalComponent to be annotated into SBML species.
* @param sbolDoc - The SBOL Document that contains the SBOL FunctionalComponent to parse for annotation.
*/
private static void annotateSpecies(Species species, FunctionalComponent comp, SBOLDocument sbolDoc) {
SBOLAnnotation speciesAnno;
List<URI> dnaCompIdentities = new LinkedList<URI>();
String strand = AnnotationUtility.parseSBOLAnnotation(species, dnaCompIdentities);
if (strand != null && dnaCompIdentities.size() > 0) {
List<URI> sbolElementIdentities = new LinkedList<URI>();
sbolElementIdentities.add(comp.getDefinitionURI());
speciesAnno = new SBOLAnnotation(species.getMetaId(), comp.getClass().getSimpleName(),
sbolElementIdentities, dnaCompIdentities, strand);
} else {
speciesAnno = new SBOLAnnotation(species.getMetaId(), comp.getClass().getSimpleName(),
comp.getDefinitionURI());
}
ComponentDefinition compDef = sbolDoc.getComponentDefinition(comp.getDefinitionURI());
if (compDef!=null) {
speciesAnno.createSBOLElementsDescription(compDef.getClass().getSimpleName(),
compDef.getIdentity());
AnnotationUtility.setSBOLAnnotation(species, speciesAnno);
}
}
示例7: updateSBMLFieldsFromSBOL
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Update the following SBML fields after SBOL association has been performed.
* @param sbolObj - The associated SBOL object use to update the SBML fields.
*/
private void updateSBMLFieldsFromSBOL(TopLevel sbolObj)
{
associateObjName = sbolObj.getName();
/*
* There is no mapping from ModuleDefinition to the SBO term we use on the SBML Model.
* Map only ComponentDefinition SBO term to SBML.
*/
if(sbolObj instanceof ComponentDefinition)
{
ComponentDefinition compDef = (ComponentDefinition) sbolObj;
Set<URI> compDef_types = compDef.getTypes();
if(!compDef_types.isEmpty())
{
URI type = compDef_types.iterator().next();
associatedObjSBO = getSpeciesSBOTerm(type);
}
}
}
示例8: getSpeciesSBOTerm
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Get the equivalent SBML SBO term from the given SBOL SBO term
* @param sbolSBOTerm - The SBOL SBO term.
* @return The converted SBML SBO term.
*/
private String getSpeciesSBOTerm(URI sbolSBOTerm)
{
if(sbolSBOTerm.equals(ComponentDefinition.DNA))
{
return GlobalConstants.SBO_DNA_SEGMENT;
}
else if(sbolSBOTerm.equals(ComponentDefinition.RNA))
{
return GlobalConstants.SBO_RNA_SEGMENT;
}
else if(sbolSBOTerm.equals(ComponentDefinition.PROTEIN))
{
return GlobalConstants.SBO_PROTEIN;
}
else if(sbolSBOTerm.equals(ComponentDefinition.COMPLEX))
{
return GlobalConstants.SBO_NONCOVALENT_COMPLEX;
}
else if(sbolSBOTerm.equals(ComponentDefinition.SMALL_MOLECULE))
{
return GlobalConstants.SBO_SIMPLE_CHEMICAL;
}
return GlobalConstants.SBO_PROTEIN; //default case if no SBOL term was given
}
示例9: getAssociatedSBOL_Obj
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Return the associated SBOL object that is to be annotated on the given SBML element.
* If the SBOL element can't be found, null is returned.
* @param workingDoc - The SBOLDocument to get the SBOL element to be annotated on the SBML element.
* @return The SBOL object. Null is returned if no the SBOL object could not be found in the workingDoc.
*/
private TopLevel getAssociatedSBOL_Obj(String filePath, SBOLDocument workingDoc)
{
URI sbolObjURI = sbolURIs.get(0); //There can be only one SBOL object associated to an SBML element.
if(isComponentDefinition)
{
ComponentDefinition cd = workingDoc.getComponentDefinition(sbolObjURI);
if (cd == null) {
JOptionPane.showMessageDialog(getParent(), "Can't find " + sbolObjURI + " in " + filePath);
return null;
}
return cd;
}
else if(isModuleDefinition)
{
ModuleDefinition modDef = workingDoc.getModuleDefinition(sbolObjURI);
if (modDef == null)
{
JOptionPane.showMessageDialog(getParent(), "Can't find" + sbolObjURI + " in " + filePath);
return null;
}
return modDef;
}
return null;
}
示例10: editSBOL
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* use PartEditDialog to edit/view the part
* @param filePath - full path to SBOL file
* @param workingDoc - The SBOLDocument that contain all parts that the user can use to associate SBOL.
*/
private void editSBOL(String filePath, SBOLDocument workingDoc)
{
TopLevel sbolObj = getAssociatedSBOL_Obj(filePath, workingDoc);
TopLevel editedSBOLObj = null;
if(isComponentDefinition)
{
ComponentDefinition cd = (ComponentDefinition) sbolObj;
ComponentDefinition editedCD = PartEditDialog.editPart(getParent(), cd, true, true, workingDoc);
if (editedCD == null) {
// nothing was changed
return;
}
editedSBOLObj = editedCD;
}
else if(isModuleDefinition)
{
ModuleDefinition md = (ModuleDefinition) sbolObj;
//TODO: implement a dialog for getting ModuleDefinition parts.
}
setAssociatedSBOL(filePath, workingDoc, editedSBOLObj);
}
示例11: loadBioSimComponentDescriptors
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
private boolean loadBioSimComponentDescriptors(SBOLIdentityManager identityManager, SBOLFileManager fileManager) {
try {
if (identityManager.loadAndLocateBioSimComponent(fileManager)) {
ComponentDefinition bioSimComp = identityManager.getBioSimComponent();
if (bioSimComp != null) {
saveFileIDBox.setSelectedIndex(saveFilePaths.indexOf(identityManager.getSaveFilePath()));
initialID = bioSimComp.getDisplayId();
idText.setText(initialID);
if (bioSimComp.getName() != null)
nameText.setText(bioSimComp.getName());
if (bioSimComp.getDescription() != null)
descriptionText.setText(bioSimComp.getDescription());
} else
removeBioSimURI = true;
return true;
}
} catch (SBOLException e) {
JOptionPane.showMessageDialog(Gui.frame, e.getMessage(),
e.getTitle(), JOptionPane.ERROR_MESSAGE);
e.printStackTrace();
}
return false;
}
示例12: getRefinementRoles
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Returns a list of all roles of a CD that are descendants of the part's
* role.
*/
public static List<URI> getRefinementRoles(Identified comp, Part part) {
ArrayList<URI> list = new ArrayList<URI>();
SequenceOntology so = new SequenceOntology();
Set<URI> roles;
if (comp instanceof ComponentDefinition) {
roles = ((ComponentDefinition) comp).getRoles();
} else if (comp instanceof Component) {
roles = ((Component) comp).getRoles();
} else if (comp instanceof SequenceAnnotation) {
roles = ((SequenceAnnotation) comp).getRoles();
} else {
return list;
}
for (URI r : roles) {
// assumes the part role is always the first role in the list
if (so.isDescendantOf(r, part.getRole())) {
list.add(r);
}
}
return list;
}
示例13: convertURIsToType
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Returns the Types enum associated with a type URI in types. If none
* exist, returns null.
*/
public static Types convertURIsToType(Set<URI> types) {
for (URI type : types) {
if (type.equals(ComponentDefinition.DNA)) {
return Types.DNA;
} else if (type.equals(ComponentDefinition.COMPLEX)) {
return Types.Complex;
} else if (type.equals(ComponentDefinition.EFFECTOR)) {
return Types.Effector;
} else if (type.equals(ComponentDefinition.PROTEIN)) {
return Types.Protein;
} else if (type.equals(ComponentDefinition.RNA)) {
return Types.RNA;
} else if (type.equals(ComponentDefinition.SMALL_MOLECULE)) {
return Types.Small_molecule;
}
}
return null;
}
示例14: generateCombinations
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
/**
* Generates all combinations except the empty set.
*/
private static void generateCombinations(HashSet<HashSet<ComponentDefinition>> groups,
ComponentDefinition[] variants, int i, HashSet<ComponentDefinition> set) {
if (i == variants.length) {
if (!set.isEmpty()) {
groups.add(set);
}
return;
}
HashSet<ComponentDefinition> no = new HashSet<>(set);
generateCombinations(groups, variants, i + 1, no);
HashSet<ComponentDefinition> yes = new HashSet<>(set);
yes.add(variants[i]);
generateCombinations(groups, variants, i + 1, yes);
}
示例15: collectVariants
import org.sbolstandard.core2.ComponentDefinition; //导入依赖的package包/类
private static HashSet<ComponentDefinition> collectVariants(SBOLDocument doc, VariableComponent vc)
throws SBOLValidationException {
HashSet<ComponentDefinition> variants = new HashSet<>();
// add all variants
variants.addAll(vc.getVariants());
// add all variants from variantCollections
for (Collection c : vc.getVariantCollections()) {
for (TopLevel tl : c.getMembers()) {
if (tl instanceof ComponentDefinition) {
variants.add((ComponentDefinition) tl);
}
}
}
// add all variants from variantDerivations
for (CombinatorialDerivation derivation : vc.getVariantDerivations()) {
variants.addAll(enumerate(doc, derivation));
}
return variants;
}