fr.umlv.gramofone.graphs
Class MyPattern

java.lang.Object
  extended by fr.umlv.gramofone.graphs.MyPattern
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class MyPattern
extends java.lang.Object
implements java.io.Serializable, java.lang.Cloneable

Manage a motif

Author:
fsikora
See Also:
Serialized Form

Field Summary
static java.lang.String NONAMEPATTERN
           
 
Constructor Summary
MyPattern()
           
MyPattern(java.util.List<java.lang.String> proteins)
          Build a pattern from a list of proteins (the name of the pattern wil be NONAMEPATTERN)
MyPattern(MyPattern pattern)
          Build a motif from a motif (copy)
MyPattern(java.lang.String patternFastaFile)
          Initialize a pattern from a FASTA file !
MyPattern(java.lang.String name, java.util.List<java.lang.String> proteins)
          Build a pattern from a list of proteins with a given name for this pattern
 
Method Summary
 int getColor(java.lang.String id)
          Return the color associated to the protein id in the motif
 int getColorfulSize()
          Return the number of different colors in the motif
 java.util.Set<java.lang.Integer> getColors()
          Return a set with the different colors used in the motif
 java.lang.String getName()
          return the name of the motif
 int getOccurence(int id)
          Return the occurences of the protein id in the motif
 java.util.Set<java.lang.String> getPattern()
          Get all the proteins in the pattern
 java.lang.String getPatternText()
          Return a String representing the pattern
 java.util.HashSet<java.lang.String> getProteinsFromColor(int color)
          Get the protein who got this color
 int getTotalMotifSize()
          return the size of the motif (with repetitions)
protected static java.util.List<java.lang.String> parseFastaFile(java.lang.String patternFastaFile)
          Return a list of proteins in a Fasta file
protected  void removeProteins(java.util.Set<java.lang.String> proteins)
          Remove a set of proteins in the motif (used in apriori deletions)
protected  void toMultiSet(Homologies homologies)
          Convert the original pattern set as a multiset : proteins in the pattern which are homologs now use the same color
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONAMEPATTERN

public static java.lang.String NONAMEPATTERN
Constructor Detail

MyPattern

public MyPattern(MyPattern pattern)
Build a motif from a motif (copy)

Parameters:
pattern -

MyPattern

public MyPattern()

MyPattern

public MyPattern(java.util.List<java.lang.String> proteins)
Build a pattern from a list of proteins (the name of the pattern wil be NONAMEPATTERN)

Parameters:
proteins -

MyPattern

public MyPattern(java.lang.String name,
                 java.util.List<java.lang.String> proteins)
Build a pattern from a list of proteins with a given name for this pattern

Parameters:
name -
proteins -

MyPattern

public MyPattern(java.lang.String patternFastaFile)
Initialize a pattern from a FASTA file !

Parameters:
patternFastaFile -
Method Detail

parseFastaFile

protected static java.util.List<java.lang.String> parseFastaFile(java.lang.String patternFastaFile)
Return a list of proteins in a Fasta file

Parameters:
patternFastaFile -
Returns:

getTotalMotifSize

public int getTotalMotifSize()
return the size of the motif (with repetitions)

Returns:

getColorfulSize

public int getColorfulSize()
Return the number of different colors in the motif

Returns:

getName

public java.lang.String getName()
return the name of the motif

Returns:

getPattern

public java.util.Set<java.lang.String> getPattern()
Get all the proteins in the pattern

Returns:
a set of proteins in the pattern

getPatternText

public java.lang.String getPatternText()
Return a String representing the pattern

Returns:

getColor

public int getColor(java.lang.String id)
Return the color associated to the protein id in the motif

Parameters:
id -
Returns:

getProteinsFromColor

public java.util.HashSet<java.lang.String> getProteinsFromColor(int color)
Get the protein who got this color

Parameters:
color - the color of the protein
Returns:
the corresponding protein name

getOccurence

public int getOccurence(int id)
Return the occurences of the protein id in the motif


getColors

public java.util.Set<java.lang.Integer> getColors()
Return a set with the different colors used in the motif

Returns:

removeProteins

protected void removeProteins(java.util.Set<java.lang.String> proteins)
Remove a set of proteins in the motif (used in apriori deletions)

Parameters:
proteins -

toMultiSet

protected void toMultiSet(Homologies homologies)
Convert the original pattern set as a multiset : proteins in the pattern which are homologs now use the same color

Parameters:
homologies - to know homologs