Clover coverage report - baseCode - 0.2.5
Coverage timestamp: Tue Apr 12 2005 11:31:58 EDT
file stats: LOC: 134   Methods: 3
NCLOC: 79   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
RowAffyNameFilter.java 94.4% 97.3% 100% 96.6%
coverage 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: RowAffyNameFilter.java,v 1.3 2004/07/27 03:18:58 pavlidis Exp $
 19   
  */
 20   
 public class RowAffyNameFilter 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  2
    public RowAffyNameFilter( int[] criteria ) {
 57  2
       this.setCriteria( criteria );
 58   
    }
 59   
 
 60  2
    private void setCriteria( int[] criteria ) {
 61  2
       for ( int i = 0; i < criteria.length; i++ ) {
 62  8
          switch ( criteria[i] ) {
 63   
             case ST: {
 64  2
                skip_ST = true;
 65   
             }
 66   
             case AFFX: {
 67  4
                skip_AFFX = true;
 68   
             }
 69   
             case F: {
 70  6
                skip_F = true;
 71   
             }
 72   
             case X: {
 73  8
                skip_X = true;
 74   
             }
 75   
             case G: {
 76  8
                skip_G = true;
 77   
             }
 78   
             default: {
 79  8
                break;
 80   
             }
 81   
          }
 82   
       }
 83   
    }
 84   
 
 85  2
    public NamedMatrix filter( NamedMatrix data ) {
 86  2
       Vector MTemp = new Vector();
 87  2
       Vector rowNames = new Vector();
 88  2
       int numRows = data.rows();
 89  2
       int numCols = data.columns();
 90   
 
 91  2
       int kept = 0;
 92  2
       for ( int i = 0; i < numRows; i++ ) {
 93  60
          String name = data.getRowName( i );
 94   
 
 95   
          // apply the rules.
 96  60
          if ( skip_ST && name.endsWith( "_st" ) ) { // 'st' means sense strand.
 97  0
             continue;
 98   
          }
 99   
 
 100  60
          if ( skip_AFFX && name.startsWith( "AFFX" ) ) {
 101  2
             continue;
 102   
          }
 103   
 
 104  58
          if ( skip_F && name.endsWith( "_f_at" ) ) { // gene family. We don't
 105   
             // like.
 106  4
             continue;
 107   
          }
 108   
 
 109  54
          if ( skip_X && name.endsWith( "_x_at" ) ) {
 110  2
             continue;
 111   
          }
 112  52
          if ( skip_G && name.endsWith( "_g_at" ) ) {
 113  2
             continue;
 114   
          }
 115  50
          MTemp.add( data.getRowObj( i ) );
 116  50
          rowNames.add( name );
 117  50
          kept++;
 118   
       }
 119   
 
 120  2
       NamedMatrix returnval = getOutputMatrix( data, MTemp.size(), numCols );
 121   
 
 122  2
       for ( int i = 0; i < MTemp.size(); i++ ) {
 123  50
          for ( int j = 0; j < numCols; j++ ) {
 124  600
             returnval.set( i, j, ( ( Object[] ) MTemp.get( i ) )[j] );
 125   
          }
 126   
       }
 127  2
       returnval.setColumnNames( data.getColNames() );
 128  2
       returnval.setRowNames( rowNames );
 129  2
       log.info( "There are " + kept + " rows left after filtering." );
 130   
 
 131  2
       return ( returnval );
 132   
 
 133   
    }
 134   
 }