示例#1
0
def main():
    # parse command line
    option_parser, opts, args = parse_command_line_parameters(**script_info)
    
    # ensure metadata is present and real-valued
    validate_metadata(opts.map_fp, opts.gradient_variable)

    # run detrending    
    detrend_pcoa(opts.input_fp,
                   map_fp=opts.map_fp,
                   gradient_variable=opts.gradient_variable,
                   suppress_prerotate=opts.suppress_prerotate,
                   output_dir=opts.output_dir)
示例#2
0
    def test_detrend_gradient_no_prerotate(self):
        """Ensure that detrending runs and produces expected files
           with associated gradient.

        """
        results = detrend_pcoa(
            input_fp=self.tmp_pc_fp,
            map_fp=self.tmp_map_fp,
            gradient_variable="Gradient",
            suppress_prerotate=True,
            output_dir=self.output_dir,
            HALT_EXEC=False,
        )

        # check formatting of summary file
        lines = results["summary"].readlines()
        self.assertEqual(len(lines), 4)

        # check formatting of coords file
        lines = results["coords"].readlines()
        # ensure one line per sample in detrended pcoa
        self.assertEqual(len(lines), len(test_pc.split("\n")) - 4)
        # ensure three columns tab delimited
        self.assertEqual(len(lines[0].split("\t")), 3)

        # ensure that plot pdf is at least present
        self.assertEqual(str(type(results["plot"])), "<type 'file'>")
示例#3
0
    def test_detrend_gradient(self):
        """Ensure that detrending runs and produces expected files
           with associated gradient.
           
        """
        results = detrend_pcoa(input_fp=self.tmp_pc_fp,
                               map_fp=self.tmp_map_fp,
                               gradient_variable='Gradient',
                               suppress_prerotate=False,
                               output_dir=self.output_dir,
                               HALT_EXEC=False)

        # check formatting of summary file
        lines = results['summary'].readlines()
        self.assertEqual(len(lines), 4)

        # check formatting of coords file
        lines = results['coords'].readlines()
        # ensure one line per sample in detrended pcoa
        self.assertEqual(len(lines), len(test_pc.split('\n')) - 4)
        # ensure three columns tab delimited
        self.assertEqual(len(lines[0].split('\t')), 3)

        # ensure that plot pdf is at least present
        self.assertEqual(str(type(results['plot'])), "<type 'file'>")
示例#4
0
文件: detrend.py 项目: Jorge-C/qiime
def main():
    # parse command line
    option_parser, opts, args = parse_command_line_parameters(**script_info)
    
    # can't pass map without column header
    if opts.map_fp is not None and opts.gradient_variable is None:
        option_parser.error("Cannot pass -m/--map_fp without -c/--gradient_variable.")

    # ensure metadata is present and real-valued
    if opts.map_fp is not None:
        validate_metadata(opts.map_fp, opts.gradient_variable)

    # run detrending    
    detrend_pcoa(opts.input_fp,
                   map_fp=opts.map_fp,
                   gradient_variable=opts.gradient_variable,
                   suppress_prerotate=opts.suppress_prerotate,
                   output_dir=opts.output_dir)
示例#5
0
def main():
    # parse command line
    option_parser, opts, args = parse_command_line_parameters(**script_info)
    
    # can't pass map without column header
    if opts.map_fp is not None and opts.gradient_variable is None:
        option_parser.error("Cannot pass -m/--map_fp without -c/--gradient_variable.")

    # ensure metadata is present and real-valued
    if opts.map_fp is not None:
        validate_metadata(opts.map_fp, opts.gradient_variable)

    # run detrending    
    detrend_pcoa(opts.input_fp,
                   map_fp=opts.map_fp,
                   gradient_variable=opts.gradient_variable,
                   suppress_prerotate=opts.suppress_prerotate,
                   output_dir=opts.output_dir)
示例#6
0
    def test_detrend_no_gradient(self):
        """Ensure that detrending runs and produces expected files
           with no associated gradient.

        """
        results = detrend_pcoa(input_fp=self.tmp_pc_fp,
                               map_fp=None, gradient_variable=None,
                               suppress_prerotate=False, output_dir=self.output_dir,
                               HALT_EXEC=False)
        self.assertEqual(results['summary'], None)
        coords = results['coords']
        lines = coords.readlines()

        # ensure one line per sample in detrended pcoa
        self.assertEqual(len(lines), len(test_pc.split('\n')) - 4)
        # ensure three columns tab delimited
        self.assertEqual(len(lines[0].split('\t')), 3)
示例#7
0
    def test_detrend_no_gradient(self):
        """Ensure that detrending runs and produces expected files
           with no associated gradient.

        """
        results = detrend_pcoa(input_fp=self.tmp_pc_fp,
                               map_fp=None, gradient_variable=None,
                               suppress_prerotate=False, output_dir=self.output_dir,
                               HALT_EXEC=False)
        self.assertEqual(results['summary'], None)
        coords = results['coords']
        lines = coords.readlines()

        # ensure one line per sample in detrended pcoa
        self.assertEqual(len(lines), len(test_pc.split('\n')) - 4)
        # ensure three columns tab delimited
        self.assertEqual(len(lines[0].split('\t')), 3)