Example #1
0
__credits__ = ["Greg Caporaso"]
__license__ = "GPL"
__version__ = "1.9.1-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "*****@*****.**"

import numpy as np
from biom import load_table
from biom.exception import UnknownAxisError

from qiime.util import (parse_command_line_parameters, make_option,
                         write_biom_table)
from qiime.group import (collapse_samples, get_collapse_fns,
                          mapping_lines_from_collapsed_df)

collapse_fns = get_collapse_fns()
collapse_modes = collapse_fns.keys()

script_info = {}
script_info['brief_description'] = "Collapse samples in a BIOM table and mapping file."
script_info['script_description'] = ("Collapse samples in a BIOM table and mapping file. "
    "Values in the BIOM table are collapsed in one of several different ways; see the "
    "available options for --collapse_mode. Values in the mapping file are collapsed "
    "by grouping the values if they differ for the grouped samples, and by providing the single "
    "value if they don't differ for the grouped samples.")
script_info['script_usage'] = [
    ("Collapse samples in biom table and mapping file",
     "Collapse samples by taking the median value for each observation in each group, where group is defined by having the same values for subject in the mapping file.",
     "%prog -b table.biom -m map.txt --output_biom_fp collapsed.biom --output_mapping_fp collapsed_map.txt --collapse_mode median --collapse_fields subject"),
    ("Collapse samples in biom table and mapping file",
     "Collapse samples by taking the median value for each observation in each group, where group is defined by having the same values for both subject and replicate-group in the mapping file.",