Data Import
JuChrom.InputOutput.FileFormat
— TypeFileFormat
Supertype of all FileFormat implementations.
See also AgilentFID
, ANDI
, ChemStationMS
, MassHunterMS
.
JuChrom.InputOutput.AgilentFIDReaders.AgilentFID
— TypeAgilentFID(; datafilename::AbstractString="FID1A.ch")
Returns an object representing the AgilentFID
file format. The optional keyword argument, datafilename
, allows you to specify a different name for the data file to be read, instead of the default FID1A.ch
. Upper and lower case are not considered when specifying the data file name. Note that when using the function importdata, the AgilentFID
data reader expects the Agilent .D folder as the source location, with the specified data file located at the top level of the .D folder. However, you can also provide the full pathname of the data file directly when using the function importdata, in which case the datafilename
entry in the AgilentFID
object is ignored.
See also FileFormat
, importdata
.
Examples
julia> AgilentFID()
AgilentFID{String}("FID1A.ch")
julia> AgilentFID(datafilename="fid_data_20240611.ch")
AgilentFID{String}("fid_data_20240611.ch")
julia> dfolder = joinpath(JuChrom.agilent, "ZK_ONUBE_Mix1_11.D");
julia> chrom = importdata(dfolder, AgilentFID())
Chrom {scan times: Float32, intensities: Float64}
4151 scans; scan time range: 0.437f0 ms - 830000.44f0 ms
intensity range: 0.0 - 1.0738316309895832e6
metadata: 10 entries
JuChrom.InputOutput.ANDIReaders.ANDI
— TypeANDI(; scantimetype::Union{AbstractFloat, Nothing}=Nothing, iontype::Union{
AbstractFloat, Nothing}=Nothing, intensitytype::Union{AbstractFloat, Nothing}=Nothing)
Returns an object representing the ANDI
file format. When using the importdata function, the ANDI
data reader expects the source location to be a netCDF file, which typically has a .CDF file extension. The keyword arguments scantimetype
, iontype
, and intensitytype
are provided to address cases where ANDI
files may store data as Float64 even though it was originally collected as Float32. The default type Nothing indicates that no conversion takes place and the type in which the data is stored is returned. Background: When decimal numbers are converted to binary floats, they are rounded to the nearest binary fraction rather than a decimal fraction. This rounding can cause slight changes in the values. If the data were initially recorded as Float32 and are then converted to Float64, these changes can become visible. However, the changes can usually be ignored. If one wishes to convert the float types, the optional scantimetype
keyword argument allows the scan times to be converted to a specified float type. Similarly, the optional keyword arguments iontype
and intensitytype
allow the conversion of mass-to-charge ratio values and intensity values, respectively, to a desired float type.
See also FileFormat
, importdata
.
Example
julia> ANDI()
ANDI{Nothing, Nothing, Nothing}(Nothing, Nothing, Nothing)
julia> cdffile = joinpath(JuChrom.andi, "C7-C40_13_Nov_1.CDF");
julia> chrom = importdata(cdffile, ANDI())
ChromMS {scan times: Float64, ions: Float32, intensities: Float32}
5221 scans; scan time range: 191.942 s - 3898.719 s
5248 ions; range: m/z 29.0 - 562.9
intensity range: 0.0 - 1.051136e6
metadata: 2 entries
julia> scantimes(chrom)[9:11]
3-element Vector{Quantity{Float64, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}}:
197.623 s
198.33300000000003 s
199.043 s
julia> chrom = importdata(cdffile, ANDI(scantimetype=Float32))
ChromMS {scan times: Float32, ions: Float32, intensities: Float32}
5221 scans; scan time range: 191.942f0 s - 3898.719f0 s
5248 ions; range: m/z 29.0 - 562.9
intensity range: 0.0 - 1.051136e6
metadata: 2 entries
julia> scantimes(chrom)[9:11]
3-element Vector{Quantity{Float32, 𝐓, Unitful.FreeUnits{(s,), 𝐓, nothing}}}:
197.623f0 s
198.333f0 s
199.043f0 s
JuChrom.InputOutput.ChemStationMSReaders.ChemStationMS
— TypeChemStationMS(; datafilename::AbstractString="data.ms")
Returns an object representing the ChemStationMS
file format. The optional keyword argument, datafilename
, allows you to specify a different name for the data file to be read, instead of the default data.ms
(e.g., datasim.ms
). Upper and lower case are not considered when specifying the data file name. Note that when using the function importdata, the ChemStationMS
data reader expects the Agilent .D folder as the source location, with the specified data file located at the top level of the .D folder. However, you can also provide the full pathname of the data file directly when using the function importdata, in which case the datafilename
entry in the ChemStationMS
object is ignored.
See also FileFormat
, importdata
.
Examples
julia> ChemStationMS()
ChemStationMS{String}("data.ms")
julia> ChemStationMS(datafilename="DATASIM.MS")
ChemStationMS{String}("DATASIM.MS")
julia> dfolder = joinpath(JuChrom.agilent, "C7-C40_ChemStationMS.D");
julia> chrom = importdata(dfolder, ChemStationMS())
ChromMS {scan times: Float32, ions: Float32, intensities: Int32}
2405 scans; scan time range: 191941.0f0 ms - 1.899047f6 ms
5176 ions; range: m/z 29.0 - 562.9
intensity range: 0 - 1186816
metadata: 10 entries
julia> datafile = joinpath(JuChrom.agilent, "C7-C40_ChemStationMS.D/data.ms");
julia> chrom = importdata(datafile, ChemStationMS())
ChromMS {scan times: Float32, ions: Float32, intensities: Int32}
2405 scans; scan time range: 191941.0f0 ms - 1.899047f6 ms
5176 ions; range: m/z 29.0 - 562.9
intensity range: 0 - 1186816
metadata: 10 entries
JuChrom.InputOutput.MassHunterMSReaders.MassHunterMS
— TypeMassHunterMS(; scanmethodid::Integer=1,
scantimetype::Union{AbstractFloat, Nothing}=Nothing,
iontype::Union{AbstractFloat, Nothing}=Nothing,
intensitytype::Union{AbstractFloat, Nothing}=Nothing
Return an object representing the MassHunterMS
file format. When using the importdata function, the MassHunterMS data reader expects the source location to be the Agilent .D folder. The optional scanmethodid
keyword argument allows you to specify which scan method ID data to read, which is particularly useful when multiple scan methods have been applied simultaneously. The :ScanMethodID and :ScanMethodIDs metadata entries indicate which scan method ID data was extracted and which scan method IDs are available for a given run. The keyword arguments scantimetype
, iontype
, and intensitytype
are provided to address cases where MassHunter files may store data as Float64 even though it was originally collected as Float32. The default type Nothing indicates that no conversion takes place and the type in which the data is stored is returned. Background: When decimal numbers are converted to binary floats, they are rounded to the nearest binary fraction rather than a decimal fraction. This rounding can cause slight changes in the values. If the data were initially recorded as Float32 and are then converted to Float64, these changes can become visible. However, the changes can usually be ignored. If one wishes to convert the float types, the optional scantimetype
keyword argument allows the scan times to be converted to a specified float type. Similarly, the optional keyword arguments iontype
and intensitytype
allow the conversion of mass-to-charge ratio values and intensity values, respectively, to a desired float type.
See also FileFormat
, importdata
, JuChrom.binions
.
Examples
julia> dfolder = joinpath(JuChrom.agilent, "C7-C40_MassHunterMS.D");
julia> chrom = importdata(dfolder, MassHunterMS())
ChromMS {scan times: Float64, ions: Float64, intensities: Float64}
2405 scans; scan time range: 191.941 s - 1899.047 s
50275 ions; range: m/z 29.020000457763672 - 562.8900146484375
intensity range: 0.0 - 1.1872475e6
metadata: 2 entries
julia> ions(chrom)[1:3] # ion decimal digits suggest Float32
3-element Vector{Float64}:
29.020000457763672
29.030000686645508
29.040000915527344
julia> chrom = importdata(dfolder, MassHunterMS(; iontype=Float32))
ChromMS {scan times: Float64, ions: Float32, intensities: Float64}
2405 scans; scan time range: 191.941 s - 1899.047 s
50275 ions; range: m/z 29.02 - 562.89
intensity range: 0.0 - 1.1872475e6
metadata: 2 entries
julia> ions(chrom)[1:3]
3-element Vector{Float32}:
29.02
29.03
29.04
JuChrom.InputOutput.ShimadzuMSReaders.ShimadzuMS
— TypeShimadzuMS()
Returns an object representing the ShimadzuMS
file format. When using the importdata function, the ShimadzuMS
data reader expects the source to be a .qgd file.
See also FileFormat
, importdata
.
Example
julia> ShimadzuMS()
ShimadzuMS()
julia> qgdfile = joinpath(JuChrom.shimadzu, "AR190311.qgd");
julia> chrom = importdata(qgdfile, ShimadzuMS())
ChromMS {scan times: Int32, ions: Float64, intensities: UInt32}
9210 scans; scan time range: 183000 ms - 2024800 ms
3620 ions; range: m/z 34.9 - 600.4
intensity range: 0 - 924954
metadata: 0 entries
JuChrom.InputOutput.importdata
— Functionimportdata(source::AbstractString, fileformat::FileFormat)
Read data from the specified source using the appropriate file format reader. The source may be a file or a directory path, depending on the requirements of the chosen file format reader.
See also AgilentFID
, ANDI
, ChemStationMS
, MassHunterMS
.
Examples
julia> dfolder = joinpath(JuChrom.agilent, "C7-C40_ChemStationMS.D");
julia> chrom = importdata(dfolder, ChemStationMS())
ChromMS {scan times: Float32, ions: Float32, intensities: Int32}
2405 scans; scan time range: 191941.0f0 ms - 1.899047f6 ms
5176 ions; range: m/z 29.0 - 562.9
intensity range: 0 - 1186816
metadata: 10 entries