Io
Functions to read and write MS-MINT files.
convert_ms_file_to_feather(fn, fn_out=None)
¶
Convert MS file to feather format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the MS file to convert. |
required |
fn_out |
Optional[Union[str, Path]]
|
Output filename or path. If None, uses the same path with '.feather' extension. |
None
|
Returns:
Type | Description |
---|---|
str
|
Path to the generated feather file. |
Source code in src/ms_mint/io.py
convert_ms_file_to_parquet(fn, fn_out=None)
¶
Convert MS file to parquet format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the MS file to convert. |
required |
fn_out |
Optional[Union[str, Path]]
|
Output filename or path. If None, uses the same path with '.parquet' extension. |
None
|
Returns:
Type | Description |
---|---|
str
|
Path to the generated parquet file. |
Source code in src/ms_mint/io.py
df_to_numeric(df)
¶
Convert dataframe columns to numeric types where possible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
DataFrame to convert. Modified in-place. |
required |
Source code in src/ms_mint/io.py
export_to_excel(mint, fn=None)
¶
Export MINT state to Excel file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mint |
'ms_mint.Mint.Mint'
|
Mint instance containing data to export. |
required |
fn |
Optional[Union[str, Path]]
|
Output filename. If None, returns a file buffer instead of writing to disk. |
None
|
Returns:
Type | Description |
---|---|
Optional[BytesIO]
|
BytesIO buffer if fn is None, otherwise None. |
Source code in src/ms_mint/io.py
format_thermo_raw_file_reader_parquet(df)
¶
Format DataFrame from Thermo Raw File Reader to MS-MINT standard format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
DataFrame from Thermo Raw File Reader. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Formatted DataFrame in MS-MINT standard format. |
Source code in src/ms_mint/io.py
ms_file_to_df(fn, read_only=False)
¶
Read MS file and convert it to a pandas DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the MS file. |
required |
read_only |
bool
|
Whether to only read the file without converting to DataFrame (for testing purposes). Default is False. |
False
|
Returns:
Type | Description |
---|---|
Optional[DataFrame]
|
DataFrame containing MS data, or None if the file cannot be read. |
Source code in src/ms_mint/io.py
mzml_to_df(fn, read_only=False)
¶
Read mzML file and convert it to pandas DataFrame using the mzML library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the mzML file. |
required |
read_only |
bool
|
Whether to only read the file without converting to DataFrame (for testing purposes). Default is False. |
False
|
Returns:
Type | Description |
---|---|
Optional[DataFrame]
|
DataFrame containing MS data, or None if read_only is True. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the filename does not end with '.mzml'. |
Source code in src/ms_mint/io.py
mzml_to_pandas_df_pyteomics(fn, **kwargs)
¶
Deprecated function to read mzML files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the mzML file. |
required |
**kwargs |
Additional arguments passed to mzml_to_df. |
{}
|
Returns:
Type | Description |
---|---|
Optional[DataFrame]
|
DataFrame containing MS data, or None if read_only is True. |
Source code in src/ms_mint/io.py
mzmlb_to_df__pyteomics(fn, read_only=False)
¶
Read mzMLb file and convert it to pandas DataFrame using the pyteomics library.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the mzMLb file. |
required |
read_only |
bool
|
Whether to only read the file without converting to DataFrame (for testing purposes). Default is False. |
False
|
Returns:
Type | Description |
---|---|
Optional[DataFrame]
|
DataFrame containing MS data, or None if read_only is True. |
Source code in src/ms_mint/io.py
mzxml_to_df(fn, read_only=False, time_unit_in_file='min')
¶
Read mzXML file and convert it to pandas DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the mzXML file. |
required |
read_only |
bool
|
Whether to only read the file without converting to DataFrame (for testing purposes). Default is False. |
False
|
time_unit_in_file |
Literal['min', 'sec']
|
The time unit used in the mzXML file. Must be either 'sec' or 'min'. Default is 'min'. |
'min'
|
Returns:
Type | Description |
---|---|
Optional[DataFrame]
|
DataFrame containing MS data, or None if read_only is True. |
Raises:
Type | Description |
---|---|
AssertionError
|
If the filename does not end with '.mzxml'. |
Source code in src/ms_mint/io.py
read_parquet(fn, read_only=False)
¶
Read parquet file and return a pandas DataFrame.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fn |
Union[str, Path]
|
Filename or path to the parquet file. |
required |
read_only |
bool
|
Whether to return the DataFrame as-is without formatting. Default is False. |
False
|
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame containing MS data. |
Source code in src/ms_mint/io.py
set_dtypes(df)
¶
Set appropriate data types for MS data columns.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df |
DataFrame
|
DataFrame containing MS data. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
DataFrame with appropriate data types. |
Source code in src/ms_mint/io.py
options: show_root_heading: true show_root_full_path: true show_submodules: true members_order: source