def run_dinosaur(dinosaur_jar_path, mzml_fns, output_folder, spectrum_output_format, params):
    dinosaur_binary = ('java -Xmx%dM -jar %s --seed=1' % (int((params['dinosaurMemory'] * 1000)), dinosaur_jar_path))
    helpers.createDir(output_folder)
    for mzml_fn in mzml_fns:
        baseFN = helpers.getBase(helpers.getFileName(mzml_fn))
        dinosaur_output_file = os.path.join(output_folder, (baseFN + '.features.tsv'))
        if (not os.path.isfile(dinosaur_output_file)):
            cmd_dinosaur = ('%s --force --outDir=%s %s %s;' % (dinosaur_binary, output_folder, params['dinosaurFlags'], mzml_fn))
            helpers.executeCmd(cmd_dinosaur)
        else:
            print(('Found dinosaur output file at %s, remove this file to re-run Dinosaur on this file' % dinosaur_output_file))
        output_fn = os.path.join(output_folder, (baseFN + '.dummy.txt'))
        if spectrum_output_format:
            output_fn = os.path.join(output_folder, ((baseFN + '.recalibrated.') + spectrum_output_format))
        params['specPrecMapFile'] = os.path.join(output_folder, (baseFN + '.feature_map.tsv'))
        if (not os.path.isfile(params['specPrecMapFile'])):
            quant.add_accurate_precursors(dinosaur_output_file, mzml_fn, output_fn, params)
            if output_fn.endswith('.dummy.txt'):
                os.remove(output_fn)
        else:
            print(('Found dinosaur mapping file at %s, remove this file to re-run Dinosaur on this file' % params['specPrecMapFile']))
def run_dinosaur(dinosaur_jar_path, mzml_fns, output_folder, spectrum_output_format, params):
    dinosaur_binary = ('java -Xmx%dM -jar %s --seed=1' % (int((params['dinosaurMemory'] * 1000)), dinosaur_jar_path))
    helpers.createDir(output_folder)
    for mzml_fn in mzml_fns:
        baseFN = helpers.getBase(helpers.getFileName(mzml_fn))
        dinosaur_output_file = os.path.join(output_folder, (baseFN + '.features.tsv'))
        if (not os.path.isfile(dinosaur_output_file)):
            cmd_dinosaur = ('%s --force --outDir=%s %s %s;' % (dinosaur_binary, output_folder, params['dinosaurFlags'], mzml_fn))
            helpers.executeCmd(cmd_dinosaur)
        else:
            print(('Found dinosaur output file at %s, remove this file to re-run Dinosaur on this file' % dinosaur_output_file))
        output_fn = os.path.join(output_folder, (baseFN + '.dummy.txt'))
        if spectrum_output_format:
            output_fn = os.path.join(output_folder, ((baseFN + '.recalibrated.') + spectrum_output_format))
        params['specPrecMapFile'] = os.path.join(output_folder, (baseFN + '.feature_map.tsv'))
        if (not os.path.isfile(params['specPrecMapFile'])):
            quant.add_accurate_precursors(dinosaur_output_file, mzml_fn, output_fn, params)
            if output_fn.endswith('.dummy.txt'):
                os.remove(output_fn)
        else:
            print(('Found dinosaur mapping file at %s, remove this file to re-run Dinosaur on this file' % params['specPrecMapFile']))