Class GeneList

java.lang.Object
  |
  +--GeneList

class GeneList
extends java.lang.Object

The GeneList class manipulate lists of genes (clones, oligos, etc). A GeneList contains a subset of all genes in the database. It contains both a GeneBitSet bitset and an mList[0:length-1] containing MIDs sorted by whatever criteria are desired. The the index of mList[] does NOT imply the 1:1 ordering of genes as it is for midStaticCL.mList[] and GridCoords.gid2fgrc[].
Note: all gene GeneList instances have a GeneBitSet but may or may not have a mList[].

This class represents an individual gene list entry.

Note: gene sets are part of GeneLists and are implemented as GeneBitSet instances. Binary set operations are handled at the bit set level and are order N/64 using 64-bit long-word logical operations instead being O(N*N) if convolving mList[]'s are required.

In the places where we must work with an explicit mList[], the mList[] is defined otherwise it is set to null. Therefore, operations which update the bitSet will also update the mList[] if it is not null.

This work was produced by Peter Lemkin of the National Cancer Institute, an agency of the United States Government. As a work of the United States Government there is no associated copyright. It is offered as open source software under the Mozilla Public License (version 1.1) subject to the limitations noted in the accompanying LEGAL file. This notice must be included with the code. The MAExplorer Mozilla and Legal files are available on http://maexplorer.sourceforge.net/.

Version:
$Date: 2003/07/18 17:15:04 $ / $Revision: 1.12 $
Author:
P. Lemkin (NCI), G. Thornwall (SAIC), NCI-Frederick, Frederick, MD
See Also:
MAExplorer Home

Field Summary
(package private)  GeneBitSet bitSet
           
(package private)  java.lang.String cName
          instance: name of gene list
private static GeneList[] geneSets
          list of all gene lists
(package private)  int length
          # of genes used in this gene list
private  MAExplorer mae
          link to global MAExplorer instance
(package private)  int MAX_GENE_LISTS
          max # of gene lists(or sets) to allow
(package private) static int maxGeneListSize
          & number of geneSets
(package private) static int maxGeneSets
          # of gene sets - keep title in gene set
(package private)  int maxSize
          maximum allocation size
(package private)  Gene[] mList
          instance: (opt) sorted list of Gene objects.
private static GeneList tempSetCL
          temporary GeneList used in set operations
(package private) static int useGeneSetIndex
          GeneSet to use for Current Gene Class.
 
Constructor Summary
(package private) GeneList(MAExplorer mae, int maxGeneListSize)
          GeneList() - constructor to specify list sizes with both mList[] and bitSet.
(package private) GeneList(MAExplorer mae, int maxGeneListSize, java.lang.String cName)
          GeneList() - constructor to make new Gene named list with both mList[] and bitSet.
(package private) GeneList(MAExplorer mae, int maxGeneListSize, java.lang.String cName, boolean createMlistFlag)
          GeneList() - constructor to make new Gene named list with bitSet but optional mList[].
 
Method Summary
(package private)  boolean addGene(Gene c)
          addGene() - add Gene to gene list bitSet, and mList[] if it exists.
private  void allocGeneList(int maxGeneListSize, java.lang.String cName, boolean createMlistFlag)
          allocGeneList() - constructor to make new Gene named list with bitSet, but optional mList[].
(package private)  void cleanup()
          cleanup() - cleanup global static allocated variables in this class.
(package private)  boolean clear()
          clear() - clear gene list length and bitSet, but keep mList[] data
(package private)  boolean clearMlist()
          clearMlist() - clear gene mList[] entries to null.
(package private)  boolean clearNull()
          clearNull() - clear bitSet and gene mList[], set entries to null.
(package private)  boolean compressGeneList()
          compressGeneList() - compress the mList[] by removing nulls if any.
(package private)  boolean copy(GeneList c1, GeneList c2)
          copy() - copy GeneList mList[] and bitSets of c2 to c1.
(package private)  boolean copySorted(GeneList c1, GeneList c2)
          copySorted() - copy GeneList mList[] sorted, and bitSets of c2 to c1.
(package private)  boolean difference(GeneList c1, GeneList c2, GeneList c3)
          difference() - compute difference of gene lists (c2 - c1)==> c3.
(package private)  Gene[] getGeneList()
          getGeneList() - get gene mList[] data as Gene[].
(package private)  GeneList getGeneListByName(java.lang.String geneListName)
          getGeneListByName() - get GeneList if geneListName is a valid GeneList cName.
(package private)  boolean intersection(GeneList c1, GeneList c2, GeneList c3)
          intersection() - compute intersection of GeneLists (c1 & c2) ==> c3.
(package private)  boolean isGeneInGeneList(Gene c)
          isGeneInGeneList() - test if gene is in GeneList.
(package private)  boolean isGIDinGeneList(int gid)
          isGIDinGeneList() - test if GridCoords gid in GeneList.
(package private)  boolean isMIDinGeneList(int mid)
          isMIDinGeneList() - test if Gene id (mid) is in GeneList.
