reader
Module for loading various HDX-MS formats.
deduplicate_name(name)
Deduplicate column name by removing trailing '_duplicated_xx
Source code in hdxms_datasets/reader.py
96 97 98 99 100 | |
get_backend()
Returns the backend used for data handling.
Source code in hdxms_datasets/reader.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | |
hxms_line_generator(source)
Generate lines from an HXMS file.
Source code in hdxms_datasets/reader.py
225 226 227 228 229 230 231 | |
parse_hxms_lines(lines, read_content=True)
Parse the different sections of an HXMS file.
Returns a dictionary with keys
- "HEADER": list of header lines
- "METADATA": dict of metadata key-value pairs
- "REMARK": dict of remark key-value pairs
- "DATA": Narwhals DataFrame containing the HXMS data (if read_content is True)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
lines
|
Iterable[str]
|
An iterable of lines from the HXMS file. |
required |
Returns:
| Type | Description |
|---|---|
HXMSResult
|
A dictionary containing the parsed information. |
Source code in hdxms_datasets/reader.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 | |
read_csv(source, **kwargs)
Read a CSV file and return a Narwhals DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path | StringIO | bytes
|
Source object representing the CSV data. |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A Narwhals DataFrame containing the CSV data. |
Source code in hdxms_datasets/reader.py
190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 | |
read_hdexaminer_peptide_pool(source)
Read an HDX-Examiner peptide pool file and return a Narwhals DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path | StringIO
|
Source object representing the HDX-Examiner peptide pool data. |
required |
Source code in hdxms_datasets/reader.py
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 | |
read_hxms(source, returns='HXMSResult')
read_hxms(
source: Path | IO | bytes,
returns: Literal["HXMSResult"],
) -> HXMSResult
read_hxms(
source: Path | IO | bytes, returns: Literal["DataFrame"]
) -> nw.DataFrame
Read an HXMS file and return a HXMSResult or Narwhals DataFrame.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Path | IO | bytes
|
Source object representing the HXMS data. |
required |
Returns:
| Type | Description |
|---|---|
HXMSResult | DataFrame
|
A Narwhals DataFrame containing the HXMS data. |
Source code in hdxms_datasets/reader.py
416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | |