@Deprecated private Reaction createReaction(BinaryInteraction binaryInteraction) { Reaction reaction = new Reaction(Reaction.ReactionType.REACTION); // Common properties setInteractionCommonProperties(binaryInteraction, reaction); // name reaction.setName("reaction_" + reaction.getId()); // Stoichiometry if (!binaryInteraction.getInteractorA().getStoichiometry().isEmpty() && !binaryInteraction.getInteractorB().getStoichiometry().isEmpty()) { Map stoichiometryA = new HashMap<String, Object>(); stoichiometryA.put("component", binaryInteraction.getInteractorA().getIdentifiers().get(0).getIdentifier()); stoichiometryA.put("coefficient", binaryInteraction.getInteractorA().getStoichiometry()); reaction.getStoichiometry().add(stoichiometryA); Map stoichiometryB = new HashMap<String, Object>(); stoichiometryB.put("component", binaryInteraction.getInteractorB().getIdentifiers().get(0).getIdentifier()); stoichiometryB.put("coefficient", binaryInteraction.getInteractorB().getStoichiometry()); reaction.getStoichiometry().add(stoichiometryB); } return reaction; }
private Reaction createAssembly(BinaryInteraction binaryInteraction) { Reaction assembly = new Reaction(Reaction.ReactionType.ASSEMBLY); // Common properties setInteractionCommonProperties(binaryInteraction, assembly); // name assembly.setName("assembly_" + assembly.getId()); // reactants String idA = binaryInteraction.getInteractorA().getIdentifiers().get(0).getIdentifier(); String idB = binaryInteraction.getInteractorB().getIdentifiers().get(0).getIdentifier(); assembly.getReactants().add(idA); assembly.getReactants().add(idB); // product String productId = idA + "_" + idB; assembly.getProducts().add(productId); // adding product to participants assembly.getParticipants().add(productId); // Stoichiometry if (!binaryInteraction.getInteractorA().getStoichiometry().isEmpty() && !binaryInteraction.getInteractorB().getStoichiometry().isEmpty()) { Map stoichiometryA = new HashMap<String, Object>(); stoichiometryA.put("component", binaryInteraction.getInteractorA().getIdentifiers().get(0).getIdentifier()); stoichiometryA.put("coefficient", binaryInteraction.getInteractorA().getStoichiometry()); assembly.getStoichiometry().add(stoichiometryA); Map stoichiometryB = new HashMap<String, Object>(); stoichiometryB.put("component", binaryInteraction.getInteractorB().getIdentifiers().get(0).getIdentifier()); stoichiometryB.put("coefficient", binaryInteraction.getInteractorB().getStoichiometry()); assembly.getStoichiometry().add(stoichiometryB); } return assembly; }
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()); } /////////////////////////////
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()); } } }
interactorB.getStoichiometry().clear(); interactorB.getStoichiometry().add(0);
interactorB.getStoichiometry().clear(); interactorB.getStoichiometry().add(0);
interactorA = getInteractorConverter().toMitab(pA); interactorB = getInteractorConverter().toMitab(pB); if (interactorA.getStoichiometry() != null && !interactorA.getStoichiometry().isEmpty()) { interactorB.setStoichiometry(Collections.singletonList(0)); List<Annotation> annotations = interactorB.getAnnotations();
mitabInteractor.getStoichiometry().add((int) participant.getStoichiometry());
Collection<Integer> stoichiometry = mitabInteractor.getStoichiometry(); if (!stoichiometry.isEmpty()) { for (Integer integer : stoichiometry) {
line[PsimiTabColumns.STOICHIOMETRY_A.ordinal()] = joinStoichiometryCollection(interactorA.getStoichiometry());//39 line[PsimiTabColumns.STOICHIOMETRY_B.ordinal()] = joinStoichiometryCollection(interactorB.getStoichiometry()); //40