当前位置: 首页>>代码示例>>Java>>正文


Java CVTerm类代码示例

本文整理汇总了Java中org.sbml.jsbml.CVTerm的典型用法代码示例。如果您正苦于以下问题:Java CVTerm类的具体用法?Java CVTerm怎么用?Java CVTerm使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CVTerm类属于org.sbml.jsbml包,在下文中一共展示了CVTerm类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resourcesHaveTheSameOrigin

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
/**
 * Checks, whether the resources in a CVTerm have the same origin.
 *
 * @param term The CVTerm to be checked
 * @return True, if the resources in a CVTerm have the same origin.
 */
private boolean resourcesHaveTheSameOrigin(CVTerm term) {
    Set<String> origins = new HashSet<>();
    term.getResources().forEach(resource -> {
        // TODO: 06/11/2016 this can implemented better with some default method in the identifier package
        if (ChEBIIdentifier.PATTERN.matcher(resource).find()) {
            origins.add(ChEBIIdentifier.class.getName());
        } else if (UniProtIdentifier.PATTERN.matcher(resource).find()) {
            origins.add(UniProtIdentifier.class.getName());
        } else {
            origins.add(SimpleStringIdentifier.class.getName());
        }
    });
    // if the set contains only one element, all resources have the same origin
    return origins.size() == 1;
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:22,代码来源:SBMLParser.java

示例2: getIdentifiersList

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
private String getIdentifiersList(List<CVTerm> cvtList) {
	String szIdentifiersList = "";

	for (Iterator<CVTerm> cvtIt = cvtList.iterator(); cvtIt.hasNext();) {
		CVTerm cvTerm = (CVTerm) cvtIt.next();

		// identify the qualifier
		if (cvTerm.isBiologicalQualifier()) {
			// get the resources (URI)
			szIdentifiersList = szIdentifiersList + " "
					+ cvTerm.getResources().toString();

		}
	}
	return szIdentifiersList;

}
 
开发者ID:ibalaur,项目名称:MetabolicFramework,代码行数:18,代码来源:SBMLReading.java

示例3: parseAndAddSingularComponent

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
/**
 * Parses and adds a component using the first parsable resource in the given CVTerm.
 *
 * @param identifier The identifier as referenced in the model.
 * @param cvTerm The CVTerm containing the resources.
 */
private void parseAndAddSingularComponent(String identifier, CVTerm cvTerm, org.sbml.jsbml.Species species) {
    for (String resource : cvTerm.getResources()) {
        Optional<ChemicalEntity> entity = parseEntity(identifier, resource);
        if (entity.isPresent()) {
            entities.put(identifier, entity.get());
            return;
        }
    }
    entities.put(identifier, createReferenceEntity(species));
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:17,代码来源:SBMLParser.java

示例4: parseAndAddComplexComponent

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
/**
 * Parses and adds a complex component using a CVTerm with multiple resources.
 *
 * @param identifier The identifier as referenced in the model.
 * @param cvTerm The CVTerm containing the resources.
 */
private void parseAndAddComplexComponent(String identifier, org.sbml.jsbml.Species species, CVTerm cvTerm) {
    ComplexedChemicalEntity complex = new ComplexedChemicalEntity.Builder(identifier).build();
    for (String resource : cvTerm.getResources()) {
        Optional<ChemicalEntity> chemicalEntity = parseEntity(resource);
        chemicalEntity.ifPresent(complex::addAssociatedPart);
    }
    if (complex.getAssociatedParts().size() > 1) {
        logger.debug("Parsed Chemical Entity as {}", complex);
        entities.put(identifier, complex);
    } else {
        ChemicalEntity referenceEntity = createReferenceEntity(species);
        entities.put(referenceEntity.getIdentifier().toString(), referenceEntity);
    }
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:21,代码来源:SBMLParser.java

示例5: parseAndAddAllComponents

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
private void parseAndAddAllComponents(String identifier, CVTerm cvTerm) {
    ComplexedChemicalEntity complex = new ComplexedChemicalEntity.Builder(identifier).build();
    for (String resource : cvTerm.getResources()) {
        addPartToComplex(complex, resource);
    }
    checkAndAddComplexedChemicalEntity(identifier, complex);
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:8,代码来源:SBMLParser.java

示例6: parseSpecies

import org.sbml.jsbml.CVTerm; //导入依赖的package包/类
private void parseSpecies() {
    logger.info("Parsing Chemical Entity Data ...");
    document.getModel().getListOfSpecies().forEach(species -> {
        logger.debug("Parsing Chemical Entity {} ...", species.getId());
        // the annotations describe the entity used and is composed of CVTerms
        // each cv term is composed of
        // Qualifiers: the relationship between the entity and the resource
        // Resources: the actual links or data
        if (species.getAnnotation().getCVTermCount() == 1) {
            // only one annotation
            CVTerm term = species.getAnnotation().getCVTerm(0);
            if (term.getQualifier() == CVTerm.Qualifier.BQB_IS || term.getQualifier() == CVTerm.Qualifier.BQB_IS_VERSION_OF) {
                // with only one "is" qualifier
                if (term.getResourceCount() == 1) {
                    // and one resource
                    logger.debug("Chemical Entity {} is annotated with one {} resource", species.getId(), term.getQualifier().getElementNameEquivalent());
                    parseAndAddSingularComponent(species.getId(), term, species);
                } else {
                    // and multiple resources
                    if (resourcesHaveTheSameOrigin(term)) {
                        // assuming here, that if the annotations are from different databases, they are alternatives
                        logger.debug("Chemical Entity {} is annotated with multiple {} resources from the same origin.", species.getId(), term.getQualifier().getElementNameEquivalent());
                        parseAndAddComplexComponent(species.getId(), species, term);
                    } else {
                        // and if they are from the same database they are a different parts of a complex entity
                        logger.debug("Chemical Entity {} is annotated with multiple {} resources from different sources.", species.getId(), term.getQualifier().getElementNameEquivalent());
                        parseAndAddSingularComponent(species.getId(), term, species);
                    }
                }
            } else {
                // with
                if (term.getQualifier() == CVTerm.Qualifier.BQB_HAS_PART) {
                    // has part should have at least two components it is the only annotation
                    if (resourcesHaveTheSameOrigin(term)) {
                        logger.debug("Chemical Entity {} is annotated with multiple {} resources from the same origin.", species.getId(), term.getQualifier().getElementNameEquivalent());
                        parseAndAddComplexComponent(species.getId(), species, term);
                    } else {
                        logger.debug("Chemical Entity {} is annotated with multiple {} resources from different sources.", species.getId(), term.getQualifier().getElementNameEquivalent());
                        parseAndAddAllComponents(species.getId(), term);
                    }
                }

            }
        } else {
            // multiple annotations
            logger.debug("Chemical Entity {} is annotated with multiple annotations.", species.getId());
            parseAndAddAllComponents(species.getId(), species.getAnnotation().getListOfCVTerms());
        }
    });
}
 
开发者ID:cleberecht,项目名称:singa,代码行数:51,代码来源:SBMLParser.java


注:本文中的org.sbml.jsbml.CVTerm类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。