/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }
public Element createHostOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + HOST_ORGANISM_TAG_NAME + "." ); } else { if ( !HOST_ORGANISM_PARENT_NODE.equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( parent.getNodeName() + " found, you must give a " + HOST_ORGANISM_PARENT_NODE + " to build a " + ORGANISM_TAG_NAME + "." ); } } Element element = getHostOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, HOST_ORGANISM_TAG_NAME ); updateHostOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
public Element createOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + ORGANISM_TAG_NAME + "." ); } else { if ( !"interactor".equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( "You must give a interactor parent to build a " + ORGANISM_TAG_NAME + "." ); } } if ( session == null ) { throw new IllegalArgumentException( "You must give a non null session." ); } Element element = getOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, ORGANISM_TAG_NAME ); updateOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
/** * Generates an participantRef out of an IntAct interactor. * * @param session * @param parent the Element to which we will add the participantRef. * @param interactor the IntAct interactor that we convert to PSI. * * @return the generated participantRef Element. */ public Element createParticipantReference( UserSessionDownload session, Element parent, Interactor interactor ) { // TODO test that. // 1. Checking... if ( session == null ) { throw new IllegalArgumentException( "You must give a non null UserSessionDownload." ); } if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null parent to build an " + INTERACTOR_REF_TAG_NAME + "." ); } if ( interactor == null ) { throw new IllegalArgumentException( "You must give a non null protein to build an " + INTERACTOR_REF_TAG_NAME + "." ); } // 2. Initialising the element... Element element = session.createElement( INTERACTOR_REF_TAG_NAME ); element.setAttribute( "ref", getInteractorId( session, interactor ) ); // 3. Attaching the newly created element to the parent... parent.appendChild( element ); return element; }
private Element createParticipant( UserSessionDownload session, Element parent, Interactor interactor, Feature feature ) { Element participantElement = session.createElement( "participant" ); Feature2xmlPSI25 f2xml = (Feature2xmlPSI25) Feature2xmlFactory.getInstance( session ); f2xml.createReference( session, participantElement, feature ); parent.appendChild( participantElement ); return participantElement; } }
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static AbstractXref2Xml getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Xref2xmlPSI2.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
private Element createConfidenceElement(UserSessionDownload session, CvObject unit, Object value) { Element confidenceElement = session.createElement(CONFIDENCE_TAG_NAME); // 2. Generating Unit... Element unitElement = session.createElement(CONFIDENCE_UNIT_TAG_NAME); createNames(session, unitElement, unit); confidenceElement.appendChild(unitElement); // TODO check if it has MI reference, if so export them as xref of the confidence.unit. // 3. Generating value... Element valueElement = session.createElement(CONFIDENCE_VALUE_TAG_NAME); Text valueTextElement = session.createTextNode((String)value); valueElement.appendChild(valueTextElement); confidenceElement.appendChild(valueElement); return confidenceElement; } }
public Element createHostOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + HOST_ORGANISM_TAG_NAME + "." ); } else { if ( !HOST_ORGANISM_PARENT_NODE.equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( parent.getNodeName() + " found, you must give a " + HOST_ORGANISM_PARENT_NODE + " to build a " + ORGANISM_TAG_NAME + "." ); } } Element element = getHostOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, HOST_ORGANISM_TAG_NAME ); updateHostOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
public Element createOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + ORGANISM_TAG_NAME + "." ); } else { if ( !"interactor".equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( "You must give a interactor parent to build a " + ORGANISM_TAG_NAME + "." ); } } if ( session == null ) { throw new IllegalArgumentException( "You must give a non null session." ); } Element element = getOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, ORGANISM_TAG_NAME ); updateOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
/** * Generates an participantRef out of an IntAct interactor. * * @param session * @param parent the Element to which we will add the participantRef. * @param interactor the IntAct interactor that we convert to PSI. * * @return the generated participantRef Element. */ public Element createParticipantReference( UserSessionDownload session, Element parent, Interactor interactor ) { // TODO test that. // 1. Checking... if ( session == null ) { throw new IllegalArgumentException( "You must give a non null UserSessionDownload." ); } if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null parent to build an " + INTERACTOR_REF_TAG_NAME + "." ); } if ( interactor == null ) { throw new IllegalArgumentException( "You must give a non null protein to build an " + INTERACTOR_REF_TAG_NAME + "." ); } // 2. Initialising the element... Element element = session.createElement( INTERACTOR_REF_TAG_NAME ); element.setAttribute( "ref", getInteractorId( session, interactor ) ); // 3. Attaching the newly created element to the parent... parent.appendChild( element ); return element; }
/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }
private Element createParticipant( UserSessionDownload session, Element parent, Interactor interactor, Feature feature ) { Element participantElement = session.createElement( "participant" ); Feature2xmlPSI25 f2xml = (Feature2xmlPSI25) Feature2xmlFactory.getInstance( session ); f2xml.createReference( session, participantElement, feature ); parent.appendChild( participantElement ); return participantElement; } }
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static AbstractXref2Xml getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Xref2xmlPSI2.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
public Element createHostOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + HOST_ORGANISM_TAG_NAME + "." ); } else { if ( !HOST_ORGANISM_PARENT_NODE.equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( parent.getNodeName() + " found, you must give a " + HOST_ORGANISM_PARENT_NODE + " to build a " + ORGANISM_TAG_NAME + "." ); } } Element element = getHostOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, HOST_ORGANISM_TAG_NAME ); updateHostOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
public Element createOrganism( UserSessionDownload session, Element parent, BioSource bioSource ) { if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null BioSource to build a " + ORGANISM_TAG_NAME + "." ); } else { if ( !"interactor".equals( parent.getNodeName() ) ) { throw new IllegalArgumentException( "You must give a interactor parent to build a " + ORGANISM_TAG_NAME + "." ); } } if ( session == null ) { throw new IllegalArgumentException( "You must give a non null session." ); } Element element = getOrganismFromCache( session, bioSource ); if ( element == null ) { element = create( session, parent, bioSource, ORGANISM_TAG_NAME ); updateOrganismCache( session, bioSource, element ); } else { parent.appendChild( element ); } return element; }
/** * Generates an participantRef out of an IntAct interactor. * * @param session * @param parent the Element to which we will add the participantRef. * @param interactor the IntAct interactor that we convert to PSI. * * @return the generated participantRef Element. */ public Element createParticipantReference( UserSessionDownload session, Element parent, Interactor interactor ) { // TODO test that. // 1. Checking... if ( session == null ) { throw new IllegalArgumentException( "You must give a non null UserSessionDownload." ); } if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null parent to build an " + INTERACTOR_REF_TAG_NAME + "." ); } if ( interactor == null ) { throw new IllegalArgumentException( "You must give a non null protein to build an " + INTERACTOR_REF_TAG_NAME + "." ); } // 2. Initialising the element... Element element = session.createElement( INTERACTOR_REF_TAG_NAME ); element.setAttribute( "ref", getInteractorId( session, interactor ) ); // 3. Attaching the newly created element to the parent... parent.appendChild( element ); return element; }
/** * Convert an annotatedObject annotations in to confidence value in PSI. * * @param session * @param parent the Element to which we will attach the generated confidence. * @param annotatedObject the object from which we get the annotations. * * @return the generated confidence or null if none could be generated. */ public Element create( UserSessionDownload session, Element parent, AnnotatedObject annotatedObject ) { Element element = null; if ( annotatedObject instanceof Interaction ) { element = create( session, parent, annotatedObject, CvTopic.AUTHOR_CONFIDENCE ); } else if ( annotatedObject instanceof Experiment ) { element = create( session, parent, annotatedObject, CvTopic.CONFIDENCE_MAPPING ); } else { // error, type not supported. throw new UnsupportedOperationException( "a confidence can only be generated for an interaction or an experiemnt." ); } return element; }
private Element createParticipant( UserSessionDownload session, Element parent, Interactor interactor, Feature feature ) { Element participantElement = session.createElement( "participant" ); Feature2xmlPSI25 f2xml = (Feature2xmlPSI25) Feature2xmlFactory.getInstance( session ); f2xml.createReference( session, participantElement, feature ); parent.appendChild( participantElement ); return participantElement; } }
/** * Gives the right version of the Psi XML generator according to the user's session * * @param session the user session that will indicate which version of the Psi generator is required * * @return */ public static AbstractXref2Xml getInstance( UserSessionDownload session ) { if ( session.getPsiVersion().equals( PsiVersion.VERSION_1 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_2 ) ) { return Xref2xmlPSI1.getInstance(); } else if ( session.getPsiVersion().equals( PsiVersion.VERSION_25 ) ) { return Xref2xmlPSI2.getInstance(); } else { throw new IllegalStateException( "We do not support PSI version " + session.getPsiVersion() ); } } }
/** * Generates an interactorRef out of an IntAct interactor. * * @param session * @param parent the Element to which we will add the interactorRef. * @param interactor the IntAct interactor that we convert to PSI. * * @return the generated interactorRef Element. */ public Element createInteractorReference( UserSessionDownload session, Element parent, Interactor interactor ) { // TODO test that. // 1. Checking... if ( session == null ) { throw new IllegalArgumentException( "You must give a non null UserSessionDownload." ); } if ( parent == null ) { throw new IllegalArgumentException( "You must give a non null parent to build an " + INTERACTOR_REF_TAG_NAME + "." ); } if ( interactor == null ) { throw new IllegalArgumentException( "You must give a non null protein to build an " + INTERACTOR_REF_TAG_NAME + "." ); } // 2. Initialising the element... Element element = session.createElement( INTERACTOR_REF_TAG_NAME ); Text refText = session.createTextNode( getInteractorId( session, interactor ) ); element.appendChild( refText ); // 3. Attaching the newly created element to the parent... parent.appendChild( element ); return element; }