(package private)  boolean rmvGene(Gene c)
          rmvGene() - remove Gene from gene list and bitSet.
(package private)  boolean setGene(Gene c, int idx)
          setGene() - set Gene to specific gene list mList[idx].
(package private)  boolean setGeneListFromGeneNameArray(java.lang.String[] geneNameList)
          setGeneListFromGeneNameArray() - set the GeneList from array of gene names.
(package private)  boolean shortenGeneList()
          shortenGeneList() - shorten the mList[] to save space.
(package private)  boolean union(GeneList c1, GeneList c2, GeneList c3)
          union() - compute union of gene lists (c1 & c2) ==> c3.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

mae

private MAExplorer mae
link to global MAExplorer instance

MAX_GENE_LISTS

final int MAX_GENE_LISTS
max # of gene lists(or sets) to allow

maxGeneSets

static int maxGeneSets
# of gene sets - keep title in gene set

useGeneSetIndex

static int useGeneSetIndex
GeneSet to use for Current Gene Class. If there is a gene set, let it be >0. 0 is the set of ALL GENES

maxGeneListSize

static int maxGeneListSize
& number of geneSets

geneSets

private static GeneList[] geneSets
list of all gene lists

tempSetCL

private static GeneList tempSetCL
temporary GeneList used in set operations

cName

java.lang.String cName
instance: name of gene list

mList

Gene[] mList
instance: (opt) sorted list of Gene objects. allocated [0:maxSize-1] active [0:length-1]

bitSet

GeneBitSet bitSet

maxSize

int maxSize
maximum allocation size

length

int length
# of genes used in this gene list
Constructor Detail

GeneList

GeneList(MAExplorer mae,
         int maxGeneListSize)
GeneList() - constructor to specify list sizes with both mList[] and bitSet.
Parameters:
mae - is instance of MAExplorer
maxGeneListSize - is max size of any gene list
See Also:
allocGeneList(int, java.lang.String, boolean)

GeneList

GeneList(MAExplorer mae,
         int maxGeneListSize,
         java.lang.String cName)
GeneList() - constructor to make new Gene named list with both mList[] and bitSet.
Parameters:
mae - is instance of MAExplorer
maxGeneListSize - is max size of any gene list
cName - is name of the gene list
See Also:
allocGeneList(int, java.lang.String, boolean)

GeneList

GeneList(MAExplorer mae,
         int maxGeneListSize,
         java.lang.String cName,
         boolean createMlistFlag)
GeneList() - constructor to make new Gene named list with bitSet but optional mList[].
Parameters:
mae - is instance of MAExplorer
maxGeneListSize - is max size of any gene list
cName - is name of the gene list
createMlistFlag - creates the mList[] if true
See Also:
allocGeneList(int, java.lang.String, boolean)
Method Detail

allocGeneList

private void allocGeneList(int maxGeneListSize,
                           java.lang.String cName,
                           boolean createMlistFlag)
allocGeneList() - constructor to make new Gene named list with bitSet, but optional mList[].
Parameters:
maxGeneListSize - is max size of any gene list
cName - is name of the gene list
createMlistFlag - creates the mList[] if true
See Also:
GeneBitSet

setGene

boolean setGene(Gene c,
                int idx)
setGene() - set Gene to specific gene list mList[idx]. It also extends the list. NOTE: There may be mList[] entries with null values. So be careful when use the list.
Parameters:
c - is the gene instance
idx - is the index of where to put it in the mList[]
Returns:
true if set, false if any problems.
See Also:
GeneBitSet.setItem(int)

addGene

boolean addGene(Gene c)
addGene() - add Gene to gene list bitSet, and mList[] if it exists.
Parameters:
c - is the gene instance
Returns:
true if added, false if already in the list
See Also:
GeneBitSet.addItem(int), GeneBitSet.isItemInGeneBitSet(int)

rmvGene

boolean rmvGene(Gene c)
rmvGene() - remove Gene from gene list and bitSet.
Parameters:
c - is the gene instance
Returns:
true if removed it, false if not found.
See Also:
GeneBitSet.isItemInGeneBitSet(int), GeneBitSet.rmvItem(int)

setGeneListFromGeneNameArray

boolean setGeneListFromGeneNameArray(java.lang.String[] geneNameList)
setGeneListFromGeneNameArray() - set the GeneList from array of gene names. This allows MULTIPLE instances of gene to be added to the GeneList.
Parameters:
geneNameList - is the string list of gene names
Returns:
TRUE if succeed.
See Also:
GipoTable.getAllMIDsForGene(java.lang.String, int), addGene(Gene), clear()

shortenGeneList

boolean shortenGeneList()
shortenGeneList() - shorten the mList[] to save space. Reallocate a new array and shorten it. This does not affect the bitSet.
Returns:
true if succeed

compressGeneList

boolean compressGeneList()
compressGeneList() - compress the mList[] by removing nulls if any. This does not affect the bitSet.
Returns:
true if succeed
See Also:
GeneBitSet.copyCLtoBS(GeneBitSet, GeneList, boolean)

