tools.namemapping
Class Synonyms

java.lang.Object
  extended by tools.namemapping.Synonyms

public class Synonyms
extends Object

Manages synonyms for protein identifiers. Contains identifier/synonym pairs. The resolveSynonym(String) method then maps any incoming synonyms to their identifiers. Transitive relations will be followed. That is, if you add the synonym-mappings a => b and b => c then a will be mapped to c.

Author:
Jan Krumsiek
See Also:
ProteinManager

Constructor Summary
Synonyms()
          Creates a new empty set of synonyms
 
Method Summary
 void addMappingNetwork(ProteinNetwork mappings)
          Adds all mappings induced by the edges of a given directed network to the synonyms list.
 void addSynonym(String identifier, String synonym)
          Adds a new synonym.
 Set<String> getSynonyms(String identifier)
          Returns all synonyms associated with a given identifier.
 String resolveSynonym(String id)
          Returns the identifier a synonym is mapped to or id directly of no synonym is associated with that string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Synonyms

public Synonyms()
Creates a new empty set of synonyms

Method Detail

addSynonym

public void addSynonym(String identifier,
                       String synonym)
Adds a new synonym. The given synonym will be mapped to identifier by resolveSynonym(String).

Parameters:
identifier - identifier the synonym is mapped to
synonym - synonym of the identifier

resolveSynonym

public String resolveSynonym(String id)
Returns the identifier a synonym is mapped to or id directly of no synonym is associated with that string.

Parameters:
id - identifier which is resolved
Returns:
mapped identifier if id is registered as a synonym or id directly otherwise

getSynonyms

public Set<String> getSynonyms(String identifier)
Returns all synonyms associated with a given identifier.

Parameters:
identifier - identifier for which synonyms are looked up
Returns:
synonyms for that identifier or null if no synonyms are associated with the identifer

addMappingNetwork

public void addMappingNetwork(ProteinNetwork mappings)
                       throws IllegalArgumentException
Adds all mappings induced by the edges of a given directed network to the synonyms list. For each directed edge a => b the corresponding synonym mapping will be added with a being the synonym and b its associated identifier.

If the networks contains circles or nodes with multiple successors the method's behavious is undefined (but it will not crash).

Parameters:
mappings - directed mapping network with synonyms to be added
Throws:
IllegalArgumentException - if the network is undirected