
import numpy  as np
import pandas as pd

################################################################################

def readCountData(fname, classes = None, *args, **kargs):    
    df = pd.read_table(fname, *args, **kargs)

    ## add attributes      
    df.counts    = df.values  
    df.exposures = df.sum() / df.sum().astype('double') #df.sum() / df.sum().max().astype('double') 
    df.samples   = df.columns
    df.genes     = df.index
    
    ## classes
    if classes is None:
        df.classes = np.arange(df.samples.size).astype('str')
    else:
        df.classes = classes
                    
    return df
    
################################################################################


import numpy  as np
import pandas as pd

################################################################################

def readCountData(fname, classes = None, *args, **kargs):    
    df = pd.read_table(fname, *args, **kargs)

    ## add attributes      
    df.counts    = df.values  
    df.exposures = df.sum() / df.sum().max().astype('double') 
    df.samples   = df.columns
    df.genes     = df.index
    
    ## classes
    if classes is None:
        df.classes = np.arange(df.samples.size).astype('str')
    else:
        df.classes = classes
                    
    return df
    
################################################################################

Normalize by the size of the library
Normalize by the size of the library

  
  import numpy  as np
  import pandas as pd
  
  ################################################################################
  
  def readCountData(fname, classes = None, *args, **kargs):    
      df = pd.read_table(fname, *args, **kargs)
  
      ## add attributes      
      df.counts    = df.values  
-     df.exposures = df.sum() / df.sum().astype('double') #df.sum() / df.sum().max().astype('double') 
+     df.exposures = df.sum() / df.sum().max().astype('double') 
      df.samples   = df.columns
      df.genes     = df.index
      
      ## classes
      if classes is None:
          df.classes = np.arange(df.samples.size).astype('str')
      else:
          df.classes = classes
                      
      return df
      
  ################################################################################
  
Normalize by the size of the library
## Code Before:

import numpy  as np
import pandas as pd

################################################################################

def readCountData(fname, classes = None, *args, **kargs):    
    df = pd.read_table(fname, *args, **kargs)

    ## add attributes      
    df.counts    = df.values  
    df.exposures = df.sum() / df.sum().astype('double') #df.sum() / df.sum().max().astype('double') 
    df.samples   = df.columns
    df.genes     = df.index
    
    ## classes
    if classes is None:
        df.classes = np.arange(df.samples.size).astype('str')
    else:
        df.classes = classes
                    
    return df
    
################################################################################

## Instruction:
Normalize by the size of the library
## Code After:

import numpy  as np
import pandas as pd

################################################################################

def readCountData(fname, classes = None, *args, **kargs):    
    df = pd.read_table(fname, *args, **kargs)

    ## add attributes      
    df.counts    = df.values  
    df.exposures = df.sum() / df.sum().max().astype('double') 
    df.samples   = df.columns
    df.genes     = df.index
    
    ## classes
    if classes is None:
        df.classes = np.arange(df.samples.size).astype('str')
    else:
        df.classes = classes
                    
    return df
    
################################################################################
