#NEWLINE# def loadTagDataPandas( tags_filename , design_filename ) : #NEWLINE# #INDENT# 'load tag data for deseq/edger analysis.\n\n    *Infile* is a tab-separated file with counts.\n\n    *design_file* is a tab-separated file with the\n    experimental design with four columns::\n\n      track   include group   pair\n      CW-CD14-R1      0       CD14    1\n      CW-CD14-R2      0       CD14    1\n      CW-CD14-R3      1       CD14    1\n      CW-CD4-R1       1       CD4     1\n      FM-CD14-R1      1       CD14    2\n      FM-CD4-R2       0       CD4     2\n      FM-CD4-R3       0       CD4     2\n      FM-CD4-R4       0       CD4     2\n\n    track\n        name of track - should correspond to column header in *infile*\n    include\n        flag to indicate whether or not to include this data\n    group\n        group indicator - experimental group\n    pair\n        pair that sample belongs to (for paired tests)\n\n    This method creates various R objects:\n\n    countsTable : data frame with counts.\n    groups : vector with groups\n    pairs  : vector with pairs\n\n    ' #NEWLINE# counts_table = pd . read_table ( tags_filename , sep = '\t' , index_col = 0 , comment = '#' ) #NEWLINE# E . info ( ( 'read data: %i observations for %i samples' % counts_table . shape ) ) #NEWLINE# E . debug ( ( 'sample names: %s' % list ( counts_table . columns ) ) ) #NEWLINE# inf = IOTools . openFile ( design_filename ) #NEWLINE# design_table = pd . read_csv ( inf , sep = '\t' , index_col = 0 ) #NEWLINE# inf . close ( ) #NEWLINE# E . debug ( ( 'design names: %s' % list ( design_table . index ) ) ) #NEWLINE# missing = set ( counts_table . columns ) . difference ( design_table . index ) #NEWLINE# if missing : #NEWLINE# #INDENT# E . warn ( ( 'missing samples from design file are ignored: %s' % missing ) ) #NEWLINE# #UNINDENT# design_table = design_table [ ( design_table [ 'include' ] != 0 ) ] #NEWLINE# E . debug ( ( 'included samples: %s' % list ( design_table . index ) ) ) #NEWLINE# counts_table = design_table [ list ( design_table . index ) ] #NEWLINE# E . info ( ( 'filtered data: %i observations for %i samples' % counts_table . shape ) ) #NEWLINE# return ( counts_table , design_table )