isGeneInGeneList

boolean isGeneInGeneList(Gene c)
isGeneInGeneList() - test if gene is in GeneList. Uses bit sets so don't have to enumerate the mList[] to check.
Parameters:
c - is the Gene to test
Returns:
true if gene is in the GeneList.
See Also:
GeneBitSet.isItemInGeneBitSet(int)

isMIDinGeneList

boolean isMIDinGeneList(int mid)
isMIDinGeneList() - test if Gene id (mid) is in GeneList. Uses bit sets so don't have to enumerate the mList[] to check.
Parameters:
mid - is the MID of gene to test
Returns:
true if gene is in the gene list
See Also:
GeneBitSet.isItemInGeneBitSet(int)

isGIDinGeneList

boolean isGIDinGeneList(int gid)
isGIDinGeneList() - test if GridCoords gid in GeneList. Uses bit sets so don't have to enumerate the mList[] to check.
Parameters:
gid - is the GID of gene to test
Returns:
true if gene is in the gene list
See Also:
GeneBitSet.isItemInGeneBitSet(int)

getGeneList

Gene[] getGeneList()
getGeneList() - get gene mList[] data as Gene[]. Make mList[] if required.
Returns:
list of Genes
See Also:
GeneBitSet.cvtBStoCL(GeneList)

getGeneListByName

GeneList getGeneListByName(java.lang.String geneListName)
getGeneListByName() - get GeneList if geneListName is a valid GeneList cName.
Returns:
gene list or null if invalid name

clear

boolean clear()
clear() - clear gene list length and bitSet, but keep mList[] data
Returns:
true if successful.
See Also:
GeneBitSet.clearNull()

clearMlist

boolean clearMlist()
clearMlist() - clear gene mList[] entries to null.
Returns:
true if successful.

clearNull

boolean clearNull()
clearNull() - clear bitSet and gene mList[], set entries to null.
Returns:
true if successful.
See Also:
GeneBitSet.clearNull(), clearMlist()

copySorted

boolean copySorted(GeneList c1,
                   GeneList c2)
copySorted() - copy GeneList mList[] sorted, and bitSets of c2 to c1. You can rename c1 if the name is not null, else it keeps old name.
Parameters:
c1 - is first gene list
c2 - is 2nd gene list
Returns:
true if succeed.
See Also:
GeneBitSet.copyBStoBS(GeneBitSet, GeneBitSet)

copy

boolean copy(GeneList c1,
             GeneList c2)
copy() - copy GeneList mList[] and bitSets of c2 to c1.
Parameters:
c1 - is first gene list
c2 - is 2nd gene list
Returns:
true if succeed.
See Also:
GeneBitSet.copyBStoBS(GeneBitSet, GeneBitSet), GeneBitSet.copyBStoCL(GeneList, GeneBitSet)

union

boolean union(GeneList c1,
              GeneList c2,
              GeneList c3)
union() - compute union of gene lists (c1 & c2) ==> c3. Then, copy the results into c3. Note: c1 or c2 can be the same as c3. It will copy the result AFTER it has been computed.
Parameters:
c1 - is first gene list
c2 - is 2nd gene list
c3 - is 2nd gene list
Returns:
true if successful.
See Also:
GeneBitSet.copyBStoBS(GeneBitSet, GeneBitSet), GeneBitSet.copyBStoCL(GeneList, GeneBitSet), GeneBitSet.union(GeneBitSet, GeneBitSet, GeneBitSet)

intersection

boolean intersection(GeneList c1,
                     GeneList c2,
                     GeneList c3)
intersection() - compute intersection of GeneLists (c1 & c2) ==> c3. Then, copy the results into c3. Note: c1 or c2 can be the same as c3. It will copy the result AFTER it has been computed.
Parameters:
c1 - is first gene list
c2 - is 2nd gene list
c3 - is 2nd gene list
Returns:
true if successful.
See Also:
GeneBitSet.copyBStoBS(GeneBitSet, GeneBitSet), GeneBitSet.copyBStoCL(GeneList, GeneBitSet), GeneBitSet.intersection(GeneBitSet, GeneBitSet, GeneBitSet)

difference

boolean difference(GeneList c1,
                   GeneList c2,
                   GeneList c3)
difference() - compute difference of gene lists (c2 - c1)==> c3. Then, copy the result into c3. Note: c1 or c2 can be the same as c3. It will copy the result AFTER it has been computed.
Parameters:
c1 - is first gene list
c2 - is 2nd gene list
c3 - is 2nd gene list
Returns:
true if successful.
See Also:
GeneBitSet.copyBStoBS(GeneBitSet, GeneBitSet), GeneBitSet.copyBStoCL(GeneList, GeneBitSet), GeneBitSet.difference(GeneBitSet, GeneBitSet, GeneBitSet)

cleanup

void cleanup()
cleanup() - cleanup global static allocated variables in this class. If statics are added later to this class, then set them to null here.