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 BioactiveEntity
createBioactiveEntity(String name, CvTerm type)
Creates a new BioactiveEntity with the name and interactor typeComplex
createComplex(String name, CvTerm type)
Creates a new Complex with the name and interactor typeGene
createGene(String name)
Creates a new Gene with the nameInteractor
createInteractor(String name, CvTerm type)
Creates a default interactor from the name and interactor typeInteractor
createInteractorFromDatabase(CvTerm database, String name)
Return the proper instance of the interactor if the database is recognized.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).Interactor
createInteractorFromInteractorType(CvTerm type, String name)
Return the proper instance of the interactor if the type is recognized and not null.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)InteractorPool
createInteractorSet(String name, CvTerm type)
Creates an interactor pool from the name and interactor typeNucleicAcid
createNucleicAcid(String name, CvTerm type)
Creates a new NucleicAcid with the name and interactor typePolymer
createPolymer(String name, CvTerm type)
Creates a new Polymer with the name and interactor typeProtein
createProtein(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 void
initialiseDeterministicInteractorMaps()
Loads some properties to recognize interactor type from different MI termsprotected void
loadProperties(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:
createInteractorFromInteractorType
in 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:
createInteractorFromDatabase
in 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:
createInteractorFromIdentityXrefs
in 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:
createProtein
in 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:
createNucleicAcid
in 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:
createGene
in 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:
createComplex
in 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:
createBioactiveEntity
in 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:
createPolymer
in 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:
createInteractor
in 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:
createInteractorSet
in 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
-
-