def multiple_file_DA_fitZIG(input_dir, output_dir, mapping_fp, mapping_category, subcategory_1, subcategory_2):
 if (not exists(output_dir)):
  makedirs(output_dir)
 file_names = [fname for fname in listdir(input_dir) if (not (fname.startswith('.') or isdir(fname)))]
 for fname in file_names:
  (base_fname, ext) = splitext(fname)
  original_fname = (base_fname + '.biom')
  hdf5_infile = join(input_dir, original_fname)
  tmp_bt = load_table(hdf5_infile)
  (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')
  outfile = join(output_dir, (('fitZIG_DA_' + base_fname) + '.txt'))
  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_fitZIG(temp_fh.name, outfile, mapping_category, subcategory_1, subcategory_2)

def multiple_file_DA_fitZIG ( input_dir , output_dir , mapping_fp , mapping_category , subcategory_1 , subcategory_2 ) : if ( not exists ( output_dir ) ) : makedirs ( output_dir ) file_names = [ fname for fname in listdir ( input_dir ) if ( not ( fname . startswith ( '.' ) or isdir ( fname ) ) ) ] for fname in file_names : ( base_fname , ext ) = splitext ( fname ) original_fname = ( base_fname + '.biom' ) hdf5_infile = join ( input_dir , original_fname ) tmp_bt = load_table ( hdf5_infile ) ( 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' ) outfile = join ( output_dir , ( ( 'fitZIG_DA_' + base_fname ) + '.txt' ) ) 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_fitZIG ( temp_fh . name , outfile , mapping_category , subcategory_1 , subcategory_2 )
perform metagenomeseqs zero inflated gaussian otu differential abundance test on a directory of raw abundance otu matrices .