Documentation for Controllers
¶
Controllers in ViMMS implement fragmentation strategies, determining which ions in an MS1 (survey) scan should be fragmented. A standard fragmentation strategy used in data-dependant acquisition (DDA) is the Top-N strategy, where the top N most intense ions in the survey scan are fragmented. This strategy is implemented in the TopNController in ViMMS.
In addition to Top-N, several other DDA strategies have been implemented that improve upon the standard TopN controller (for more details, refer to our papers).
ViMMS also includes implementations of several common data-independent acquisition (DIA) strategies such as All-ion-fragmentation (AIF), SWATH-MS (Sequential Windowed Acquisition of All Theoretical Fragment Ion Mass Spectra).
The following are broad categories of controllers that are available in ViMMS:
Controller
¶
AIF
¶
AIF(ms1_source_cid_energy, advanced_params=None)
Bases: Controller
A controller that implements the All-ion-fragmentation (AIF) DIA fragmentation strategy. Should be used in conjunction with MS-DIAL for deconvolution.
Initialise an AIF controller Args: ms1_source_cid_energy: source CID energy for MS1 scan advanced_params: an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used.
Source code in vimms/Controller/dia.py
24 25 26 27 28 29 30 31 32 33 34 35 |
|
write_msdial_experiment_file
¶
write_msdial_experiment_file(filename)
Generates a file that can be read by MS-DIAL to perform deconvolution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
path to experiment file in MS-DIAL format |
required |
Returns: None
Source code in vimms/Controller/dia.py
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
AdvancedParams
¶
AdvancedParams(
default_ms1_scan_window=DEFAULT_MS1_SCAN_WINDOW,
ms1_agc_target=DEFAULT_MS1_AGC_TARGET,
ms1_max_it=DEFAULT_MS1_MAXIT,
ms1_collision_energy=DEFAULT_MS1_COLLISION_ENERGY,
ms1_orbitrap_resolution=DEFAULT_MS1_ORBITRAP_RESOLUTION,
ms1_activation_type=DEFAULT_MS1_ACTIVATION_TYPE,
ms1_mass_analyser=DEFAULT_MS1_MASS_ANALYSER,
ms1_isolation_mode=DEFAULT_MS1_ISOLATION_MODE,
ms1_source_cid_energy=DEFAULT_SOURCE_CID_ENERGY,
ms2_agc_target=DEFAULT_MS2_AGC_TARGET,
ms2_max_it=DEFAULT_MS2_MAXIT,
ms2_collision_energy=DEFAULT_MS2_COLLISION_ENERGY,
ms2_orbitrap_resolution=DEFAULT_MS2_ORBITRAP_RESOLUTION,
ms2_activation_type=DEFAULT_MS2_ACTIVATION_TYPE,
ms2_mass_analyser=DEFAULT_MS2_MASS_ANALYSER,
ms2_isolation_mode=DEFAULT_MS2_ISOLATION_MODE,
ms2_source_cid_energy=DEFAULT_SOURCE_CID_ENERGY,
)
An object that stores advanced parameters used to control the mass spec e.g. AGC target, collision energy, orbitrap resolution etc.
When ViMMS is connected to an actual mass spec instrument (Orbitrap Fusion in our case) via IAPI, most of these values are directly passed to the mass spec as they are. Generally you can leave these settings to their default.
In simulated use, most of these values are not used and therefore they won't affect simulated results.
Create an advanced parameter object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
default_ms1_scan_window
|
the m/z window to perform MS1 scan |
DEFAULT_MS1_SCAN_WINDOW
|
|
ms1_agc_target
|
automatic gain control target for MS1 scan |
DEFAULT_MS1_AGC_TARGET
|
|
ms1_max_it
|
maximum time to acquire ions for MS1 scan |
DEFAULT_MS1_MAXIT
|
|
ms1_collision_energy
|
the collision energy used for MS1 scan |
DEFAULT_MS1_COLLISION_ENERGY
|
|
ms1_orbitrap_resolution
|
the Orbitrap resolution used for MS1 scan |
DEFAULT_MS1_ORBITRAP_RESOLUTION
|
|
ms1_activation_type
|
the activation type for MS1 scan, either CID or HCD |
DEFAULT_MS1_ACTIVATION_TYPE
|
|
ms1_mass_analyser
|
the mass analyser to use for MS1 scan, either IonTrap or Orbitrap |
DEFAULT_MS1_MASS_ANALYSER
|
|
ms1_isolation_mode
|
the isolation mode for MS1 scan, either None, Quadrupole, IonTrap |
DEFAULT_MS1_ISOLATION_MODE
|
|
ms1_source_cid_energy
|
source CID energy |
DEFAULT_SOURCE_CID_ENERGY
|
|
ms2_agc_target
|
automatic gain control target for MS2 scan |
DEFAULT_MS2_AGC_TARGET
|
|
ms2_max_it
|
maximum time to acquire ions for MS2 scan |
DEFAULT_MS2_MAXIT
|
|
ms2_collision_energy
|
the collision energy used for MS2 scan |
DEFAULT_MS2_COLLISION_ENERGY
|
|
ms2_orbitrap_resolution
|
the Orbitrap resolution used for MS2 scan |
DEFAULT_MS2_ORBITRAP_RESOLUTION
|
|
ms2_activation_type
|
the activation type for MS2 scan, either CID or HCD |
DEFAULT_MS2_ACTIVATION_TYPE
|
|
ms2_mass_analyser
|
the mass analyser to use for MS2 scan, either IonTrap or Orbitrap |
DEFAULT_MS2_MASS_ANALYSER
|
|
ms2_isolation_mode
|
the isolation mode for MS2 scan, either None, Quadrupole, IonTrap |
DEFAULT_MS2_ISOLATION_MODE
|
|
ms2_source_cid_energy
|
source CID energy |
DEFAULT_SOURCE_CID_ENERGY
|
Source code in vimms/Controller/base.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
AgentBasedController
¶
AgentBasedController(agent, advanced_params=None)
Bases: Controller
A class that implements an agent-based controller.
Initialises an agent-based controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
agent
|
an instance of the vimms.Agent.AbstractAgent class. |
required | |
advanced_params
|
optional advanced parameters for the mass spec. |
None
|
Source code in vimms/Controller/abc.py
16 17 18 19 20 21 22 23 24 |
|
CaseControlNonOverlapController
¶
CaseControlNonOverlapController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=1,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: TopNEXtController
Case-control non-overlap controller
Source code in vimms/Controller/box.py
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 |
|
Controller
¶
Controller(advanced_params=None)
Bases: ABC
Abtract base class for controllers.
Initialise a base Controller class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
Source code in vimms/Controller/base.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
after_injection_cleanup
¶
after_injection_cleanup()
Clean-up method at the end of each injection.
Returns: None
Source code in vimms/Controller/base.py
372 373 374 375 376 377 378 379 |
|
dump_scans
¶
dump_scans(output_method)
Dump all scans to the output format. Useful for debugging.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
output_method
|
a function that accepts scan information as a CSV string from pandas |
required |
Returns: None
Source code in vimms/Controller/base.py
305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 |
|
get_initial_scan_params
¶
get_initial_scan_params()
Gets the initial scan parameters to send to the mass spec that starts the whole process. Will default to sending an MS1 scan with whatever parameters passed in self.params. Subclasses can override this to return different types of scans.
Returns: a vimms.Common.ScanParameters object describing the initial scan to make.
Source code in vimms/Controller/base.py
219 220 221 222 223 224 225 226 227 228 229 |
|
get_initial_tasks
¶
get_initial_tasks()
Gets the initial tasks to load immediately into the mass spec (before acquisition starts)
Returns: an empty list of tasks, unless overridden by subclass
Source code in vimms/Controller/base.py
209 210 211 212 213 214 215 216 217 |
|
get_ms1_scan_params
¶
get_ms1_scan_params(metadata=None)
Generate a default scan parameter for MS1 scan. The generated scan parameter object is typically passed to the mass spec (whether real or simulated) that produces the actual MS1 scan. Args: metadata: any additional metadata to include
Returns: a vimms.Common.ScanParameters object that describes the MS1 scan to generate.
Source code in vimms/Controller/base.py
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 |
|
get_ms2_scan_params
¶
get_ms2_scan_params(
mz,
intensity,
precursor_scan_id,
isolation_width,
mz_tol,
rt_tol,
metadata=None,
)
Generate a default scan parameter for MS2 scan. The generated scan parameter object is typically passed to the mass spec (whether real or simulated) that produces the actual MS2 scan.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mz
|
the m/z of the precursor ion to fragment |
required | |
intensity
|
the intensity of the precursor ion to fragment |
required | |
precursor_scan_id
|
the associated MS1 scan ID that contains this precursor ion |
required | |
isolation_width
|
isolation width, in Dalton |
required | |
mz_tol
|
m/z tolerance for dynamic exclusion (TODO: this shouldn't be here) |
required | |
rt_tol
|
RT tolerance for dynamic exclusion (TODO: this shouldn't be here) |
required | |
metadata
|
any additional metadata to include |
None
|
Returns: a vimms.Common.ScanParameters object that describes the MS2 scan to generate.
Source code in vimms/Controller/base.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 |
|
handle_scan
¶
handle_scan(scan, current_size, pending_size)
Basic codes to handle an incoming scan, which is generally the same for all controllers.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scan
|
A new vimms.MassSpec.Scan to process. |
required | |
current_size
|
current size of task buffer |
required | |
pending_size
|
pending size of task buffer |
required |
Returns: a list of new vimms.Common.ScanParameters describing what to do next.
Source code in vimms/Controller/base.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
set_environment
¶
set_environment(env)
Set the environment used to run this controller
Parameters:
Name | Type | Description | Default |
---|---|---|---|
env
|
an [vimms.Environment.Environment] object or its subclasses. |
required |
Returns: None
Source code in vimms/Controller/base.py
231 232 233 234 235 236 237 238 239 240 241 |
|
update_state_after_scan
abstractmethod
¶
update_state_after_scan(last_scan)
Update internal state after a scan has been processed.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
last_scan
|
[vimms.MassSpec.Scan][]
|
the last-processed object. |
required |
Source code in vimms/Controller/base.py
287 288 289 290 291 292 293 294 |
|
DEWFilter
¶
DEWFilter(rt_tol)
Bases: ScoreFilter
A class that implements dynamic exclusion filter
Initialises a dynamic exclusion filter based on time only Args: rt_tol: the RT tolerance (in seconds)
Source code in vimms/Exclusion.py
492 493 494 495 496 497 498 |
|
filter
¶
filter(current_rt, rois)
Check whether intensity values are above or below the threshold Args: current_rt: the current RT value rois: a list of vimms.Roi.Roi objects.
Returns: an array of indicators for the filter
Source code in vimms/Exclusion.py
500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 |
|
DiaController
¶
DiaController(
min_mz,
max_mz,
window_type,
kaufmann_design,
num_windows,
scan_overlap=0,
extra_bins=0,
dia_design="kaufmann",
advanced_params=None,
)
Bases: Controller
A class for doing tree and nested DIA methods. Also has a SWATH type controller, but reccommend to use SWATH class above. Method uses windows methods from DIA.py to create the pattern of windows needed to run the controllers. Note: the following method used multiple simultaneous isolation windows
Source code in vimms/Controller/dia.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
|
DiaWindows
¶
DiaWindows(
ms1_mzs,
ms1_range,
dia_design,
window_type,
kaufmann_design,
extra_bins,
num_windows=None,
range_slack=0.01,
)
Class for creating windows for basic, tree and nested DIA methods. Method is used in DiaController in Controller/dia. Basic methods are approximately equal to a SWATH method with no overlapping windows
Source code in vimms/DIA.py
12 13 14 15 16 17 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
|
DsDAController
¶
DsDAController(dsda_state, mzml_name, advanced_params=None, task_filter=None)
Bases: WrapperController
A controller which allows running the DsDA (Dataset-Dependent Acquisition) method.
See the original publication for a description of DsDA:
Broeckling, Hoyes, et al. "Comprehensive Tandem-Mass-Spectrometry coverage of complex samples enabled by Data-Set-Dependent acquisition." Analytical Chemistry. 90, 8020–8027 (2018).
Initialise a new DsDAController instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dsda_state
|
An instance of [vimms.DsDA.DsDAState][], wrapping a |
required | |
mzml_name
|
The name of the .mzML file to write for this injection. |
required | |
advanced_params
|
a vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. See vimms.Controller.base.AdvancedParams for defaults. |
None
|
|
task_filter
|
Object that examines the task list and adds or deletes tasks to ensure schedule remains in sync with the actual RT. |
None
|
Source code in vimms/Controller/misc.py
280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
FixedScansController
¶
FixedScansController(
schedule=None, advanced_params=None, expected_rts=None, task_filter=None
)
Bases: Controller
A controller which takes a schedule of scans, and converts them into tasks in a queue.
The base class for pre-scheduled controllers like vimms.Controller.misc.DsDAController and vimms.Controller.misc.MatchingController.
Create a FixedScansController.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule
|
List of [vimms.Common.ScanParameter][] objects. |
None
|
|
advanced_params
|
Instance of vimms.Controller.base.AdvancedParams. |
None
|
|
expected_rts
|
List of expected RTs for tasks with indices corresponding to schedule. Only needed if e.g. resynchronising RTs using task_filter. |
None
|
|
task_filter
|
Object that dynamically returns tasks on request. For example vimms.Controller.misc.TaskFilter can be used to resynchronise unexpected RTs with the expected ones in the schedule. |
None
|
Source code in vimms/Controller/misc.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
get_initial_scan_params
¶
get_initial_scan_params()
Returns the initial scan parameter object to send when acquisition starts
Returns: The initial task.
Source code in vimms/Controller/misc.py
224 225 226 227 228 229 230 231 232 233 |
|
get_initial_tasks
¶
get_initial_tasks()
Returns all initial tasks for the mass spec queue.
Returns: List of tasks.
Source code in vimms/Controller/misc.py
211 212 213 214 215 216 217 218 219 220 221 222 |
|
set_tasks
¶
set_tasks(schedule)
Set a new schedule for this controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule
|
A list of [vimms.Common.ScanParameter][]. |
required |
Source code in vimms/Controller/misc.py
235 236 237 238 239 240 241 242 243 244 |
|
FlexibleNonOverlapController
¶
FlexibleNonOverlapController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=1,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: TopNEXtController
TODO: this class can probably be removed.
Source code in vimms/Controller/box.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
GenericBox
¶
GenericBox(
x1,
x2,
y1,
y2,
parents=None,
min_xwidth=0,
min_ywidth=0,
intensity=0,
id=None,
roi=None,
round_digits=8,
)
Bases: Box
Makes no particular assumptions about bounding boxes.
Source code in vimms/Box.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
non_overlap_split
¶
non_overlap_split(other_box)
Finds 1 to 4 boxes describing the polygon of area of this box not overlapped by other_box. If one box is found, crops this box to dimensions of that box, and returns None. Otherwise, returns list of 2 to 4 boxes. Number of boxes found is equal to number of edges overlapping area does NOT share with this box.
Source code in vimms/Box.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
IdleController
¶
IdleController(advanced_params=None)
Bases: Controller
A controller that doesn't do any controlling. Mostly used as a skeleton code to illustrate the code structure in ViMMS controllers.
Initialise an idle controller Args: advanced_params: an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used.
Source code in vimms/Controller/fullscan.py
15 16 17 18 19 20 21 22 23 |
|
IntensityNonOverlapController
¶
IntensityNonOverlapController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: IntensityTopNEXtController
A variant of the non-overlap controller but it takes into account intensity changes.
Source code in vimms/Controller/box.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
LengthFilter
¶
LengthFilter(min_roi_length_for_fragmentation)
Bases: ScoreFilter
A class that implements a check on minimum length of ROI for fragmentation
Initialise a length filter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_roi_length_for_fragmentation
|
the minimum length of ROI for fragmentation |
required |
Source code in vimms/Exclusion.py
554 555 556 557 558 559 560 561 |
|
filter
¶
filter(roi_lengths)
Check that ROI lengths are above the threshold Args: roi_lengths: a numpy array of ROI lengths
Returns: an array of indicator whether the lengths are above threshold
Source code in vimms/Exclusion.py
563 564 565 566 567 568 569 570 571 572 |
|
MS2PlannerController
¶
MS2PlannerController(
schedule=None, advanced_params=None, expected_rts=None, task_filter=None
)
Bases: FixedScansController
A controller that interfaces with MS2Planner, as described in:
Zuo, Zeyuan, et al. "MS2Planner: improved fragmentation spectra coverage in untargeted mass spectrometry by iterative optimized data acquisition." Bioinformatics 37.Supplement_1 (2021): i231-i236.
Source code in vimms/Controller/misc.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
boxfile2ms2planner
staticmethod
¶
boxfile2ms2planner(reader, inpath, outpath)
Transform peak-picked box file to ms2planner default format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inpath
|
Path to input box file. |
required | |
outpath
|
Path to output file used in MS2Planner input. |
required |
Returns: None
Source code in vimms/Controller/misc.py
325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
minimise_distance
staticmethod
¶
minimise_distance(target, *args)
Solve argmin(a1, a2 ... an)(a1x1 + ... + anxn - t) for non-negative integer a1...an and non-negative reals x1...xn, t using backtracking search. i.e. Schedule tasks of different fixed lengths s.t. the last task ends as close to the target time as possible.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target
|
|
required | |
*args
|
|
()
|
Returns: the best coefficients
Source code in vimms/Controller/misc.py
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
mzmine2ms2planner
staticmethod
¶
mzmine2ms2planner(inpath, outpath)
Transform MZMine2 box file to ms2planner default format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
inpath
|
Path to input MZMine2 file. |
required | |
outpath
|
Path to output file used in MS2Planner input. |
required |
Returns: None
Source code in vimms/Controller/misc.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 |
|
sched_dict2params
staticmethod
¶
sched_dict2params(schedule, scan_duration_dict)
Scan_duration_dict matches the format of MS scan_duration_dict with fixed scan lengths.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
schedule
|
|
required | |
scan_duration_dict
|
|
required |
Returns: new schedule
Source code in vimms/Controller/misc.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
MZMineParams
dataclass
¶
MZMineParams(mzmine_template: str, mzmine_exe: str)
Bases: AbstractParams
Wrapper class to run MZMine 2 peak-picking from the ViMMS codebase. MZMine 2 allows commands for its processing pipeline to be stored in an .xml and then run via command line using its "batch mode" executable. Given an appropriate "template" .xml this class will substitute input and output file names into it and then run it in batch mode via subprocess.
NOTE: MZMine is not installed with ViMMS. It must be installed separately and the path to the "batch mode" executable specified for this class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mzmine_template
|
str
|
Path to .xml template giving batch commands. |
required |
mzmine_exe
|
str
|
Path to batch mode executable. |
required |
check_files_match
staticmethod
¶
check_files_match(fullscan_names, aligned_path, mode='subset')
Check that the source files listed in the header of a peak-picking output match an input list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fullscan_names
|
List of .mzml files (or paths to them) to look for in the header of the aligned file. |
required | |
aligned_path
|
Full filepath to the aligned file. |
required | |
mode
|
"subset" just checks if all fullscan_names can be found in the header. "exact" checks whether or not the two sets of names exactly match. |
'subset'
|
Tuple of boolean reporting whether test succeeded, the
Type | Description |
---|---|
names of the fullscans given as input, and the names of files |
|
found in the header. |
Source code in vimms/PeakPicking.py
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 |
|
pick_aligned_peaks
¶
pick_aligned_peaks(input_files, output_dir, output_name, force=False)
Run MZMine batch mode file for a list of input files.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_files
|
Iterable of paths to input files. |
required | |
output_dir
|
Directory to write output to. |
required | |
output_name
|
Name for output file. Some text and the file extension are added automatically. |
required | |
force
|
When False, don't run peak-picking if a file already exists at the output destination. |
False
|
Returns: Full path the output file was written to.
Source code in vimms/PeakPicking.py
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
|
read_aligned_csv
staticmethod
¶
read_aligned_csv(box_file_path)
Parse in an aligned boxfile in MZMine 2 format. Each column in an aligned boxfile either has properties related to the whole row (e.g. average m/z of the peak aligned on that row) or a property specific property of an unaligned peak from a parent .mzML. Row properties are parsed into a list of dictionaries (one dictionary per row) in the form [{property_name: value}, ...]. .mzML properties are loaded into a similar list but with a nested dictionary i.e. [{mzml_name: {property_name: value}}, ...].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
box_file_path
|
Full path to the aligned boxfile. |
required |
Tuple of .mzML names and iterable of pairs of row dicts
Type | Description |
---|---|
and .mzML dicts. |
Source code in vimms/PeakPicking.py
165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
|
MatchingController
¶
MatchingController(
schedule=None, advanced_params=None, expected_rts=None, task_filter=None
)
Bases: FixedScansController
A pre-scheduled controller that executes a scan queue planned by a maximum bipartite matching from [vimms.Matching][].
Source code in vimms/Controller/misc.py
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 |
|
from_matching
classmethod
¶
from_matching(
matching, isolation_width, advanced_params=None, task_filter=None
)
Construct a list of MatchingControllers (one for each injection) from a potentially multi-injection matching.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matching
|
Instance of [vimms.Matching.Matching][]. |
required | |
isolation_width
|
Isolation width in Daltons. |
required | |
advanced_params
|
Instance of vimms.Controller.base.AdvancedParams. |
None
|
|
task_filter
|
Object that dynamically returns tasks on request. For example vimms.Controller.misc.TaskFilter can be used to resynchronise unexpected RTs with the expected ones in the schedule. |
None
|
Source code in vimms/Controller/misc.py
615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 |
|
MinIntensityFilter
¶
MinIntensityFilter(min_ms1_intensity)
Bases: ScoreFilter
A class that implements minimum intensity filter
Initialises the minimum intensity filter Args: min_ms1_intensity: the minimum intensity to check
Source code in vimms/Exclusion.py
467 468 469 470 471 472 473 |
|
filter
¶
filter(intensities)
Check whether intensity values are above or below the threshold Args: intensities: an array of intensity values
Returns: an array of indicators for the filter
Source code in vimms/Exclusion.py
475 476 477 478 479 480 481 482 483 484 |
|
MultiIsolationController
¶
MultiIsolationController(
N, isolation_width=DEFAULT_ISOLATION_WIDTH, advanced_params=None
)
Bases: Controller
A controller used to test multiple isolations in a single MS2 scan.
Initialise a multi-isolation controller Args: N: the number of precursor ions to fragment isolation_width: isolation width, in Dalton advanced_params: an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used.
Source code in vimms/Controller/misc.py
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
|
NonOverlapController
¶
NonOverlapController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: TopNEXtController
A controller that implements the non-overlapping
idea to determine how regions-of-interests
should be fragmented across injections.
Source code in vimms/Controller/box.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
ReTopNController
¶
ReTopNController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: TopNEXtController
Reimplementation of the topN controller in the topNEXt framework, allowing it to use features like inclusion boxes.
Source code in vimms/Controller/box.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
RoiBuilder
¶
RoiBuilder(roi_params, smartroi_params=None)
A class to construct ROIs. This can be used in real-time to track ROIs in a controller, or for extracting ROIs from an mzML file.
Initialises an ROI Builder object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
roi_params
|
parameters for ROI building, as defined in vimms.Roi.RoiBuilderParams. |
required | |
smartroi_params
|
other SmartROI parameters, as defined in vimms.Roi.SmartRoiParams. |
None
|
|
grid
|
a grid object, if available |
required |
Source code in vimms/Roi.py
533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 |
|
add_scan_to_roi
¶
add_scan_to_roi(scan)
Stores the information on which scans and frag events are associated to this ROI
Source code in vimms/Roi.py
780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 |
|
get_good_rois
¶
get_good_rois()
Returns all ROIs above filtering criteria
Source code in vimms/Roi.py
803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 |
|
get_mz_intensity
¶
get_mz_intensity(i)
Returns the (m/z, intensity, ROI ID) value of point at position i in this ROI
Parameters:
Name | Type | Description | Default |
---|---|---|---|
i
|
the index of point to return |
required |
Returns: a tuple of (mz, intensity, roi ID)
Source code in vimms/Roi.py
738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 |
|
get_rois
¶
get_rois()
Returns all ROIs
Source code in vimms/Roi.py
797 798 799 800 801 |
|
set_fragmented
¶
set_fragmented(current_task_id, i, roi_id, rt, intensity)
Updates this ROI to indicate that it has been fragmented
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_task_id
|
the current task ID |
required | |
i
|
index of fragmented ROI in the live ROI list |
required | |
roi_id
|
the ID of ROI |
required | |
rt
|
time of fragmentation |
required | |
intensity
|
intensity at fragmentation |
required |
Returns: None
Source code in vimms/Roi.py
754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 |
|
update_roi
¶
update_roi(new_scan)
Updates ROI in real-time based on incoming scans
Parameters:
Name | Type | Description | Default |
---|---|---|---|
new_scan
|
a newly arriving Scan object |
required |
Returns: None
Source code in vimms/Roi.py
564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 |
|
RoiController
¶
RoiController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
smartroi_params=None,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: TopNController
An ROI based controller with multiple options
Initialise an ROI-based controller Args: ionisation_mode: ionisation mode, either POSITIVE or NEGATIVE isolation_width: isolation width in Dalton N: the number of highest-score precursor ions to fragment mz_tol: m/z tolerance -- m/z tolerance for dynamic exclusion window rt_tol: RT tolerance -- RT tolerance for dynamic exclusion window min_ms1_intensity: the minimum intensity to fragment a precursor ion roi_params: an instance of vimms.Roi.RoiBuilderParams that describes how to build ROIs in real time based on incoming scans. smartroi_params: an instance of vimms.Roi.SmartRoiParams. If provided, then the SmartROI rules (as described in the paper) will be used to select which ROI to fragment. Otherwise set to None to use standard ROIs. min_roi_length_for_fragmentation: how long a ROI should be before it can be fragmented. ms1_shift: advanced parameter -- best to leave it. advanced_params: an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. exclusion_method: an instance of vimms.Exclusion.TopNExclusion or its subclasses, used to describe how to perform dynamic exclusion so that precursors that have been fragmented are not fragmented again. exclusion_t_0: parameter for WeightedDEW exclusion (refer to paper for details).
Source code in vimms/Controller/roi.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
|
MS2Scheduler
¶
MS2Scheduler(parent)
A class that performs MS2 scheduling of tasks
Initialises an MS2 scheduler Args: parent: the parent controller class
Source code in vimms/Controller/roi.py
107 108 109 110 111 112 113 114 |
|
schedule_ms2s
¶
schedule_ms2s(new_tasks, ms2_tasks, mz, intensity)
Schedule a new MS2 scan by creating a new default MS2 vimms.Common.ScanParameters. Args: new_tasks: the list of new tasks in the environment ms2_tasks: the list of MS2 tasks in the environment mz: the precursor m/z to fragment intensity: the precusor intensity to fragment
Returns: None
Source code in vimms/Controller/roi.py
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 |
|
schedule_ms1
¶
schedule_ms1(new_tasks)
Schedule a new MS1 scan by creating a new default MS1 vimms.Common.ScanParameters. Args: new_tasks: the list of new tasks in the environment
Returns: None
Source code in vimms/Controller/roi.py
88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
SWATH
¶
SWATH(min_mz, max_mz, width, scan_overlap=0, advanced_params=None)
Bases: Controller
A controller that implements SWATH-MS (Sequential Windowed Acquisition of All Theoretical Fragment Ion Mass Spectra) DIA fragmentation strategy. Should be used in conjunction with MS-DIAL for deconvolution.
Initialise a SWATH-MS controller
Parameters:
Name | Type | Description | Default |
---|---|---|---|
min_mz
|
minimum m/z value |
required | |
max_mz
|
maximum m/z value |
required | |
width
|
width of each SWATH window |
required | |
scan_overlap
|
how much can scans overlap across windows |
0
|
|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
Source code in vimms/Controller/dia.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
write_msdial_experiment_file
¶
write_msdial_experiment_file(filename)
Generates a file that can be read by MS-DIAL to perform deconvolution
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filename
|
path to experiment file in MS-DIAL format |
required |
Returns: None
Source code in vimms/Controller/dia.py
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 |
|
ScanItem
¶
ScanItem(mz, intensity, weight=1)
Represents a scan item object. Used by the WeightedDEW controller to store the pair of m/z and intensity values along with their associated weight
Initialise a ScanItem object Args: mz: m/z value intensity: intensity value weight: the weight for this ScanItem
Source code in vimms/Controller/topN.py
196 197 198 199 200 201 202 203 204 205 206 |
|
ScanParameters
¶
ScanParameters()
A class to store parameters used to instruct the mass spec how to generate a scan. This object is usually created by the controller. It is used by the controller to instruct the mass spec what actions (scans) to perform next.
Create a scan parameter object
Source code in vimms/Common.py
331 332 333 334 335 |
|
compute_isolation_windows
¶
compute_isolation_windows()
Gets the full-width (DDA) isolation window around a precursor m/z
Source code in vimms/Common.py
370 371 372 373 374 375 376 377 |
|
get
¶
get(key)
Gets scan parameter value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
the key to look for |
required |
Returns: the corresponding value in this ScanParameter
Source code in vimms/Common.py
349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
get_all
¶
get_all()
Get all scan parameters Returns: all the scan parameters
Source code in vimms/Common.py
363 364 365 366 367 368 |
|
set
¶
set(key, value)
Set scan parameter value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
key
|
a scan parameter name |
required | |
value
|
a scan parameter value |
required |
Returns: None
Source code in vimms/Common.py
337 338 339 340 341 342 343 344 345 346 347 |
|
SimpleMs1Controller
¶
SimpleMs1Controller(advanced_params=None)
Bases: Controller
A simple MS1 controller which does a full scan of the chemical sample, but no fragmentation
Initialise a full-scan MS1 controller Args: advanced_params: an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used.
Source code in vimms/Controller/fullscan.py
42 43 44 45 46 47 48 49 50 |
|
SmartROIFilter
¶
Bases: ScoreFilter
A class that implements SmartROI filtering criteria. For more details, refer to our paper 'Rapid Development ...'
filter
¶
filter(rois)
Filter ROIs based on SmartROI rules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
rois
|
a list of [vimms.Roi.Roi] objects. if this is a normal ROI object, always return True for everything otherwise track the status based on the SmartROI rules |
required |
Returns: an array of indicator whether ROI can be fragmented or not.
Source code in vimms/Exclusion.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 |
|
TargetedController
¶
TargetedController(
targets,
ce_values,
N=10,
n_replicates=1,
min_ms1_intensity=5000.0,
isolation_width=DEFAULT_ISOLATION_WIDTH,
advanced_params=None,
limit_acquisition=True,
)
Bases: Controller
A controller that is given a list of m/z and RT values to target Attempts to acquire n_replicates of each target at each CE
Source code in vimms/Controller/targeted.py
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 |
|
TaskFilter
¶
TaskFilter(ms1_length, ms2_length, skip_margin=0.5, add_margin=1.2)
Can be used with vimms.Controller.misc.FixedScansController and its subclasses to resynchronise scan RTs if they don't go according to schedule. New scans are dynamically added or deleted if the current RT is before or after the planned RT by a certain threshold (scaled to scan lengths).
Create a new TaskFilter.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ms1_length
|
Expected length of MS1 scans. |
required | |
ms2_length
|
Expected length of MS2 scans. |
required | |
skip_margin
|
Cancel the current task if current RT is closer to expected RT of the following task than skip_margin * current_task_length. |
0.5
|
|
add_margin
|
Add a filler scan if current RT is further away from expected RT of the current task than add_margin * min_task_length. |
1.2
|
Source code in vimms/Controller/misc.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
|
get_task
¶
get_task(scan, scan_id, precursor_id, task_idx, expected_rts, tasks)
Gets the next task and updates the current task index for the parent controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
scan
|
Current scan from parent. |
required | |
scan_id
|
ID of scan. |
required | |
precursor_id
|
ID of last MS1. |
required | |
task_idx
|
Current index in task queue. |
required | |
expected_rts
|
Queue of expected RTs corresponding to tasks. |
required | |
tasks
|
Full task queue. |
required |
Returns: Tuple of new task index and next task.
Source code in vimms/Controller/misc.py
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 |
|
TopNController
¶
TopNController(
ionisation_mode,
N,
isolation_width,
mz_tol,
rt_tol,
min_ms1_intensity,
ms1_shift=0,
initial_exclusion_list=None,
advanced_params=None,
force_N=False,
exclude_after_n_times=1,
exclude_t0=0,
)
Bases: Controller
A controller that implements the standard Top-N DDA fragmentation strategy. Does an MS1 scan followed by N fragmentation scans of the peaks with the highest intensity that are not excluded
Initialise the Top-N controller
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ionisation_mode
|
ionisation mode, either POSITIVE or NEGATIVE |
required | |
N
|
the number of highest-intensity precursor ions to fragment |
required | |
isolation_width
|
isolation width in Dalton |
required | |
mz_tol
|
m/z tolerance -- m/z tolerance for dynamic exclusion window |
required | |
rt_tol
|
RT tolerance -- RT tolerance for dynamic exclusion window |
required | |
min_ms1_intensity
|
the minimum intensity to fragment a precursor ion |
required | |
ms1_shift
|
advanced parameter -- best to leave it. |
0
|
|
initial_exclusion_list
|
initial list of exclusion boxes |
None
|
|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
|
force_N
|
whether to always force N fragmentations. |
False
|
|
exclude_t0
|
time for initial exclusion check. |
0
|
Source code in vimms/Controller/topN.py
16 17 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
TopNEXtController
¶
TopNEXtController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
grid,
smartroi_params=None,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
register_all_roi=False,
scoring_params=GRID_CONTROLLER_SCORING_PARAMS,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: RoiController
A multi-sample controller that use a grid to track which regions-of-interests (ROIs) have been fragmented across multiple injections.
Create a grid controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ionisation_mode
|
ionisation mode, either POSITIVE or NEGATIVE |
required | |
isolation_width
|
isolation width in Dalton |
required | |
N
|
the number of highest-score precursor ions to fragment |
required | |
mz_tol
|
m/z tolerance -- m/z tolerance for dynamic exclusion window |
required | |
rt_tol
|
RT tolerance -- RT tolerance for dynamic exclusion window |
required | |
min_ms1_intensity
|
the minimum intensity to fragment a precursor ion |
required | |
roi_params
|
an instance of vimms.Roi.RoiBuilderParams that describes how to build ROIs in real time based on incoming scans. |
required | |
grid
|
an instance of BoxManager for exclusion/inclusion boxes. |
required | |
smartroi_params
|
an instance of vimms.Roi.SmartRoiParams. If provided, then the SmartROI rules (as described in the paper) will be used to select which ROI to fragment. Otherwise set to None to use standard ROIs. |
None
|
|
min_roi_length_for_fragmentation
|
how long a ROI should be before it can be fragmented. |
0
|
|
ms1_shift
|
advanced parameter -- best to leave it. |
0
|
|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
|
register_all_roi
|
whether to register all ROIs or not |
False
|
|
scoring_params
|
a dictionary of parameters used when calculating scores |
GRID_CONTROLLER_SCORING_PARAMS
|
|
exclusion_method
|
an instance of vimms.Exclusion.TopNExclusion or its subclasses, used to describe how to perform dynamic exclusion so that precursors that have been fragmented are not fragmented again. |
ROI_EXCLUSION_DEW
|
|
exclusion_t_0
|
parameter for WeightedDEW exclusion (refer to paper for details). |
None
|
Source code in vimms/Controller/box.py
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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
|
TopNExclusion
¶
TopNExclusion(
mz_tol,
rt_tol,
exclude_after_n_times=1,
exclude_t0=0,
initial_exclusion_list=None,
)
A class that perform standard dynamic exclusion for Top-N. This is based on checked whether an m/z and RT value lies in certain exclusion boxes.
Initialise a Top-N dynamic exclusion object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mz_tol
|
|
required | |
rt_tol
|
|
required | |
exclude_after_n_times
|
|
1
|
|
exclude_t0
|
|
0
|
|
initial_exclusion_list
|
|
None
|
Source code in vimms/Exclusion.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 |
|
is_excluded
¶
is_excluded(mz, rt)
Checks if a pair of (mz, rt) value is currently excluded by dynamic exclusion window
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mz
|
m/z value |
required | |
rt
|
RT value |
required | |
mz_tol
|
m/z tolerance |
required | |
rt_tol
|
rt_tolerance |
required |
Returns: True if excluded (with weight 0.0), False otherwise (weight 1.0).
Source code in vimms/Exclusion.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|
update
¶
update(current_scan, ms2_tasks)
For every scheduled MS2 scan, add its precursor m/z for initial exclusion check A tolerance of initial_t0 is used
Parameters:
Name | Type | Description | Default |
---|---|---|---|
current_scan
|
the current MS1 scan |
required | |
ms2_tasks
|
scheduled ms2 tasks |
required |
Returns: None
Source code in vimms/Exclusion.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 |
|
TopN_RoiController
¶
TopN_RoiController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: RoiController
A ROI-based controller that implements the Top-N selection.
Initialise the Top-N SmartROI controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ionisation_mode
|
ionisation mode, either POSITIVE or NEGATIVE |
required | |
isolation_width
|
isolation width in Dalton |
required | |
N
|
the number of highest-score precursor ions to fragment |
required | |
mz_tol
|
m/z tolerance -- m/z tolerance for dynamic exclusion window |
required | |
rt_tol
|
RT tolerance -- RT tolerance for dynamic exclusion window |
required | |
min_ms1_intensity
|
the minimum intensity to fragment a precursor ion |
required | |
roi_params
|
an instance of vimms.Roi.RoiBuilderParams that describes how to build ROIs in real time based on incoming scans. |
required | |
min_roi_length_for_fragmentation
|
how long a ROI should be before it can be fragmented. |
0
|
|
ms1_shift
|
advanced parameter -- best to leave it. |
0
|
|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
|
exclusion_method
|
an instance of vimms.Exclusion.TopNExclusion or its subclasses, used to describe how to perform dynamic exclusion so that precursors that have been fragmented are not fragmented again. |
ROI_EXCLUSION_DEW
|
|
exclusion_t_0
|
parameter for WeightedDEW exclusion (refer to paper for details). |
None
|
Source code in vimms/Controller/roi.py
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 406 407 408 409 410 |
|
TopN_SmartRoiController
¶
TopN_SmartRoiController(
ionisation_mode,
isolation_width,
N,
mz_tol,
rt_tol,
min_ms1_intensity,
roi_params,
smartroi_params,
min_roi_length_for_fragmentation=0,
ms1_shift=0,
advanced_params=None,
exclusion_method=ROI_EXCLUSION_DEW,
exclusion_t_0=None,
)
Bases: RoiController
A ROI-based controller that implements the Top-N selection with SmartROI rules. This is used in the paper 'Rapid Development ...'
Initialise the Top-N SmartROI controller.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ionisation_mode
|
ionisation mode, either POSITIVE or NEGATIVE |
required | |
isolation_width
|
isolation width in Dalton |
required | |
N
|
the number of highest-score precursor ions to fragment |
required | |
mz_tol
|
m/z tolerance -- m/z tolerance for dynamic exclusion window |
required | |
rt_tol
|
RT tolerance -- RT tolerance for dynamic exclusion window |
required | |
min_ms1_intensity
|
the minimum intensity to fragment a precursor ion |
required | |
roi_params
|
an instance of vimms.Roi.RoiBuilderParams that describes how to build ROIs in real time based on incoming scans. |
required | |
smartroi_params
|
an instance of vimms.Roi.SmartRoiParams. If provided, then the SmartROI rules (as described in the paper) will be used to select which ROI to fragment. Otherwise set to None to use standard ROIs. |
required | |
min_roi_length_for_fragmentation
|
how long a ROI should be before it can be fragmented. |
0
|
|
ms1_shift
|
advanced parameter -- best to leave it. |
0
|
|
advanced_params
|
an vimms.Controller.base.AdvancedParams object that contains advanced parameters to control the mass spec. If left to None, default values will be used. |
None
|
|
exclusion_method
|
an instance of vimms.Exclusion.TopNExclusion or its subclasses, used to describe how to perform dynamic exclusion so that precursors that have been fragmented are not fragmented again. |
ROI_EXCLUSION_DEW
|
|
exclusion_t_0
|
parameter for WeightedDEW exclusion (refer to paper for details). |
None
|
Source code in vimms/Controller/roi.py
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 |
|
WeightedDEWController
¶
WeightedDEWController(
ionisation_mode,
N,
isolation_width,
mz_tol,
rt_tol,
min_ms1_intensity,
ms1_shift=0,
exclusion_t_0=15,
log_intensity=False,
advanced_params=None,
)
Bases: TopNController
A variant of the Top-N controller, but it uses a linear weight for dynamic exclusion window rather than a True/False indicator on whether a certain precursor ion is excluded or not. For more details, refer to our paper.
Source code in vimms/Controller/topN.py
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
|
WeightedDEWExclusion
¶
WeightedDEWExclusion(mz_tol, rt_tol, exclusion_t_0)
Bases: TopNExclusion
A class that perform weighted dynamic exclusion for Top-N. This is further described in our paper 'Rapid Development ...'
Initialises a weighted dynamic exclusion object Args: rt_tol: the RT tolerance (in seconds) exclusion_t_0: WeightedDEW parameter
Source code in vimms/Exclusion.py
383 384 385 386 387 388 389 390 391 392 393 |
|
WeightedDEWFilter
¶
WeightedDEWFilter(exclusion)
Bases: ScoreFilter
A class that implements weighted dynamic exclusion filter
Initialises a weighted dynamic exclusion filter
Parameters:
Name | Type | Description | Default |
---|---|---|---|
exclusion
|
a vimms.Exclusion.ExclusionItem object |
required |
Source code in vimms/Exclusion.py
522 523 524 525 526 527 528 529 |
|
filter
¶
filter(current_rt, rois)
Check whether ROIs are excluded or not based on weighted dynamic exclusion filter Args: current_rt: the current RT value rois: a list of vimms.Roi.Roi objects.
Returns: a numpy array of weights for each ROI.
Source code in vimms/Exclusion.py
531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 |
|
WrapperController
¶
WrapperController()
Bases: Controller
Template for controller which wraps behaviour of at least one other controller.
Source code in vimms/Controller/base.py
388 389 |
|
create_if_not_exist
¶
create_if_not_exist(out_dir)
Creates a directory if it doesn't already exist Args: out_dir: the directory to create, if it doesn't exist
Returns: None.
Source code in vimms/Common.py
428 429 430 431 432 433 434 435 436 437 438 439 |
|
create_targets_from_toxid
¶
create_targets_from_toxid(
toxid_file_name,
file_rt_units="minutes",
mz_delta=10,
rt_delta=60.0,
polarity_filter=["+"],
adducts_to_use=["[M+H]+", "[M+K]+", "[M+Na]+"],
)
Note: mz_delta is in ppm
Source code in vimms/Controller/targeted.py
14 15 16 17 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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
|
get_dda_scan_param
¶
get_dda_scan_param(
mz,
intensity,
precursor_scan_id,
isolation_width,
mz_tol,
rt_tol,
agc_target=DEFAULT_MS2_AGC_TARGET,
max_it=DEFAULT_MS2_MAXIT,
collision_energy=DEFAULT_MS2_COLLISION_ENERGY,
source_cid_energy=DEFAULT_SOURCE_CID_ENERGY,
orbitrap_resolution=DEFAULT_MS2_ORBITRAP_RESOLUTION,
mass_analyser=DEFAULT_MS2_MASS_ANALYSER,
activation_type=DEFAULT_MS1_ACTIVATION_TYPE,
isolation_mode=DEFAULT_MS2_ISOLATION_MODE,
polarity=POSITIVE,
metadata=None,
scan_id=None,
)
Generate the default MS2 scan parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mz
|
m/z of precursor peak to fragment |
required | |
intensity
|
intensity of precursor peak to fragment |
required | |
precursor_scan_id
|
scan ID of the MS1 scan containing the precursor peak |
required | |
isolation_width
|
isolation width, in Dalton |
required | |
mz_tol
|
m/z tolerance for dynamic exclusion # FIXME: this shouldn't be here |
required | |
rt_tol
|
RT tolerance for dynamic exclusion # FIXME: this shouldn't be here |
required | |
agc_target
|
AGC (automatic gain control) target |
DEFAULT_MS2_AGC_TARGET
|
|
max_it
|
maximum time to collect ion |
DEFAULT_MS2_MAXIT
|
|
collision_energy
|
the collision energy to use |
DEFAULT_MS2_COLLISION_ENERGY
|
|
source_cid_energy
|
source CID energy |
DEFAULT_SOURCE_CID_ENERGY
|
|
orbitrap_resolution
|
resolution of the mass-spec (Orbitrap) instrument |
DEFAULT_MS2_ORBITRAP_RESOLUTION
|
|
mass_analyser
|
which mass analyser to use |
DEFAULT_MS2_MASS_ANALYSER
|
|
activation_type
|
activation type, either HCD or CID |
DEFAULT_MS1_ACTIVATION_TYPE
|
|
isolation_mode
|
isolation mode, either None, or Quadrupole or IonTrap |
DEFAULT_MS2_ISOLATION_MODE
|
|
polarity
|
the polarity value, either POSITIVE or NEGATIVE |
POSITIVE
|
|
metadata
|
additional metadata to include in this scan |
None
|
|
scan_id
|
the scan ID, if specified |
None
|
Returns: the parameters of the MS2 scan to create
Source code in vimms/Common.py
768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 |
|
get_default_scan_params
¶
get_default_scan_params(
polarity=POSITIVE,
agc_target=DEFAULT_MS1_AGC_TARGET,
max_it=DEFAULT_MS1_MAXIT,
collision_energy=DEFAULT_MS1_COLLISION_ENERGY,
source_cid_energy=DEFAULT_SOURCE_CID_ENERGY,
orbitrap_resolution=DEFAULT_MS1_ORBITRAP_RESOLUTION,
default_ms1_scan_window=DEFAULT_MS1_SCAN_WINDOW,
mass_analyser=DEFAULT_MS1_MASS_ANALYSER,
activation_type=DEFAULT_MS1_ACTIVATION_TYPE,
isolation_mode=DEFAULT_MS1_ISOLATION_MODE,
metadata=None,
scan_id=None,
)
Generate the default MS1 scan parameters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
polarity
|
the polarity value, either POSITIVE or NEGATIVE |
POSITIVE
|
|
agc_target
|
AGC (automatic gain control) target |
DEFAULT_MS1_AGC_TARGET
|
|
max_it
|
maximum time to collect ion |
DEFAULT_MS1_MAXIT
|
|
collision_energy
|
the collision energy to use |
DEFAULT_MS1_COLLISION_ENERGY
|
|
source_cid_energy
|
source CID energy |
DEFAULT_SOURCE_CID_ENERGY
|
|
orbitrap_resolution
|
resolution of the mass-spec (Orbitrap) instrument |
DEFAULT_MS1_ORBITRAP_RESOLUTION
|
|
default_ms1_scan_window
|
the default MS1 scan window |
DEFAULT_MS1_SCAN_WINDOW
|
|
mass_analyser
|
which mass analyser to use |
DEFAULT_MS1_MASS_ANALYSER
|
|
activation_type
|
activation type, either HCD or CID |
DEFAULT_MS1_ACTIVATION_TYPE
|
|
isolation_mode
|
isolation mode, either None, or Quadrupole or IonTrap |
DEFAULT_MS1_ISOLATION_MODE
|
|
metadata
|
additional metadata to include in this scan |
None
|
|
scan_id
|
the scan ID, if specified |
None
|
Returns: the parameters of the MS1 scan to create
Source code in vimms/Common.py
714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 |
|