Beispiel #1
0
    def setUp(self):
        self.qiime_config = load_qiime_config()
        self.tmp_dir = self.qiime_config['temp_dir'] or '/tmp/'

        #Temporary input file
        fd, self.tmp_otu_fp = mkstemp(dir=self.tmp_dir,
                                      prefix='R_test_otu_table_',
                                      suffix='.biom')
        close(fd)
        seq_file = open(self.tmp_otu_fp, 'w')
        seq_file.write(test_otu_table)
        seq_file.close()

        self.tmp_otu_fp_out_CSS = '%s/R_test_otu_table_out_CSS.biom' % (str(
            self.tmp_dir))
        self.tmp_otu_fp_out_DESeq = '%s/R_test_otu_table_out_DESeq.biom' % (
            str(self.tmp_dir))

        self.files_to_remove = \
            [self.tmp_otu_fp, self.tmp_otu_fp_out_CSS, self.tmp_otu_fp_out_DESeq]

        normalize_CSS(self.tmp_otu_fp,
                      self.tmp_otu_fp_out_CSS,
                      output_CSS_statistics=False)
        normalize_DESeq2(self.tmp_otu_fp,
                         self.tmp_otu_fp_out_DESeq,
                         DESeq_negatives_to_zero=False)
    def test_normalize_table_DESeq2(self):
        normalize_DESeq2(self.tmp_otu_fp,
                         self.tmp_otu_fp_out_DESeq,
                         DESeq_negatives_to_zero=False)
        input_table = load_table(self.tmp_otu_fp)
        output_table = load_table(self.tmp_otu_fp_out_DESeq)

        self.compare_tables(input_table, output_table)
    def setUp(self):
        self.qiime_config = load_qiime_config()
        self.tmp_dir = self.qiime_config['temp_dir'] or '/tmp/'

        #Temporary input file
        fd, self.tmp_otu_fp = mkstemp(dir= self.tmp_dir,
                                      prefix='R_test_otu_table_',
                                      suffix='.biom')
        close(fd)
        seq_file = open(self.tmp_otu_fp, 'w')
        seq_file.write(test_otu_table)
        seq_file.close()

        self.tmp_otu_fp_out_CSS = '%s/R_test_otu_table_out_CSS.biom' % (str(self.tmp_dir))
        self.tmp_otu_fp_out_DESeq = '%s/R_test_otu_table_out_DESeq.biom' % (str(self.tmp_dir))

        self.files_to_remove = \
            [self.tmp_otu_fp, self.tmp_otu_fp_out_CSS, self.tmp_otu_fp_out_DESeq]

        normalize_CSS(self.tmp_otu_fp, self.tmp_otu_fp_out_CSS, output_CSS_statistics=False)
        normalize_DESeq2(self.tmp_otu_fp, self.tmp_otu_fp_out_DESeq, DESeq_negatives_to_zero=False) 
Beispiel #4
0
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    input_path = opts.input_path
    out_path = opts.out_path
    output_CSS_statistics = opts.output_CSS_statistics
    DESeq_negatives_to_zero = opts.DESeq_negatives_to_zero
    algorithm = opts.algorithm
    list_algorithms = opts.list_algorithms

    if list_algorithms:
        print 'Available normalization algorithms are:\n%s' % ', '.join(
            algorithm_list())
    else:
        almost_required_options = ['input_path', 'out_path']
        for option in almost_required_options:
            if getattr(opts, option) is None:
                option_parser.error('Required option --%s omitted.' % option)
        if algorithm == 'CSS':
            if os.path.isdir(input_path):
                multiple_file_normalize_CSS(input_path, out_path,
                                            output_CSS_statistics)
            elif os.path.isfile(input_path):
                normalize_CSS(input_path, out_path, output_CSS_statistics)
            else:
                # it shouldn't be possible to get here
                option_parser.error("Unknown input type: %s" % input_path)
        elif algorithm == 'DESeq2':
            if os.path.isdir(input_path):
                multiple_file_normalize_DESeq2(input_path, out_path,
                                               DESeq_negatives_to_zero)
            elif os.path.isfile(input_path):
                normalize_DESeq2(input_path, out_path, DESeq_negatives_to_zero)
            else:
                # it shouldn't be possible to get here
                option_parser.error("Unknown input type: %s" % input_path)
        else:
            # it shouldn't be possible to get here
            option_parser.error("Unknown normalization algorithm: %s" %
                                algorithm)
Beispiel #5
0
def main():
    option_parser, opts, args = parse_command_line_parameters(**script_info)

    input_path = opts.input_path
    out_path = opts.out_path
    output_CSS_statistics = opts.output_CSS_statistics
    DESeq_negatives_to_zero = opts.DESeq_negatives_to_zero
    algorithm = opts.algorithm
    list_algorithms = opts.list_algorithms


    if list_algorithms:
        print 'Available normalization algorithms are:\n%s' % ', '.join(algorithm_list())
    else:
        almost_required_options = ['input_path', 'out_path']
        for option in almost_required_options:
            if getattr(opts, option) is None:
                option_parser.error('Required option --%s omitted.' % option)     
        if algorithm == 'CSS':
            if os.path.isdir(input_path):
                multiple_file_normalize_CSS(input_path, out_path, output_CSS_statistics)
            elif os.path.isfile(input_path):
                normalize_CSS(input_path, out_path, output_CSS_statistics)
            else:
                # it shouldn't be possible to get here
                option_parser.error("Unknown input type: %s" % input_path)
        elif algorithm == 'DESeq2':
            if os.path.isdir(input_path):
                multiple_file_normalize_DESeq2(input_path, out_path, DESeq_negatives_to_zero)
            elif os.path.isfile(input_path):
                normalize_DESeq2(input_path, out_path, DESeq_negatives_to_zero)
            else:
                # it shouldn't be possible to get here
                option_parser.error("Unknown input type: %s" % input_path)
        else:
            # it shouldn't be possible to get here
            option_parser.error("Unknown normalization algorithm: %s" % algorithm)
    def test_normalize_table_DESeq2(self):
        normalize_DESeq2(self.tmp_otu_fp, self.tmp_otu_fp_out_DESeq, DESeq_negatives_to_zero=False)
        input_table = load_table(self.tmp_otu_fp)
        output_table = load_table(self.tmp_otu_fp_out_DESeq)

        self.compare_tables(input_table, output_table)