Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
]
ionnumbers.extend([x + 1 for x in range(pl - 1)] * num_ion_types)
charges.extend([charge_bufs[pi]] * (num_ion_types * (pl - 1)))
pepids.extend([pepid_bufs[pi]] * (num_ion_types * (pl - 1)))
all_preds = pd.DataFrame()
all_preds["spec_id"] = pepids
all_preds["charge"] = charges
all_preds["ion"] = ions
all_preds["ionnumber"] = ionnumbers
all_preds["mz"] = np.concatenate(mz_bufs, axis=None)
all_preds["prediction"] = np.concatenate(prediction_bufs, axis=None)
if not return_results:
if "mgf" in out_formats:
print("writing MGF file {}_predictions.mgf...".format(output_filename))
spectrum_output.write_mgf(
all_preds, peprec=data, output_filename=output_filename
)
if "msp" in out_formats:
print("writing MSP file {}_predictions.msp...".format(output_filename))
spectrum_output.write_msp(
all_preds, data, output_filename=output_filename
)
if "bibliospec" in out_formats:
print("writing SSL/MS2 files...")
spectrum_output.write_bibliospec(
all_preds, data, params, output_filename=output_filename
)
if "spectronaut" in out_formats:
mode=write_mode, append=append, min_itemsize=50
)
if 'msp' in params['output_filetype']:
"""
logging.info("Writing MSP file with unmodified peptides")
write_msp(
all_preds,
peprec_batch[peprec_batch['modifications'] == '-'],
output_filename="{}_unmodified".format(params['output_filename']),
write_mode=write_mode,
)
"""
logging.info("Writing MSP file")
spectrum_output.write_msp(
all_preds,
peprec_batch,
output_filename="{}".format(params['output_filename']),
write_mode=write_mode,
)
if 'mgf' in params['output_filetype']:
logging.info("Writing MGF file")
spectrum_output.write_mgf(
all_preds,
peprec=peprec_batch,
output_filename="{}".format(params['output_filename']),
write_mode=write_mode
)
if 'bibliospec' in params['output_filetype']:
all_preds["charge"] = charges
all_preds["ion"] = ions
all_preds["ionnumber"] = ionnumbers
all_preds["mz"] = np.concatenate(mz_bufs, axis=None)
all_preds["prediction"] = np.concatenate(prediction_bufs, axis=None)
if not return_results:
if "mgf" in out_formats:
print("writing MGF file {}_predictions.mgf...".format(output_filename))
spectrum_output.write_mgf(
all_preds, peprec=data, output_filename=output_filename
)
if "msp" in out_formats:
print("writing MSP file {}_predictions.msp...".format(output_filename))
spectrum_output.write_msp(
all_preds, data, output_filename=output_filename
)
if "bibliospec" in out_formats:
print("writing SSL/MS2 files...")
spectrum_output.write_bibliospec(
all_preds, data, params, output_filename=output_filename
)
if "spectronaut" in out_formats:
print("writing Spectronaut CSV files...")
spectrum_output.write_spectronaut(
all_preds, data, params, output_filename=output_filename
)
if "csv" in out_formats:
write_mode=write_mode
)
if 'bibliospec' in params['output_filetype']:
logging.info("Writing BiblioSpec SSL and MS2 files")
spectrum_output.write_bibliospec(
all_preds,
peprec_batch,
ms2pip_params,
output_filename="{}".format(params['output_filename']),
write_mode=write_mode
)
if 'spectronaut' in params['output_filetype']:
logging.info("Writing Spectronaut CSV file")
spectrum_output.write_spectronaut(
all_preds,
peprec_batch,
ms2pip_params,
output_filename="{}".format(params['output_filename']),
write_mode=write_mode
)
del all_preds
del peprec_batch