libgunshotmatch.datafile¶
Represents a parsed datafile.
Classes:
|
Represents a single datafile in a project. |
|
Represents the input datafile types supported by PyMassSpec. |
|
Represents information about a |
|
Represents a repeat sample in a project, constructed from a datafile. |
Functions:
|
Returns a information about the data in a |
-
class
Datafile(name, original_filename, original_filetype, description='', intensity_matrix=None, user=getpass.getuser(), device=socket.gethostname(), date_created=datetime.datetime.now(), date_modified=datetime.datetime.now(), version=1)[source]¶ Represents a single datafile in a project.
- Parameters
original_filename (
str) – The filename of the file theDatafilewas created from.original_filetype (
int) – The filetype of the file theDatafilewas created from.description (
str) – A description of theDatafile. Default''.intensity_matrix (
Optional[IntensityMatrix]) – PyMassSpecIntensityMatrixobject. DefaultNone.user (
str) – The user who created theRepeat. Default taken from the currently logged-in us.device (
str) – The device that created theRepeat. Default taken from the current device’s hostname.date_created (
datetime) – The date and time theRepeatwas created. Default is the current date and time.date_modified (
datetime) – The date and time theRepeatwas last modified. Default is the current date and time.version (
int) – File format version . Default1.
Attributes:
The date and time the
Datafilewas created.The date and time the
Datafilewas last modified.A description of the
Datafile.The device that created the
Datafile.PyMassSpec
IntensityMatrixobject.The name of the
Datafile.The filename of the file the
Datafilewas created from.The filetype of the file the
Datafilewas created from.The user who created the
Datafile.File format version
Methods:
export(output_dir)Export as a
.gsmdfile and return the output filename.from_dict(d)Construct a
Datafilefrom a dictionary.from_file(filename)Parse a
gsmdfile.load_gcms_data([filename])Load GC-MS data from the datafile.
new(name, filename)Construct a new
Datafilefrom a file.prepare_intensity_matrix(gcms_data[, …])Build an
IntensityMatrixfor the datafile.to_dict()Returns a dictionary representation of this
Datafile.-
intensity_matrix¶ Type:
Optional[IntensityMatrix]PyMassSpec
IntensityMatrixobject.
-
load_gcms_data(filename=None)[source]¶ Load GC-MS data from the datafile.
- Parameters
filename (
Union[str,Path,PathLike,None]) – Alternative filename to load the data from. Useful if the file has moved since theDatafilewas created. DefaultNone.
Changed in version 0.4.0: Added the
filenameattribute.- Return type
-
prepare_intensity_matrix(gcms_data, savitzky_golay=True, tophat=True, tophat_structure_size='1.5m', crop_mass_range=None)[source]¶ Build an
IntensityMatrixfor the datafile.- Parameters
gcms_data (
GCMS_data)savitzky_golay (
Union[bool,SavitzkyGolayMethod]) – Whether to perform Savitzky-Golay smoothing. DefaultTrue.tophat (
bool) – Whether to perform Tophat baseline correction. DefaultTrue.tophat_structure_size (
str) – The structure size for Tophat baseline correction. Default'1.5m'.crop_mass_range (
Optional[Tuple[float,float]]) – The range of masses to which the GC-MS data should be limited to. DefaultNone.
- Return type
-
enum
FileType(value)[source]¶ Bases:
enum_tools.custom_enums.IntEnumRepresents the input datafile types supported by PyMassSpec.
- Member Type
Valid values are as follows:
-
JDX= <FileType.JDX: 0>¶
-
MZML= <FileType.MZML: 1>¶
-
ANDI= <FileType.ANDI: 2>¶
-
namedtuple
GCMSDataInfo(rt_range, time_step, time_step_stdev, n_scans, mz_range, num_mz_mean, num_mz_median)[source]¶ Bases:
NamedTupleRepresents information about a
GCMS_dataobject returned byget_info_from_gcms_data().- Fields
rt_range (
Tuple[float,float]) – The minimum and maximum retention times.time_step (
float) – The average time step between scans.time_step_stdev (
float) – The standard deviation of the time steps between scans.n_scans (
int) – The total number of scans.mz_range (
Tuple[float,float]) – The minimum and maximum mass (m/z) values.num_mz_mean (
float) – The mean average number of masses per scan.num_mz_median (
float) – The median number of masses per scan.
-
class
Repeat(datafile, peaks, qualified_peaks=None, user=getpass.getuser(), device=socket.gethostname(), date_created=datetime.datetime.now(), date_modified=datetime.datetime.now(), version=1)[source]¶ Represents a repeat sample in a project, constructed from a datafile.
- Parameters
qualified_peaks (
Optional[List[QualifiedPeak]]) – Peaks containing identities from library search. This is usually populated after peak alignment. DefaultNone.user (
str) – The user who created theRepeat. Default taken from the currently logged-in user.device (
str) – The device that created theRepeat. Default taken from the current device’s hostname.date_created (
datetime) – The date and time theRepeatwas created. Default is the current date and time.date_modified (
datetime) – The date and time theRepeatwas last modified. Default is the current date and time.version (
int) – File format version . Default1.
Attributes:
The
Datafilefor this repeat.The date and time the
Repeatwas created.The date and time the
Repeatwas last modified.The device that created the
Repeat.The name of the
Datafile.Peaks containing identities from library search.
The user who created the
Repeat.File format version
Methods:
export(output_dir)Export as a
.gsmrfile and return the output filename.from_dict(d)Construct a
Repeatfrom a dictionary.from_file(filename)Parse a
gsmrfile.to_dict()Returns a dictionary representation of this
Repeat.-
export(output_dir)[source]¶ Export as a
.gsmrfile and return the output filename.New in version 0.4.0.
-
qualified_peaks¶ Type:
Optional[List[QualifiedPeak]]Peaks containing identities from library search. This is usually populated after peak alignment.
-
get_info_from_gcms_data(gcms_data)[source]¶ Returns a information about the data in a
pyms.GCMS.Class.GCMS_dataobject.- Parameters
gcms_data (
GCMS_data)- Return type