Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
include_software_entry=update_metadata)
writer.copy_metadata_from(reader)
if update_metadata:
method = data_transformation.ProcessingMethod(software_id='ms_deisotope_1')
if pick_peaks:
method.add('MS:1000035')
if correct_precursor_mz:
method.add('MS:1000780')
if reprofile:
method.add('MS:1000784')
method.add('MS:1000544')
writer.add_data_processing(method)
if default_activation is not None:
if isinstance(default_activation, basestring):
default_activation = activation_module.ActivationInformation(
default_activation, unitfloat(0, 'electronvolt'))
elif isinstance(default_activation, dict):
default_activation = activation_module.ActivationInformation(**default_activation)
else:
click.secho("Could not convert %r into ActivationInformation" % (default_activation, ), err=1,
fg='yellow')
default_activation = None
if pick_peaks:
try:
writer.remove_file_contents("profile spectrum")
except KeyError:
pass
writer.add_file_contents("centroid spectrum")
n_spectra = len(reader)
progbar = progress(
label="Processed Spectra", length=n_spectra,
item_show_func=lambda x: str(x.precursor.id if x.precursor else
x: unitfloat
A float representing a quantity of time annotated with a time unit
Returns
-------
unitfloat:
The time after conversion to minutes
'''
try:
unit = x.unit_info
except AttributeError:
return x
if unit == 'minute':
return x
elif unit == 'second':
y = unitfloat(x / 60., 'minute')
return y
elif unit == 'hour':
y = unitfloat(x * 60, 'minute')
return y
else:
warnings.warn("Time unit %r not recognized" % unit)
return x