Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if type(modpeptide) == str:
if modpeptide == "Unknown modification":
continue
pepid_buf.append(pepid)
peplen = len(peptide) - 2
peplen_buf.append(peplen)
ch = charges[pepid]
charge_buf.append(ch)
model_id = MODELS[model]["id"]
peaks_version = MODELS[model]["peaks_version"]
# get ion mzs
mzs = ms2pip_pyx.get_mzs(modpeptide, peaks_version)
mz_buf.append([np.array(m, dtype=np.float32) for m in mzs])
# Predict the b- and y-ion intensities from the peptide
# For C-term ion types (y, y++, z), flip the order of predictions,
# because get_predictions follows order from vector file
# enumerate works for variable number (and all) ion types
predictions = ms2pip_pyx.get_predictions(
peptide, modpeptide, ch, model_id, peaks_version, colen
) # SD: added colen
prediction_buf.append([np.array(p, dtype=np.float32) for p in predictions])
pcount += 1
if (pcount % 500) == 0:
sys.stdout.write("(%i)%i " % (worker_num, pcount))
sys.stdout.flush()
float(numby) / (2 * (len(peptide) - 3)),
float(numall) / (18 * (len(peptide) - 3)),
)
)
else:
# Predict the b- and y-ion intensities from the peptide
pepid_buf.append(title)
peplen_buf.append(len(peptide) - 2)
charge_buf.append(charge)
# get/append ion mzs, targets and predictions
targets = ms2pip_pyx.get_targets(
modpeptide, msms, peaks, float(fragerror), peaks_version
)
target_buf.append([np.array(t, dtype=np.float32) for t in targets])
mzs = ms2pip_pyx.get_mzs(modpeptide, peaks_version)
mz_buf.append([np.array(m, dtype=np.float32) for m in mzs])
predictions = ms2pip_pyx.get_predictions(
peptide, modpeptide, charge, model_id, peaks_version, colen
) # SD: added colen
prediction_buf.append(
[np.array(p, dtype=np.float32) for p in predictions]
)
pcount += 1
if (pcount % 500) == 0:
sys.stdout.write("(%i)%i " % (worker_num, pcount))
sys.stdout.flush()
f.close()
if tableau:
ft.close()