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 theDatafile
was created from.original_filetype (
int
) – The filetype of the file theDatafile
was created from.description (
str
) – A description of theDatafile
. Default''
.intensity_matrix (
Optional
[IntensityMatrix
]) – PyMassSpecIntensityMatrix
object. 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 theRepeat
was created. Default is the current date and time.date_modified (
datetime
) – The date and time theRepeat
was last modified. Default is the current date and time.version (
int
) – File format version . Default1
.
Attributes:
The date and time the
Datafile
was created.The date and time the
Datafile
was last modified.A description of the
Datafile
.The device that created the
Datafile
.PyMassSpec
IntensityMatrix
object.The name of the
Datafile
.The filename of the file the
Datafile
was created from.The filetype of the file the
Datafile
was created from.The user who created the
Datafile
.File format version
Methods:
export
(output_dir)Export as a
.gsmd
file and return the output filename.from_dict
(d)Construct a
Datafile
from a dictionary.from_file
(filename)Parse a
gsmd
file.load_gcms_data
([filename])Load GC-MS data from the datafile.
new
(name, filename)Construct a new
Datafile
from a file.prepare_intensity_matrix
(gcms_data[, …])Build an
IntensityMatrix
for the datafile.to_dict
()Returns a dictionary representation of this
Datafile
.-
intensity_matrix
¶ Type:
Optional
[IntensityMatrix
]PyMassSpec
IntensityMatrix
object.
-
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 theDatafile
was created. DefaultNone
.
Changed in version 0.4.0: Added the
filename
attribute.- Return type
-
prepare_intensity_matrix
(gcms_data, savitzky_golay=True, tophat=True, tophat_structure_size='1.5m', crop_mass_range=None)[source]¶ Build an
IntensityMatrix
for 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.IntEnum
Represents 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:
NamedTuple
Represents information about a
GCMS_data
object 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 theRepeat
was created. Default is the current date and time.date_modified (
datetime
) – The date and time theRepeat
was last modified. Default is the current date and time.version (
int
) – File format version . Default1
.
Attributes:
The
Datafile
for this repeat.The date and time the
Repeat
was created.The date and time the
Repeat
was 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
.gsmr
file and return the output filename.from_dict
(d)Construct a
Repeat
from a dictionary.from_file
(filename)Parse a
gsmr
file.to_dict
()Returns a dictionary representation of this
Repeat
.-
export
(output_dir)[source]¶ Export as a
.gsmr
file and return the output filename.New in version 0.4.0.
- Return type
-
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_data
object.- Return type