public class Cluster
extends Object
Cluster
class represents a
group of genes.Constructor and Description |
---|
Cluster()
Creates a
Cluster initially containing zero genes. |
Modifier and Type | Method and Description |
---|---|
void |
absorbCluster(Cluster c)
Adds all genes in the specified
Cluster to this Cluster . |
void |
addGene(Gene g)
Adds the specified
Gene to this Cluster . |
java.util.Vector<Double> |
getClusterMean()
Returns the mean (i.e., average) of the expression vectors of all
Genes in this Cluster . |
double |
getDistanceToCluster(Cluster c)
Computes and returns the distance between this
Cluster and the specified Cluster . |
Gene |
getGene(int i)
Returns a
Gene in this Cluster . |
int |
getSizeOfCluster()
Returns the number of genes in this
Cluster . |
void |
initialize()
Clears all genes from this
Cluster so that it contains zero genes. |
boolean |
isGeneInCluster(Gene g)
Returns a
boolean value indicating if the specified
Gene is in this Cluster . |
void |
removeGene(Gene g)
Removes the specified
Gene from this Cluster . |
String |
toString()
Returns a
String representation of this Cluster . |
public void initialize()
Cluster
so that it contains zero genes.public int getSizeOfCluster()
Cluster
.Cluster
public void addGene(Gene g)
Gene
to this Cluster
.
If the specified Gene
is already in this
Cluster
then the Gene
is not
added again (i.e,. there should be no duplicate
Genes
in the Cluster
).
g
- a Gene
to be added to this Cluster
public void removeGene(Gene g)
Gene
from this Cluster
.
If the specified Gene
is not in this Cluster
then this Cluster
is not changed.
g
- a Gene
to be removed from this Cluster
public Gene getGene(int i)
Gene
in this Cluster
.
The ith Gene
in this Cluster
is returned.
i
- the index of the Gene
in this Cluster
to be returnedGene
at index i
in this Cluster
public boolean isGeneInCluster(Gene g)
boolean
value indicating if the specified
Gene
is in this Cluster
.g
- a Gene
that may or may not be in this Cluster
true
if g
is in this Cluster
, false otherwisepublic java.util.Vector<Double> getClusterMean()
Genes
in this Cluster
.doubles
corresponding to the average expression of each Gene
in this Cluster
in each experimentpublic double getDistanceToCluster(Cluster c)
Cluster
and the specified Cluster
.
Each Cluster
has a vector representing the Cluster
's mean expression
across all experiments. The distance between two Clusters
is computed as
the Euclidean distance between the two Clusters
' means.
c
- a Cluster
for which we wish to compute to the distance to this Cluster
double
representing the distance between the specified Cluster
and this Cluster
public void absorbCluster(Cluster c)
Cluster
to this Cluster
.
Thus, this Cluster
grows in size by the number of genes
in Cluster c
. The specified Cluster
is not altered.
c
- a Cluster
to be absorbed by this Cluster
public String toString()
String
representation of this Cluster
.
The name of each Gene
in this Cluster
along with each
Gene
's function are included in the String
representation of this Cluster
.
toString
in class Object
String
represenation of this Cluster