humann/tools/split_table.py
def split_gene_table(gene_table,output_dir, verbose=None, taxonomy_index=None,
                     taxonomy_level=None):
    """
    Split the gene table into a table per sample
    """
    
    # try to open the file
    try:
        file_handle=open(gene_table,"rt")
        line=file_handle.readline()
    except EnvironmentError:
        sys.exit("Unable to read file: " + gene_table)
            
    # find the headers
    header_flag=False
    header=line
    while re.match(GENE_TABLE_COMMENT_LINE, line):
        header_flag=True
        header = line
        line = file_handle.readline()
        
    # if no headers are present, then use the first line as the header
    if not header_flag:
        line = file_handle.readline()
        
    # check for picrust metagenome file format
    if re.search(PICRUST_METAGENOME_HEADER,header):
        new_file_names=split_table_sample_rows(file_handle, line, output_dir, verbose, taxonomy_level)
    else:
        new_file_names=split_table_sample_columns(file_handle, header, line, output_dir, taxonomy_index, verbose)
        
    return new_file_names

    Split the gene table into a table per sample
    
Split the gene table into a table per sample
Split the gene table into a table per sample
def split_gene_table(gene_table,output_dir, verbose=None, taxonomy_index=None,
                     taxonomy_level=None):
    try:
        file_handle=open(gene_table,"rt")
        line=file_handle.readline()
    except EnvironmentError:
        sys.exit("Unable to read file: " + gene_table)
    header_flag=False
    header=line
    while re.match(GENE_TABLE_COMMENT_LINE, line):
        header_flag=True
        header = line
        line = file_handle.readline()
    if not header_flag:
        line = file_handle.readline()
    if re.search(PICRUST_METAGENOME_HEADER,header):
        new_file_names=split_table_sample_rows(file_handle, line, output_dir, verbose, taxonomy_level)
    else:
        new_file_names=split_table_sample_columns(file_handle, header, line, output_dir, taxonomy_index, verbose)
    return new_file_names
def split_gene_table ( gene_table , output_dir , verbose = None , taxonomy_index = None , taxonomy_level = None ) : try : file_handle = open ( gene_table , "rt" ) line = file_handle . readline ( ) except EnvironmentError : sys . exit ( "Unable to read file: " + gene_table ) header_flag = False header = line while re . match ( GENE_TABLE_COMMENT_LINE , line ) : header_flag = True header = line line = file_handle . readline ( ) if not header_flag : line = file_handle . readline ( ) if re . search ( PICRUST_METAGENOME_HEADER , header ) : new_file_names = split_table_sample_rows ( file_handle , line , output_dir , verbose , taxonomy_level ) else : new_file_names = split_table_sample_columns ( file_handle , header , line , output_dir , taxonomy_index , verbose ) return new_file_names
Split the gene table into a table per sample
Split the gene table into a table per sample
"""
    Split the gene table into a table per sample
    """ # try to open the file # find the headers # if no headers are present, then use the first line as the header # check for picrust metagenome file format
gene_table
output_dir
verbose
taxonomy_index
taxonomy_level