org.genepattern.data.matrix
Class ClassVector

java.lang.Object
  extended byorg.genepattern.data.matrix.ClassVector

public class ClassVector
extends java.lang.Object

A one-dimensional matrix used to hold class assignment information.


Constructor Summary
ClassVector(java.lang.String[] x)
          Constructs a new class vector from the array of class assignments
ClassVector(java.lang.String[] x, java.lang.String[] classes)
          Constructs a new class vector from the array of class assignments
 
Method Summary
 ClassVector[] getAllPairs()
          Creates a array containing all pairwise class vectors.
 int getAssignment(int index)
          Gets the class assignment
 int[] getAssignments()
          Allocates a new array containing the class assignments
 int getClassCount()
          Gets the number of different possible values taken by the class assignments.
 java.lang.String getClassName(int classNumber)
          Gets the class name for the specified class number
 int[] getIndices(int classNumber)
          Gets the indices in the assignments array that have the specified class number.
 ClassVector[] getOneVersusAll()
          Creates a array containing all one versus all class vectors.
 int size()
          Gets the number of assignments in this class vector
 ClassVector slice(int[] order)
          Constructs and returns a new class vector that contains the indicated cells.
 ClassVector slice(int[] order, boolean includeSlicedClassOnly)
          Constructs and returns a new class vector that contains the indicated cells.
 java.lang.String toAssignmentString()
           
 java.lang.String toString()
           
 ClassVector union(ClassVector classVector)
          Constructs a new class vector that is the union of this class vector with the given class vector
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ClassVector

public ClassVector(java.lang.String[] x)
Constructs a new class vector from the array of class assignments

Parameters:
x - the class assignments

ClassVector

public ClassVector(java.lang.String[] x,
                   java.lang.String[] classes)
Constructs a new class vector from the array of class assignments

Parameters:
x - the class assignments
classes - ordered array of class names. The 0th entry will be given the assignment 0, the 1st entry the assignment 1, etc.
Method Detail

union

public ClassVector union(ClassVector classVector)
Constructs a new class vector that is the union of this class vector with the given class vector

Parameters:
classVector - the class vector
Returns:
the union

size

public int size()
Gets the number of assignments in this class vector

Returns:
the number of assignments

slice

public ClassVector slice(int[] order,
                         boolean includeSlicedClassOnly)
Constructs and returns a new class vector that contains the indicated cells. Indices can be in arbitrary order.

Parameters:
includeSlicedClassOnly - If false the returned class vector will have a class count equal to the class count in the this class vector, even if the returned class vector has less classes than this class vector and the returned class vector will have the same numerical class encoding as this class vector.
order - the indices
Returns:
the new class vector

slice

public ClassVector slice(int[] order)
Constructs and returns a new class vector that contains the indicated cells. Indices can be in arbitrary order. The class count in the returned class vector will be the same as this class vector.

Parameters:
order - the indices
Returns:
the new class vector

toAssignmentString

public java.lang.String toAssignmentString()

toString

public java.lang.String toString()

getClassCount

public int getClassCount()
Gets the number of different possible values taken by the class assignments. Note that this can be greater than the actual number of classes contained in this class vector.

Returns:
The number of classes.

getClassName

public java.lang.String getClassName(int classNumber)
Gets the class name for the specified class number

Parameters:
classNumber - The class number
Returns:
The class name.

getAssignment

public int getAssignment(int index)
Gets the class assignment

Parameters:
index - The index
Returns:
The assignment

getAssignments

public int[] getAssignments()
Allocates a new array containing the class assignments

Returns:
The assignments

getOneVersusAll

public ClassVector[] getOneVersusAll()
Creates a array containing all one versus all class vectors. For example if this class vector contained the classes 'A', 'B', and 'C', the returned array would contain 3 elements: 'A' vs all, 'B' vs all, and 'C' vs all

Returns:
all one versus all class vectors

getAllPairs

public ClassVector[] getAllPairs()
Creates a array containing all pairwise class vectors. For example if this class vector contained the classes 'A', 'B', and 'C', the returned array would contain 2 elements: 'A' vs 'B' and 'B' vs 'C'

Returns:
all pairwise class vectors

getIndices

public int[] getIndices(int classNumber)
Gets the indices in the assignments array that have the specified class number.

Parameters:
classNumber - The class number
Returns:
The indices


Hosted by docs.bugaco.com