Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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["target"] = np.concatenate(target_bufs, axis=None)
all_preds["prediction"] = np.concatenate(prediction_bufs, axis=None)
sys.stdout.write(
"\nwriting file {}_pred_and_emp.csv...\n".format(output_filename)
)
all_preds.to_csv("{}_pred_and_emp.csv".format(output_filename), index=False)
if compute_correlations:
sys.stdout.write("computing correlations...\n")
correlations = calc_correlations.calc_correlations(all_preds)
correlations.to_csv(
"{}_correlations.csv".format(output_filename), index=True
)
sys.stdout.write("median correlations: \n")
sys.stdout.write(
"{}\n".format(correlations.groupby("ion")["pearsonr"].median())
)
sys.stdout.write("done! \n")
# Only get the predictions
else:
sys.stdout.write("scanning peptide file... ")
titles = data.spec_id.tolist()
split_titles = prepare_titles(titles, num_cpu)