uk.ac.ebi.ep.mm
Interface MegaMapper

All Known Implementing Classes:
MegaDbMapper, MegaJdbcMapper, MegaLuceneMapper

public interface MegaMapper

Interface for objects writing/reading entries and cross-references to/from the mega-map.

Author:
rafa

Nested Class Summary
static class MegaMapper.Constraint
           
 
Method Summary
 void closeMap()
          Closes the mega-map.
 void commit()
          Commits any pending changes to the underlying mega-map.
 List<String> getAllUniProtAccessions(MmDatabase database)
           
 List<XRef> getChMBLXrefs(MmDatabase db, String accession, MmDatabase... xDb)
          Retrieves cross references from the mega-map for a given accession where database name is CheMBL.
 Map<?,?> getCompounds(MmDatabase db, String accession, MmDatabase... xDbs)
           
 Map<String,String> getDisease(MmDatabase db, String accessions, MmDatabase... xDbs)
           
 Entry getEntryForAccession(MmDatabase db, String accession)
          Retrieves an entry for a given accession.
 Collection<XRef> getXrefs(Collection<Entry> entries, MmDatabase... db)
          Retrieves cross references from the mega-map for several entries.
 Collection<XRef> getXrefs(Entry entry)
          Retrieves cross references from the mega-map regardless of the referencing/referenced database.
 Collection<XRef> getXrefs(Entry entry, MmDatabase... db)
          Retrieves cross references from the mega-map.
 Collection<XRef> getXrefs(MmDatabase db, String accession)
          Retrieves cross references from the mega-map for a given accession (not ID) regardless of the referencing/referenced database..
 Collection<XRef> getXrefs(MmDatabase db, String idFragment, MegaMapper.Constraint constraint, MmDatabase... xDbs)
          Retrieves cross references from the mega-map for a given text which matches an entry ID, who is related to the given databases.
