Package psidev.psi.mi.jami.factory
Class DefaultInteractorFactory
- java.lang.Object
-
- psidev.psi.mi.jami.factory.DefaultInteractorFactory
-
- All Implemented Interfaces:
InteractorFactory
- Direct Known Subclasses:
MitabInteractorFactory,XmlInteractorFactory
public class DefaultInteractorFactory extends Object implements InteractorFactory
This factory allows to create a proper interactor depending on the type and xrefs- Since:
18/06/13
- Version:
- $Id$
- Author:
- Marine Dumousseau (marine@ebi.ac.uk)
-
-
Constructor Summary
Constructors Constructor Description DefaultInteractorFactory()Constructor for DefaultInteractorFactory.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BioactiveEntitycreateBioactiveEntity(String name, CvTerm type)Creates a new BioactiveEntity with the name and interactor typeComplexcreateComplex(String name, CvTerm type)Creates a new Complex with the name and interactor typeGenecreateGene(String name)Creates a new Gene with the nameInteractorcreateInteractor(String name, CvTerm type)Creates a default interactor from the name and interactor typeInteractorcreateInteractorFromDatabase(CvTerm database, String name)Return the proper instance of the interactor if the database is recognized.InteractorcreateInteractorFromIdentityXrefs(Collection<? extends Xref> xrefs, String name)Return the proper instance of the interactor if the database is recognized (the interactor will be returned on the first database which is recognized).InteractorcreateInteractorFromInteractorType(CvTerm type, String name)Return the proper instance of the interactor if the type is recognized and not null.protected InteractorcreateInteractorFromRecognizedCategory(InteractorCategory category, String name, CvTerm type)Creates an interactor from a given category (should be the canonical name of an Interactor interface)InteractorPoolcreateInteractorSet(String name, CvTerm type)Creates an interactor pool from the name and interactor typeNucleicAcidcreateNucleicAcid(String name, CvTerm type)Creates a new NucleicAcid with the name and interactor typePolymercreatePolymer(String name, CvTerm type)Creates a new Polymer with the name and interactor typeProteincreateProtein(String name, CvTerm type)Creates a new Protein with the name and interactor typeprotected String[]extractCvTermFromKey(String key)Reads the cv term from the properties fileprotected voidinitialiseDeterministicInteractorMaps()Loads some properties to recognize interactor type from different MI termsprotected voidloadProperties(Properties prop)Loads the properties in the deterministicInteractorMap
-
-
-
Method Detail
-
createInteractorFromInteractorType
public Interactor createInteractorFromInteractorType(CvTerm type, String name)
Return the proper instance of the interactor if the type is recognized and not null. It returns null otherwise. Return the proper instance of the interactor if the type is recognized and not null. It returns null otherwise.- Specified by:
createInteractorFromInteractorTypein interfaceInteractorFactory- Parameters:
type- : interactor typename- : short name- Returns:
- the proper instance of the interactor if the type is recognized. It returns null otherwise.
-
createInteractorFromDatabase
public Interactor createInteractorFromDatabase(CvTerm database, String name)
Return the proper instance of the interactor if the database is recognized. It returns null otherwise. Return the proper instance of the interactor if the database is recognized. It returns null otherwise.- Specified by:
createInteractorFromDatabasein interfaceInteractorFactory- Parameters:
database- : databasename- :name- Returns:
- the proper instance of the interactor if the database is recognized. It returns null otherwise.
-
createInteractorFromIdentityXrefs
public Interactor createInteractorFromIdentityXrefs(Collection<? extends Xref> xrefs, String name)
Return the proper instance of the interactor if the database is recognized (the interactor will be returned on the first database which is recognized). It returns null otherwise. Return the proper instance of the interactor if the database is recognized (the interactor will be returned on the first database which is recognized). It returns null otherwise.- Specified by:
createInteractorFromIdentityXrefsin interfaceInteractorFactory- Parameters:
xrefs- : identifiersname- : name- Returns:
- the proper instance of the interactor if the database is recognized (the interactor will be returned on the first database which is recognized). It returns null otherwise.
-
createProtein
public Protein createProtein(String name, CvTerm type)
Creates a new Protein with the name and interactor type Creates a new Protein with the name and interactor type- Specified by:
createProteinin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created protein
-
createNucleicAcid
public NucleicAcid createNucleicAcid(String name, CvTerm type)
Creates a new NucleicAcid with the name and interactor type Creates a new NucleicAcid with the name and interactor type- Specified by:
createNucleicAcidin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created nucleic acid
-
createGene
public Gene createGene(String name)
Creates a new Gene with the name Creates a new Gene with the name- Specified by:
createGenein interfaceInteractorFactory- Parameters:
name- : name- Returns:
- created gene
-
createComplex
public Complex createComplex(String name, CvTerm type)
Creates a new Complex with the name and interactor type Creates a new Complex with the name and interactor type- Specified by:
createComplexin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created complex
-
createBioactiveEntity
public BioactiveEntity createBioactiveEntity(String name, CvTerm type)
Creates a new BioactiveEntity with the name and interactor type Creates a new BioactiveEntity with the name and interactor type- Specified by:
createBioactiveEntityin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created bioactive entity
-
createPolymer
public Polymer createPolymer(String name, CvTerm type)
Creates a new Polymer with the name and interactor type Creates a new Polymer with the name and interactor type- Specified by:
createPolymerin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created polymer
-
createInteractor
public Interactor createInteractor(String name, CvTerm type)
Creates a default interactor from the name and interactor type Creates a default interactor from the name and interactor type- Specified by:
createInteractorin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created default interactor
-
createInteractorSet
public InteractorPool createInteractorSet(String name, CvTerm type)
Creates an interactor pool from the name and interactor type Creates an interactor pool from the name and interactor type- Specified by:
createInteractorSetin interfaceInteractorFactory- Parameters:
name- : short nametype- : interactor type- Returns:
- created interactor pool
-
initialiseDeterministicInteractorMaps
protected void initialiseDeterministicInteractorMaps()
Loads some properties to recognize interactor type from different MI terms
-
loadProperties
protected void loadProperties(Properties prop)
Loads the properties in the deterministicInteractorMap- Parameters:
prop- : properties
-
extractCvTermFromKey
protected String[] extractCvTermFromKey(String key)
Reads the cv term from the properties file- Parameters:
key- : the property ky- Returns:
- cv term values extracted from the key (name - MI identifier)
-
createInteractorFromRecognizedCategory
protected Interactor createInteractorFromRecognizedCategory(InteractorCategory category, String name, CvTerm type)
Creates an interactor from a given category (should be the canonical name of an Interactor interface)- Parameters:
category- : the category of interactorname- : nametype- : interactor type- Returns:
- the created interactor
-
-