Clover coverage report - baseCode - 0.2.5
Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT
file stats: LOC: 143   Methods: 4
NCLOC: 82   Classes: 1
30 day Evaluation Version distributed via the Maven Jar Repository. Clover is not free. You have 30 days to evaluate it. Please visit http://www.thecortex.net/clover to obtain a licensed version of Clover
 
 Source file Conditionals Statements Methods TOTAL
AffymetrixProbeNameFilter.java 0% 0% 0% 0%
coverage
 1   
 package baseCode.dataFilter;
 2   
 
 3   
 import java.util.Vector;
 4   
 
 5   
 import baseCode.dataStructure.matrix.NamedMatrix;
 6   
 
 7   
 /**
 8   
  * Remove probes that have names meeting certain rules indicating they may have low reliability. This is targeted at
 9   
  * cases like "AFFX", "_st", "_f_at" and so forth.
 10   
  * <p>
 11   
  * Copyright (c) 2004
 12   
  * </p>
 13   
  * <p>
 14   
  * Institution:: Columbia University
 15   
  * </p>
 16   
  * 
 17   
  * @author Paul Pavlidis
 18   
  * @version $Id: AffymetrixProbeNameFilter.java,v 1.12 2004/08/17 21:17:40 pavlidis Exp $
 19   
  */
 20   
 public class AffymetrixProbeNameFilter extends AbstractFilter implements Filter {
 21   
 
 22   
    private boolean skip_ST = false;
 23   
    private boolean skip_AFFX = false;
 24   
    private boolean skip_F = false;
 25   
    private boolean skip_X = false;
 26   
    private boolean skip_G = false;
 27   
 
 28   
    /**
 29   
     * Filter probes that contain the '_st' (sense strand) tag
 30   
     */
 31   
    public static final int ST = 1;
 32   
 
 33   
    /**
 34   
     * Filter probes that have the AFFX prefix.
 35   
     */
 36   
    public static final int AFFX = 2;
 37   
 
 38   
    /**
 39   
     * Filter probes that have the "_f_at" (family) tag.
 40   
     */
 41   
    public static final int F = 3;
 42   
 
 43   
    /**
 44   
     * Filter probes that have the "_x_at" tag.
 45   
     */
 46   
    public static final int X = 4;
 47   
 
 48   
    /**
 49   
     * Filter probes that have the "_g_at" (group) tag.
 50   
     */
 51   
    public static final int G = 5;
 52   
 
 53   
    /**
 54   
     * @param criteria int[] of constants indicating the criteria to use.
 55   
     */
 56  0
    public AffymetrixProbeNameFilter( int[] criteria ) {
 57  0
       this.setCriteria( criteria );
 58   
    }
 59   
    
 60   
    /**
 61   
     * Filter probes with all criteria switched on.
 62   
     *
 63   
     */
 64  0
    public AffymetrixProbeNameFilter(   ) {
 65  0
       this.setCriteria( new int[] {1,2,3,4,5} );
 66   
    }
 67   
    
 68   
 
 69  0
    private void setCriteria( int[] criteria ) {
 70  0
       for ( int i = 0; i < criteria.length; i++ ) {
 71  0
          switch ( criteria[i] ) {
 72   
             case ST: {
 73  0
                skip_ST = true;
 74   
             }
 75   
             case AFFX: {
 76  0
                skip_AFFX = true;
 77   
             }
 78   
             case F: {
 79  0
                skip_F = true;
 80   
             }
 81   
             case X: {
 82  0
                skip_X = true;
 83   
             }
 84   
             case G: {
 85  0
                skip_G = true;
 86   
             }
 87   
             default: {
 88  0
                break;
 89   
             }
 90   
          }
 91   
       }
 92   
    }
 93   
 
 94  0
    public NamedMatrix filter( NamedMatrix data ) {
 95  0
       Vector MTemp = new Vector();
 96  0
       Vector rowNames = new Vector();
 97  0
       int numRows = data.rows();
 98  0
       int numCols = data.columns();
 99   
 
 100  0
       int kept = 0;
 101  0
       for ( int i = 0; i < numRows; i++ ) {
 102  0
          String name = data.getRowName( i );
 103   
 
 104   
          // apply the rules.
 105  0
          if ( skip_ST && name.endsWith( "_st" ) ) { // 'st' means sense strand.
 106  0
             continue;
 107   
          }
 108   
 
 109  0
          if ( skip_AFFX && name.startsWith( "AFFX" ) ) {
 110  0
             continue;
 111   
          }
 112   
 
 113  0
          if ( skip_F && name.endsWith( "_f_at" ) ) { // gene family. We don't
 114   
             // like.
 115  0
             continue;
 116   
          }
 117   
 
 118  0
          if ( skip_X && name.endsWith( "_x_at" ) ) {
 119  0
             continue;
 120   
          }
 121  0
          if ( skip_G && name.endsWith( "_g_at" ) ) {
 122  0
             continue;
 123   
          }
 124  0
          MTemp.add( data.getRowObj( i ) );
 125  0
          rowNames.add( name );
 126  0
          kept++;
 127   
       }
 128   
 
 129  0
       NamedMatrix returnval = getOutputMatrix( data, MTemp.size(), numCols );
 130   
 
 131  0
       for ( int i = 0; i < MTemp.size(); i++ ) {
 132  0
          for ( int j = 0; j < numCols; j++ ) {
 133  0
             returnval.set( i, j, ( ( Object[] ) MTemp.get( i ) )[j] );
 134   
          }
 135   
       }
 136  0
       returnval.setColumnNames( data.getColNames() );
 137  0
       returnval.setRowNames( rowNames );
 138  0
       log.info( "There are " + kept + " rows left after filtering." );
 139   
 
 140  0
       return ( returnval );
 141   
 
 142   
    }
 143   
 }