com.compomics.util.experiment.identification.protein_inference.proteintree
Class Node

java.lang.Object
  extended by com.compomics.util.experiment.identification.protein_inference.proteintree.Node

public class Node
extends Object

A node of the protein tree.

Author:
Marc Vaudel

Constructor Summary
Node(int depth)
          Constructor.
Node(int depth, HashMap<String,ArrayList<Integer>> accessions)
          Constructor.
 
Method Summary
 void addAccession(String accession, ArrayList<Integer> indexes)
          Adds an accession to the node.
 void clearAccessions()
          Clears the accessions of this node.
 HashMap<String,ArrayList<Integer>> getAccessions()
          Returns the accessions attribute.
 HashMap<String,ArrayList<Integer>> getAllMappings()
          Returns all the protein mapping of the node.
 int getDepth()
          Returns the depth of the node in the tree.
 Long getIndex()
          Returns the index of the node when saved.
 HashMap<String,ArrayList<Integer>> getProteinMapping(String peptideSequence)
          Returns the protein mappings for the given peptide sequence.
 long getSize()
          Returns the size of the node in accession*tag.
 HashMap<Character,Node> getSubtree()
          Returns the subtree.
 boolean isEmpty()
          Indicates whether the node is empty.
 void loadAccessions()
          Loads the content of the node from the node factory.
 void setIndex(Long index)
          Sets the index of the node when saved.
 boolean splitNode(int maxNodeSize)
          Splits the node into subnode if its size is larger than the maxNodeSize and does the same for every sub node.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Node

public Node(int depth)
Constructor.

Parameters:
depth - the depth of the node

Node

public Node(int depth,
            HashMap<String,ArrayList<Integer>> accessions)
Constructor.

Parameters:
depth - the depth of the node
accessions - the accessions of the node
Method Detail

getProteinMapping

public HashMap<String,ArrayList<Integer>> getProteinMapping(String peptideSequence)
                                                     throws IOException,
                                                            InterruptedException,
                                                            ClassNotFoundException
Returns the protein mappings for the given peptide sequence. An empty map if not found.

Parameters:
peptideSequence - the given peptide sequence
Returns:
the protein mapping for the given peptide sequence
Throws:
IOException
InterruptedException
ClassNotFoundException

splitNode

public boolean splitNode(int maxNodeSize)
                  throws IOException,
                         IllegalArgumentException,
                         InterruptedException,
                         ClassNotFoundException
Splits the node into subnode if its size is larger than the maxNodeSize and does the same for every sub node.

Parameters:
maxNodeSize - the maximal node size allowed when splitting
Returns:
returns true if the node was actually splitted and thus needs to be saved in indexed mode
Throws:
IOException
IllegalArgumentException
InterruptedException
ClassNotFoundException

addAccession

public void addAccession(String accession,
                         ArrayList<Integer> indexes)
Adds an accession to the node.

Parameters:
accession - the accession to add
indexes - the indexes in this accession where the key can be found. Any prior entry will be silently overwritten

getSize

public long getSize()
Returns the size of the node in accession*tag.

Returns:
the size of the node

getAccessions

public HashMap<String,ArrayList<Integer>> getAccessions()
Returns the accessions attribute.

Returns:
the accessions attribute

getSubtree

public HashMap<Character,Node> getSubtree()
Returns the subtree. Null if end of the tree.

Returns:
the subtree

clearAccessions

public void clearAccessions()
Clears the accessions of this node.


isEmpty

public boolean isEmpty()
Indicates whether the node is empty.

Returns:
whether the node is empty

loadAccessions

public void loadAccessions()
                    throws IOException
Loads the content of the node from the node factory.

Throws:
IOException

getDepth

public int getDepth()
Returns the depth of the node in the tree.

Returns:
the depth of the node in the tree

getAllMappings

public HashMap<String,ArrayList<Integer>> getAllMappings()
                                                  throws IOException
Returns all the protein mapping of the node.

Returns:
all the protein mappings of the node
Throws:
IOException

getIndex

public Long getIndex()
Returns the index of the node when saved. Null if not set.

Returns:
the index of the node when save

setIndex

public void setIndex(Long index)
Sets the index of the node when saved.

Parameters:
index - the index of the node when save


Copyright © 2013. All Rights Reserved.