public static String joinOrganism(Organism organism) { String result; if (organism != null && !organism.getIdentifiers().isEmpty()) { result = joinCrossReferencStyleCollection(organism.getIdentifiers()); } else { result = "-"; } return result; }
public static Organism splitOrganism(String column) throws IllegalFormatException { Organism organism = null; if (column != null && !column.isEmpty()) { organism = new OrganismImpl(); String[] result = MitabParserUtils.quoteAwareSplit(column, new char[]{'|'}, false); for (String r : result) { if (r != null) { String[] fields = MitabParserUtils.quoteAwareSplit(r, new char[]{':', '(', ')'}, true); if (fields != null) { int length = fields.length; // some exception handling if (length == 0 || length > 3) { throw new IllegalFormatException("String cannot be parsed to create a organism (check the syntax): " + Arrays.asList(result).toString()); } if (length == 1) { if (!result[0].equalsIgnoreCase("-")) { throw new IllegalFormatException("String cannot be parsed to create a organism (check the syntax): " + Arrays.asList(result).toString()); } } else if (length == 2) { organism.addIdentifier(new CrossReferenceImpl(fields[0], fields[1])); } else if (length == 3) { organism.addIdentifier(new CrossReferenceImpl(fields[0], fields[1], fields[2])); } } } } } return organism; }
private String getSpecieName(Organism organism) { String name = null; if (!organism.getIdentifiers().isEmpty()) { final CrossReference first = organism.getIdentifiers().iterator().next(); name = first.getText(); if (name == null || StringUtils.isEmpty(name)) { name = first.getIdentifier(); } } if (name == null) { name = organism.getTaxid(); } return name; }
psiOrganismA.setIdentifiers(encoreInteraction.getOrganismsA()); Organism psiOrganismB = new OrganismImpl(); psiOrganismB.setIdentifiers(encoreInteraction.getOrganismsB());
psiOrganismA.setIdentifiers(encoreInteraction.getOrganismsA()); Organism psiOrganismB = new OrganismImpl(); psiOrganismB.setIdentifiers(encoreInteraction.getOrganismsB());
public SimpleInteractor( Interactor interactor ) { if ( interactor == null ) { this.identifiers = new ArrayList<CrossReference>(); } else { this.identifiers = interactor.getIdentifiers(); if ( interactor.hasOrganism() ) { for ( CrossReference cr : interactor.getOrganism().getIdentifiers() ) { if ( cr.getDatabase().equals( "taxid" ) ) { taxid = new Integer( cr.getIdentifier() ); } } } } }
public boolean isEmpty() { //We don not want to have a empty interactor, we prefer a null interactor return (this.getIdentifiers() == null || this.getIdentifiers().isEmpty()) && (this.getAlternativeIdentifiers() == null || this.getAlternativeIdentifiers().isEmpty()) && (this.getAliases() == null || this.getAliases().isEmpty()) && (!this.hasOrganism() || (this.hasOrganism() && this.getOrganism().getIdentifiers().isEmpty() && this.getOrganism().getTaxid() == null || this.getOrganism().getTaxid().isEmpty()) ) && (this.getBiologicalRoles() == null || this.getBiologicalRoles().isEmpty()) && (this.getExperimentalRoles() == null || this.getExperimentalRoles().isEmpty()) && (this.getInteractorTypes() == null || this.getInteractorTypes().isEmpty()) && (this.getXrefs() == null || this.getXrefs().isEmpty()) && (this.getChecksums() == null || this.getChecksums().isEmpty()) && (this.getFeatures() == null || this.getFeatures().isEmpty()) && (this.getStoichiometry() == null || this.getStoichiometry().isEmpty()) && (this.getParticipantIdentificationMethods() == null || this.getParticipantIdentificationMethods().isEmpty()); } /////////////////////////////
public Organism intactToMitab(BioSource organism){ if (organism != null && organism.getTaxId() != null){ Organism mitabOrganism = new OrganismImpl(); String name = organism.getShortLabel(); String fullName = organism.getFullName(); String taxId = organism.getTaxId(); if (name != null){ mitabOrganism.addIdentifier(new CrossReferenceImpl(TAXID, organism.getTaxId(), name)); } if (fullName != null){ mitabOrganism.addIdentifier(new CrossReferenceImpl(TAXID, organism.getTaxId(), fullName)); } return mitabOrganism; } return null; } }
protected void populateBinaryInteraction(T source, T target) { target.getPublications().addAll(source.getPublications()); target.getAuthors().addAll(source.getAuthors()); target.getInteractionTypes().addAll(source.getInteractionTypes()); target.getDetectionMethods().addAll(source.getDetectionMethods()); target.getConfidenceValues().addAll(source.getConfidenceValues()); target.getSourceDatabases().addAll(source.getSourceDatabases()); target.getInteractionAcs().addAll(source.getInteractionAcs()); target.getAnnotations().addAll(source.getAnnotations()); target.getChecksums().addAll(source.getChecksums()); target.getComplexExpansion().addAll(source.getComplexExpansion()); target.getCreationDate().addAll(source.getCreationDate()); target.getParameters().addAll(source.getParameters()); if (target.getHostOrganism() == null){ target.setHostOrganism(source.getHostOrganism()); } else if (source.getHostOrganism() != null){ target.getHostOrganism().getIdentifiers().addAll(source.getHostOrganism().getIdentifiers()); } }
Iterator<CrossReference> idIterator = o.getIdentifiers().iterator(); String shortlabel = null; if (idIterator.hasNext()) { if (o.getTaxid() != null) { ncbiTaxId = Integer.parseInt(o.getTaxid()); } catch (NumberFormatException e) { final String msg = "Could not parse taxid " + o.getTaxid() + ", it doesn't seem to be a valid integer value."; throw new XmlConversionException(msg);
protected void populateInteractor(Interactor source, Interactor target) { if (target != null && source != null){ target.getAlternativeIdentifiers().addAll(source.getAlternativeIdentifiers()); target.getAliases().addAll(source.getAliases()); if ( !target.hasOrganism() ) { target.setOrganism(new OrganismImpl()); } if( source.hasOrganism() ) { target.getOrganism().getIdentifiers().addAll(source.getOrganism().getIdentifiers()); } target.getAnnotations().addAll(source.getAnnotations()); target.getBiologicalRoles().addAll(source.getBiologicalRoles()); target.getChecksums().addAll(source.getChecksums()); target.getFeatures().addAll(source.getFeatures()); target.getInteractorTypes().addAll(source.getInteractorTypes()); target.getParticipantIdentificationMethods().addAll(source.getParticipantIdentificationMethods()); target.getStoichiometry().addAll(source.getStoichiometry()); target.getXrefs().addAll(source.getXrefs()); } } }
Iterator<CrossReference> idIterator = o.getIdentifiers().iterator(); String shortlabel = null; if (idIterator.hasNext()) { if (o.getTaxid() != null) { try { ncbiTaxId = Integer.parseInt(o.getTaxid()); } catch (NumberFormatException e) { final String msg = "Could not parse taxid " + o.getTaxid() + ", it doesn't seem to be a valid integer value."; throw new XmlConversionException(msg);
Collection<CrossReference> crA = binaryInteraction.getInteractorA().getOrganism().getIdentifiers(); for (CrossReference crAElement : crA) { if (speciesSet.contains(crAElement.getText())) { Collection<CrossReference> crB = binaryInteraction.getInteractorB().getOrganism().getIdentifiers(); for (CrossReference crBElement : crB) { if (speciesSet.contains(crBElement.getText())) {
for ( CrossReference organism : interactor.getOrganism().getIdentifiers() ) { String name = organism.getText(); if ( name != null ) {
public void enrich(Interactor interactor) throws Exception { if (interactor.getOrganism() != null) { enrich(interactor.getOrganism().getIdentifiers()); } if (interactor instanceof ExtendedInteractor) { ExtendedInteractor ei = (ExtendedInteractor) interactor; enrich(ei.getBiologicalRoles()); enrich(ei.getExperimentalRoles()); enrich(ei.getInteractorType()); enrich(ei.getProperties()); } }
encoreInteraction.addOrganismsA(iA.getOrganism().getIdentifiers()); } else { logger.warn("Organism is null"); encoreInteraction.addOrganismsB(iB.getOrganism().getIdentifiers()); } else { logger.warn("Organism is null");
public void enrich(BinaryInteraction binaryInteraction) throws Exception { // enrich interactors enrich(binaryInteraction.getInteractorA()); enrich(binaryInteraction.getInteractorB()); // enrich cvs of interaction enrich(binaryInteraction.getDetectionMethods()); enrich(binaryInteraction.getInteractionTypes()); enrich(binaryInteraction.getSourceDatabases()); enrich(binaryInteraction.getComplexExpansion()); // enrich xrefs of interaction enrich(binaryInteraction.getXrefs()); // enrich organism of interaction if (binaryInteraction.getHostOrganism() != null){ enrich(binaryInteraction.getHostOrganism().getIdentifiers()); } }
public void enrich(Interactor interactor) throws Exception { if (interactor == null){ return; } // enrich organisms if (interactor.getOrganism() != null) { enrich(interactor.getOrganism().getIdentifiers()); } // enrich biological role if (interactor.getBiologicalRoles() != null) { enrich(interactor.getBiologicalRoles()); } // enrich experimental roles if (interactor.getExperimentalRoles() != null) { enrich(interactor.getExperimentalRoles()); } // enrich interactor types if (interactor.getInteractorTypes()!= null) { enrich(interactor.getInteractorTypes()); } // enrich xrefs if (interactor.getXrefs()!= null) { enrich(interactor.getXrefs()); } // enrich participant detection methods if (interactor.getParticipantIdentificationMethods()!= null) { enrich(interactor.getParticipantIdentificationMethods()); } }