This method is provided in order to search for UniProt ID prefixes (ex.
 Collection<XRef> getXrefs(MmDatabase db, String idFragment, MegaMapper.Constraint constraint, Relationship relationship)
          Retrieves cross references from the mega-map for a given text which matches an entry ID, who has a given relationship (if any).
This method is provided in order to search for UniProt ID prefixes (ex.
 Collection<XRef> getXrefs(MmDatabase db, String accession, MmDatabase... xDb)
          Retrieves cross references from the mega-map for a given accession (not ID) to/from the given database(s).
 Collection<XRef> getXrefs(MmDatabase db, String accession, Relationship relationship)
          Retrieves cross references from the mega-map for a given accession (not ID) given a concrete relationship.
 int getXrefsSize(MmDatabase db, String accession, MmDatabase... xDb)
          retrieves the total number of Xrefs found for a given accession.
 void handleError()
          Handles any errors which might affect the mega-map.
 void openMap()
          Opens the mega-map for writing.
 void rollback()
          Rolls back any pending changes to the underlying mega-map.
 void write(Collection<Entry> entries, Collection<XRef> xrefs)
          Writes entries and relationships to the mega-map.
 void writeEntries(Collection<Entry> entries)
           
 void writeEntry(Entry entry)
          Writes one entry to the mega-map.
 void writeXref(XRef xref)
          Writes one cross-reference to the mega-map.
 void writeXrefs(Collection<XRef> xrefs)
           
 

Method Detail

openMap

void openMap()
             throws IOException
Opens the mega-map for writing.

Throws:
IOException

writeEntry

void writeEntry(Entry entry)
                throws IOException
Writes one entry to the mega-map.

Parameters:
entry -
Throws:
IOException

writeEntries

void writeEntries(Collection<Entry> entries)
                  throws IOException
Throws:
IOException

writeXref

void writeXref(XRef xref)
               throws IOException
Writes one cross-reference to the mega-map.

Parameters:
xref -
Throws:
IOException

writeXrefs

void writeXrefs(Collection<XRef> xrefs)
                throws IOException
Throws:
IOException

write

void write(Collection<Entry> entries,
           Collection<XRef> xrefs)
           throws IOException
Writes entries and relationships to the mega-map.

Parameters:
entries -
xrefs -
Throws:
IOException

getEntryForAccession

Entry getEntryForAccession(MmDatabase db,
                           String accession)
Retrieves an entry for a given accession.

Parameters:
db -
accession -
Returns:
an Entry, or null if not found.

getXrefs

Collection<XRef> getXrefs(Entry entry)
Retrieves cross references from the mega-map regardless of the referencing/referenced database.

Parameters:
entry - The entry we want relationships for.
Returns:
a collection of xrefs in the map, regardless of the database. Note that the entry used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(Entry entry,
                          MmDatabase... db)
Retrieves cross references from the mega-map.

Parameters:
entry - The entry we want relationships for.
db - The database(s) to which the entry is related.
Returns:
a collection of xrefs in the map. Note that the entry used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(Collection<Entry> entries,
                          MmDatabase... db)
Retrieves cross references from the mega-map for several entries.

Parameters:
entries - The entries we want relationships for.
db - The database(s) to which the entries are related.
Returns:
a collection of xrefs in the map. Note that the entries used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(MmDatabase db,
                          String accession)
Retrieves cross references from the mega-map for a given accession (not ID) regardless of the referencing/referenced database..

Parameters:
db - the database where the accession is from.
accession - the accession number.
Returns:
a collection of xrefs in the map. Note that the accession used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(MmDatabase db,
                          String accession,
                          MmDatabase... xDb)
Retrieves cross references from the mega-map for a given accession (not ID) to/from the given database(s).

Parameters:
db - the database where the accession is from.
accession - the accession number.
xDb - the referencing/referenced database(s).
Returns:
a collection of xrefs in the map, or null if none found. Note that the accession used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(MmDatabase db,
                          String accession,
                          Relationship relationship)
Retrieves cross references from the mega-map for a given accession (not ID) given a concrete relationship.

Parameters:
db - the database where the accession is from.
accession - the accession number.
relationship - the relationship between the given accession and its cross references.
Returns:
a collection of xrefs in the map, or null if none found. Note that the accession used in the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(MmDatabase db,
                          String idFragment,
                          MegaMapper.Constraint constraint,
                          Relationship relationship)
Retrieves cross references from the mega-map for a given text which matches an entry ID, who has a given relationship (if any).
This method is provided in order to search for UniProt ID prefixes (ex. "CFTR_") but can be used for other purposes as well.

Parameters:
db - the Database providing IDs matching idFragment. If null, all databases will be considered.
idFragment - A text which matches entry IDs. Please note that when searching for UniProt ID prefixes it is advisable to include the underscore (_) character, so that "DHSA" won't return xrefs for "DHSA1".
constraint - the constraint to use with the given idFragment.
relationship - The relationship searched, if any (can be null).
Returns:
a collection of xrefs in the map, or null if none found. Note that the entries corresponding to the query may be either the origin or the target of an xref.

getXrefs

Collection<XRef> getXrefs(MmDatabase db,
                          String idFragment,
                          MegaMapper.Constraint constraint,
                          MmDatabase... xDbs)
Retrieves cross references from the mega-map for a given text which matches an entry ID, who is related to the given databases.
This method is provided in order to search for UniProt ID prefixes (ex. "CFTR_") but can be used for other purposes as well.

Parameters:
db - the Database providing IDs matching idFragment. If null, all databases will be considered.
idFragment - A text which matches entry IDs. Please note that when searching for UniProt ID prefixes it is advisable to include the underscore (_) character, so that "DHSA" won't return xrefs for "DHSA1".
constraint - the constraint to use with the given idFragment.
xDbs - the databases for which we want cross-references to be retrieved.
Returns:
a collection of xrefs in the map, or null if none found. Note that the entries corresponding to the query may be either the origin or the target of an xref.

getChMBLXrefs

List<XRef> getChMBLXrefs(MmDatabase db,
                         String accession,
                         MmDatabase... xDb)
Retrieves cross references from the mega-map for a given accession where database name is CheMBL. (not ID).

Parameters:
db - the database where the accession is from.
accession - the accession number.
xDb - the referencing/referenced database(s).
Returns:
a List of xrefs in the map, or null if none found. Note that the accession used in the query may be either the origin or the target of an xref.

getXrefsSize

int getXrefsSize(MmDatabase db,
                 String accession,
                 MmDatabase... xDb)
retrieves the total number of Xrefs found for a given accession.

Parameters:
db - the database where the accession is found
accession - the accession number
xDb - the referencing/referenced database(s).
Returns:
the total number of Xrefs found or 0 if none was found.

handleError

void handleError()
                 throws IOException
Handles any errors which might affect the mega-map.

Throws:
IOException

closeMap

void closeMap()
              throws IOException
Closes the mega-map.

Throws:
IOException

commit

void commit()
            throws IOException
Commits any pending changes to the underlying mega-map.

Throws:
IOException

rollback

void rollback()
              throws IOException
Rolls back any pending changes to the underlying mega-map.

Throws:
IOException

getAllUniProtAccessions

List<String> getAllUniProtAccessions(MmDatabase database)

getCompounds

Map<?,?> getCompounds(MmDatabase db,
                      String accession,
                      MmDatabase... xDbs)

getDisease

Map<String,String> getDisease(MmDatabase db,
                              String accessions,
                              MmDatabase... xDbs)


Copyright © 2012 EMBL-EBI. All Rights Reserved.