private void copyPublicationAndExperimentDetailsTo(BinaryInteraction binary, boolean isFirst, Experiment exp){ if (binary != null && this.binaryTemplate != null){ // we override all the shared collections of the expanded binary interactions excepted annotations (can come from publication and interactions) // experiment details binary.setDetectionMethods(binaryTemplate.getDetectionMethods()); binary.setHostOrganism(binaryTemplate.getHostOrganism()); if (binary.getInteractorA() != null && binary.getInteractorA().getParticipantIdentificationMethods().isEmpty()){ experimentConverter.addParticipantDetectionMethodForInteractor(exp, binary.getInteractorA()); } if (binary.getInteractorB() != null && binary.getInteractorB().getParticipantIdentificationMethods().isEmpty()){ experimentConverter.addParticipantDetectionMethodForInteractor(exp, binary.getInteractorB()); } // publication details binary.setPublications(binaryTemplate.getPublications()); binary.setAuthors(binaryTemplate.getAuthors()); binary.setSourceDatabases(binaryTemplate.getSourceDatabases()); binary.setCreationDate(binaryTemplate.getCreationDate()); // we don't need to update all the interactions as they all share the same annotation collection if (isFirst){ binary.getAnnotations().addAll(binaryTemplate.getAnnotations()); } } }
expandedInteraction.setAnnotations(interaction.getAnnotations()); expandedInteraction.setAuthors(interaction.getAuthors()); expandedInteraction.setChecksums(interaction.getChecksums()); if (isExpanded){ expandedInteraction.getComplexExpansion().add(new CrossReferenceImpl(CvDatabase.PSI_MI, getMI(), getName())); expandedInteraction.setConfidenceValues(interaction.getConfidenceValues()); expandedInteraction.setCreationDate(interaction.getCreationDate()); expandedInteraction.setDetectionMethods(interaction.getDetectionMethods()); expandedInteraction.setHostOrganism(interaction.getHostOrganism()); expandedInteraction.setInteractionAcs(interaction.getInteractionAcs()); expandedInteraction.setInteractionTypes(interaction.getInteractionTypes()); expandedInteraction.setPublications(interaction.getPublications()); expandedInteraction.setSourceDatabases(interaction.getSourceDatabases()); expandedInteraction.setXrefs(interaction.getXrefs()); expandedInteraction.setParameters(interaction.getParameters()); expandedInteraction.setUpdateDate(interaction.getUpdateDate()); expandedInteraction.setNegativeInteraction(interaction.isNegativeInteraction());
private void invertInteractors(BinaryInteraction binaryInteraction) { Interactor a = binaryInteraction.getInteractorA(); Interactor b = binaryInteraction.getInteractorB(); binaryInteraction.setInteractorA(b); binaryInteraction.setInteractorB(a); }
protected void mergeCollections(T interaction, T target) { mergeCollection( interaction.getAuthors(), target.getAuthors() ); mergeCollection( interaction.getPublications(), target.getPublications() ); mergeCollection( interaction.getConfidenceValues(), target.getConfidenceValues() ); mergeCollection( interaction.getDetectionMethods(), target.getDetectionMethods() ); mergeCollection( interaction.getInteractionTypes(), target.getInteractionTypes() ); mergeCollection( interaction.getSourceDatabases(), target.getSourceDatabases() ); mergeCollection( interaction.getInteractionAcs(), target.getInteractionAcs() ); } }
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()); } }
Interactor interactorA = interaction.getInteractorA(); Interactor interactorB = interaction.getInteractorB(); line[PsimiTabColumns.COMPLEX_EXPANSION.ordinal()] = joinCrossReferencStyleCollection(interaction.getComplexExpansion()); // 16 line[PsimiTabColumns.XREFS_I.ordinal()] = joinCrossReferencStyleCollection(interaction.getXrefs());// 25 line[PsimiTabColumns.ANNOTATIONS_I.ordinal()] = joinAnnotationsCollection(interaction.getAnnotations());// 28 line[PsimiTabColumns.HOST_ORGANISM.ordinal()] = joinOrganism(interaction.getHostOrganism());// 29 line[PsimiTabColumns.PARAMETERS_I.ordinal()] = joinParametersCollection(interaction.getParameters());// 30 line[PsimiTabColumns.CREATION_DATE.ordinal()] = joinDateCollection(interaction.getCreationDate());// 31 line[PsimiTabColumns.UPDATE_DATE.ordinal()] = joinDateCollection(interaction.getUpdateDate());// 32 line[PsimiTabColumns.CHECKSUM_I.ordinal()] = joinChecksumCollection(interaction.getChecksums());// 35 line[PsimiTabColumns.NEGATIVE.ordinal()] = createNegative(interaction.isNegativeInteraction());//36 line[PsimiTabColumns.INT_DET_METHOD.ordinal()] = joinCrossReferencStyleCollection(interaction.getDetectionMethods());// 7 line[PsimiTabColumns.PUB_AUTH.ordinal()] = joinAuthorCollection(interaction.getAuthors()); // 8 line[PsimiTabColumns.PUB_ID.ordinal()] = joinCrossReferencStyleCollection(interaction.getPublications());// 9 line[PsimiTabColumns.INTERACTION_TYPE.ordinal()] = joinCrossReferencStyleCollection(interaction.getInteractionTypes());// 12 line[PsimiTabColumns.SOURCE.ordinal()] = joinCrossReferencStyleCollection(interaction.getSourceDatabases());// 13 line[PsimiTabColumns.INTERACTION_ID.ordinal()] = joinCrossReferencStyleCollection(interaction.getInteractionAcs());// 14 line[PsimiTabColumns.CONFIDENCE.ordinal()] = joinConfidenceCollection(interaction.getConfidenceValues());// 15 break; default:
private Boolean isIntraMolecular(BinaryInteraction<?> binaryInteraction) { Interactor A = binaryInteraction.getInteractorA(); Interactor B = binaryInteraction.getInteractorB(); if ((A == null && B != null && !B.isEmpty())) { //We have only one participant in mitab so we don't need to check the stoichiometry. return true; } else if (B == null && A != null && !A.isEmpty()) { return true; } return false; }
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()); } }
bi.getSourceDatabases().add(xref); if (bi.getSourceDatabases().isEmpty()) { bi.getSourceDatabases().addAll(sourceDatabases); for (CrossReference sourceDatabase : bi.getSourceDatabases()) { if (!sourceDatabase.getIdentifier().equals(identityRef.getDb()) && !sourceDatabase.getIdentifier().equals(identityRef.getDbAc())) { bi.getInteractionAcs().addAll(refs); bi.setInteractionTypes(types); bi.setPublications(publications); bi.setDetectionMethods(detections); bi.getDetectionMethods().add(detection); CrossReference pub = pubConverter.toMitab(experiment.getBibref()); if (pub != null) { bi.getPublications().add(pub); bi.getAuthors().add(author); bi.getConfidenceValues().add(tabConfidence); bi.setAnnotations(iAnnotations);
final List<CrossReference> acs = binaryInteraction.getInteractionAcs(); psidev.psi.mi.tab.model.Interactor A = binaryInteraction.getInteractorA(); psidev.psi.mi.tab.model.Interactor B = binaryInteraction.getInteractorB(); interactionIdBuilder.append(binaryInteraction.getInteractorA().getIdentifiers().iterator().next().getIdentifier()); interactionIdBuilder.append("_"); interactionIdBuilder.append(binaryInteraction.getInteractorB().getIdentifiers().iterator().next().getIdentifier()); } else if (A != null && !A.isEmpty()) { interactionIdBuilder.append(binaryInteraction.getInteractorA().getIdentifiers().iterator().next().getIdentifier()); } else if (B != null && !B.isEmpty()) { interactionIdBuilder.append(binaryInteraction.getInteractorB().getIdentifiers().iterator().next().getIdentifier()); } else { new XmlConversionException("Both interactors are null or empty , we can not convert the interaction"); CrossReference source = binaryInteraction.getSourceDatabases().get(0); for (CrossReference ac : binaryInteraction.getInteractionAcs()) { String database = ac.getDatabase(); String id = ac.getIdentifier(); for (CrossReference sourceXref : binaryInteraction.getSourceDatabases()) { String id = sourceXref.getIdentifier(); for (psidev.psi.mi.tab.model.Confidence tabConfidence : binaryInteraction.getConfidenceValues()) { Unit unit = new Unit(); unit.setNames(new Names()); Collection<CrossReference> xrefs = binaryInteraction.getXrefs();
List<CrossReference> iPublications = binaryInteraction.getPublications(); String validPublication; List<CrossReference> iSourceDatabases = binaryInteraction.getSourceDatabases(); if(iSourceDatabases.size() > 0){ sourceDatabase = iSourceDatabases.get(0).getText(); List<CrossReference> iExps = binaryInteraction.getInteractionAcs(); String experiment = ""; String database = ""; Interactor iA = binaryInteraction.getInteractorA(); EncoreIdentifiers interactorAccsA = getInteractorAccs(iA); encoreInteraction.setInteractorAccsA(interactorAccsA.getAccessions()); Interactor iB = binaryInteraction.getInteractorB(); if(binaryInteraction.getConfidenceValues() != null){ encoreInteraction.addConfidenceValues(binaryInteraction.getConfidenceValues()); } else { logger.warn("Confidence Values is null"); if(binaryInteraction.getAuthors() != null){ encoreInteraction.addAuthors(binaryInteraction.getAuthors()); } else { logger.warn("Authors is null"); if(binaryInteraction.getSourceDatabases() != null){ encoreInteraction.addSourceDatabases(binaryInteraction.getSourceDatabases());
public void enrich(BinaryInteraction binaryInteraction) throws Exception { enrich(binaryInteraction.getInteractorA()); enrich(binaryInteraction.getInteractorB()); enrich(binaryInteraction.getInteractionTypes()); enrich(binaryInteraction.getDetectionMethods()); if (binaryInteraction instanceof IntactBinaryInteraction) { IntactBinaryInteraction ibi = (IntactBinaryInteraction) binaryInteraction; enrich(ibi.getHostOrganism()); } }
@Override public boolean canExportBinaryInteraction(BinaryInteraction interaction, ExportContext context) throws UniprotExportException { double score = FilterUtils.getMiClusterScoreFor(interaction); if (score >= positive_export_threshold){ Set<String> intactInteractions = new HashSet<String>(); intactInteractions.addAll(FilterUtils.extractIntactAcFrom(interaction.getInteractionAcs())); if (intactInteractions.isEmpty()){ throw new UniprotExportException("The interaction :" + interaction.getInteractorA().toString() + "-" + interaction.getInteractorB().toString() +" doesn't have any references to IntAct."); } for (String ac : intactInteractions){ if (!context.getSpokeExpandedInteractions().contains(ac)){ String type = context.getInteractionToMethod_type().get(ac).getType(); if (!type.equals(COLOCALIZATION)){ logger.info("The negative interaction " + ac + " passed the export rules with score = " + score); return true; } } } } return false; }
private void setInteractionCommonProperties(BinaryInteraction binaryInteraction, Interaction interaction) { String idA = binaryInteraction.getInteractorA().getIdentifiers().get(0).getIdentifier(); String idB = binaryInteraction.getInteractorB().getIdentifiers().get(0).getIdentifier(); interaction.setId("interaction_" + idA + "_" + idB); List<CrossReference> cRs = binaryInteraction.getXrefs(); for (CrossReference cR : cRs) { if (cR.getDatabase() != null) { List<CrossReference> pubs = binaryInteraction.getPublications(); for (CrossReference pub : pubs) { Publication publication = new Publication(); List<Annotation> annotations = binaryInteraction.getAnnotations(); for (Annotation annotation : annotations) { String comment = annotation.getText();
binary.getInteractionTypes().add(type); binary.getConfidenceValues().add(confField); id.setIdentifier(interaction.getAc()); binary.getInteractionAcs().add(id); if (refField != null && CvDatabase.IMEX.equalsIgnoreCase(refField.getDatabase()) && CvXrefQualifier.IMEX_PRIMARY.equalsIgnoreCase(refField.getText())){ refField.setText(null); binary.getInteractionAcs().add(refField); binary.getInteractionAcs().add(refField); binary.getXrefs().add(refField); binary.getAnnotations().add(annotField); binary.getParameters().add(paramField); binary.getChecksums().add(crc); binary.setNegativeInteraction(true); binary.getUpdateDate().add(interaction.getUpdated());
String intactAc = null; for (CrossReference ref : interaction.getInteractionAcs()){ if (ref.getDatabase().equalsIgnoreCase(INTACT)){ intactAc = ref.getIdentifier(); Interactor interactorA = interaction.getInteractorA(); String uniprotA = null; Interactor interactorB = interaction.getInteractorB(); String uniprotB = null; if (!interaction.isNegativeInteraction()){ processClustering(context, interactionToProcess, interaction, intactAc, interactorA, uniprotA, interactorB, uniprotB, excludeSpokeExpanded, false); if (!interaction.isNegativeInteraction()){ processClustering(context, interactionToProcess, interaction, intactAc, interactorA, uniprotA, interactorB, uniprotB, excludeSpokeExpanded, false);
@Override public BinaryInteraction process(BinaryInteraction item) throws Exception { if (item == null){ return null; } Interactor interactorA = item.getInteractorA(); Interactor interactorB = item.getInteractorB(); String firstInteractor = extractInteractorIdentifier(interactorA); String secondInteractor = extractInteractorIdentifier(interactorB); if (firstInteractor == null){ firstInteractor = secondInteractor; } else if (secondInteractor == null){ secondInteractor = firstInteractor; } BinaryPair currentPair = new BinaryPair(firstInteractor, secondInteractor); if (scores.containsKey(currentPair)){ Double score = scores.get(currentPair); Confidence conf = new ConfidenceImpl(miScoreLabel, scoreFormatter.format(score)); item.getConfidenceValues().add(conf); } return item; }
protected void removeNotExportedInteractionEvidencesFrom(BinaryInteraction<Interactor> binary, List<InteractionImpl> exportedInteractionEvidences){ List<CrossReference> publicationsToRemove = new ArrayList(binary.getPublications()); List<CrossReference> interactionsToRemove = new ArrayList(binary.getInteractionAcs()); List<CrossReference> methodsToRemove = new ArrayList(binary.getDetectionMethods()); List<CrossReference> typeToRemove = new ArrayList(binary.getInteractionTypes()); for (CrossReference ref : binary.getPublications()){ if (ref.getIdentifier().equals(pubmedId)){ publicationsToRemove.remove(ref); for (CrossReference ref : binary.getInteractionAcs()){ if (ref.getIdentifier().equals(interaction.getAc())){ interactionsToRemove.remove(ref); for (CrossReference method : binary.getDetectionMethods()){ if (method.getIdentifier().equals(detectionMI)){ methodsToRemove.remove(method); for (CrossReference type : binary.getInteractionTypes()){ if (type.getIdentifier().equals(typeMi)){ typeToRemove.remove(type); binary.getPublications().removeAll(publicationsToRemove); binary.getDetectionMethods().removeAll(methodsToRemove); binary.getInteractionTypes().removeAll(typeToRemove); binary.getInteractionAcs().removeAll(interactionsToRemove);
Xref ref = null; Xref imexPrimary = null; if (binaryInteraction.getPublications().size() <= index) { log.warn("Size of InteractionAcs is " + binaryInteraction.getInteractionAcs().size() + " but we have only " + binaryInteraction.getPublications().size() + " publication(s)! -> We could not know which publication dependents on which InteractionAcs"); } else { for (CrossReference xref : binaryInteraction.getPublications()) { if (xref.getDatabase() != null && xref.getDatabase().equalsIgnoreCase("pubmed") && bibref == null) { bibref = pubConverter.fromMitab(xref); if (binaryInteraction.getDetectionMethods().size() <= index) { log.warn("Size of InteractionAcs is " + binaryInteraction.getInteractionAcs().size() + " but we have only " + binaryInteraction.getDetectionMethods().size() + " detectionMethod(s)! -> We could not know which detectionMethode dependents on which InteractionAcs"); } else { CrossReference binaryDetectionMethod = binaryInteraction.getDetectionMethods().get(index); detectionMethod = cvConverter.fromMitab(binaryDetectionMethod, psidev.psi.mi.xml.model.InteractionDetectionMethod.class); if (index < binaryInteraction.getAuthors().size()) { String firstAuthor = binaryInteraction.getAuthors().get(index).getName(); if (!firstAuthor.equals("-")) { if (binaryInteraction.hasHostOrganism()) { psidev.psi.mi.tab.model.Organism o = binaryInteraction.getHostOrganism();
@Override public void enrich(BinaryInteraction binaryInteraction) throws Exception { // enrich interactors enrich(binaryInteraction.getInteractorA()); enrich(binaryInteraction.getInteractorB()); // enrich xrefs of interaction enrich(binaryInteraction.getXrefs()); }