def DA_DESeq2(input_path, out_path, mapping_fp, mapping_category, subcategory_1, subcategory_2, DESeq2_diagnostic_plots):
 tmp_bt = load_table(input_path)
 (tmp_pmf, _) = parse_mapping_file_to_dict(mapping_fp)
 check_mapping_file_category(tmp_bt, mapping_fp, mapping_category, subcategory_1, subcategory_2)
 tmp_bt.add_metadata(tmp_pmf, 'sample')
 (base_fname, ext) = splitext(out_path)
 outfile_diagnostic = join((base_fname + '_diagnostic_plots.pdf'))
 with tempfile.NamedTemporaryFile(dir=get_qiime_temp_dir(), prefix='QIIME-differential-abundance-temp-table-', suffix='.biom') as temp_fh:
  temp_fh.write(tmp_bt.to_json('forR'))
  temp_fh.flush()
  run_DESeq2(temp_fh.name, out_path, mapping_category, subcategory_1, subcategory_2, DESeq2_diagnostic_plots, outfile_diagnostic)

def DA_DESeq2 ( input_path , out_path , mapping_fp , mapping_category , subcategory_1 , subcategory_2 , DESeq2_diagnostic_plots ) : tmp_bt = load_table ( input_path ) ( tmp_pmf , _ ) = parse_mapping_file_to_dict ( mapping_fp ) check_mapping_file_category ( tmp_bt , mapping_fp , mapping_category , subcategory_1 , subcategory_2 ) tmp_bt . add_metadata ( tmp_pmf , 'sample' ) ( base_fname , ext ) = splitext ( out_path ) outfile_diagnostic = join ( ( base_fname + '_diagnostic_plots.pdf' ) ) with tempfile . NamedTemporaryFile ( dir = get_qiime_temp_dir ( ) , prefix = 'QIIME-differential-abundance-temp-table-' , suffix = '.biom' ) as temp_fh : temp_fh . write ( tmp_bt . to_json ( 'forR' ) ) temp_fh . flush ( ) run_DESeq2 ( temp_fh . name , out_path , mapping_category , subcategory_1 , subcategory_2 , DESeq2_diagnostic_plots , outfile_diagnostic )
perform deseq2 negative binomial wald differential abundance test on a raw abundance otu matrix .