or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

alignment.mdchemistry.mdfeature-detection.mdfile-io.mdindex.mdms-data.mdpeptide-protein.mdtargeted-analysis.md

targeted-analysis.mddocs/

0

# Targeted Analysis and MRM

1

2

Specialized functionality for targeted mass spectrometry including MRM/SRM analysis, transition lists, and quantitative workflows. Essential for hypothesis-driven proteomics and biomarker quantification.

3

4

## Capabilities

5

6

### Targeted Experiments

7

8

#### TargetedExperiment

9

10

Complete targeted experiment definition with transitions and metadata.

11

12

```python { .api }

13

class TargetedExperiment:

14

def __init__(self) -> None: ...

15

16

def getTransitions(self) -> list[ReactionMonitoringTransition]:

17

"""

18

Get all transitions.

19

20

Returns:

21

list[ReactionMonitoringTransition]: List of transitions

22

"""

23

24

def setTransitions(self, transitions: list[ReactionMonitoringTransition]) -> None:

25

"""

26

Set transitions.

27

28

Args:

29

transitions (list[ReactionMonitoringTransition]): Transitions to set

30

"""

31

32

def addTransition(self, transition: ReactionMonitoringTransition) -> None:

33

"""

34

Add transition.

35

36

Args:

37

transition (ReactionMonitoringTransition): Transition to add

38

"""

39

40

def getCompounds(self) -> list[Compound]:

41

"""

42

Get compound definitions.

43

44

Returns:

45

list[Compound]: List of compounds

46

"""

47

48

def setCompounds(self, compounds: list[Compound]) -> None:

49

"""

50

Set compounds.

51

52

Args:

53

compounds (list[Compound]): Compounds to set

54

"""

55

56

def addCompound(self, compound: Compound) -> None:

57

"""

58

Add compound.

59

60

Args:

61

compound (Compound): Compound to add

62

"""

63

64

def getProteins(self) -> list[Protein]:

65

"""

66

Get protein definitions.

67

68

Returns:

69

list[Protein]: List of proteins

70

"""

71

72

def setProteins(self, proteins: list[Protein]) -> None:

73

"""

74

Set proteins.

75

76

Args:

77

proteins (list[Protein]): Proteins to set

78

"""

79

80

def addProtein(self, protein: Protein) -> None:

81

"""

82

Add protein.

83

84

Args:

85

protein (Protein): Protein to add

86

"""

87

88

def getPeptides(self) -> list[Peptide]:

89

"""

90

Get peptide definitions.

91

92

Returns:

93

list[Peptide]: List of peptides

94

"""

95

96

def setPeptides(self, peptides: list[Peptide]) -> None:

97

"""

98

Set peptides.

99

100

Args:

101

peptides (list[Peptide]): Peptides to set

102

"""

103

104

def addPeptide(self, peptide: Peptide) -> None:

105

"""

106

Add peptide.

107

108

Args:

109

peptide (Peptide): Peptide to add

110

"""

111

112

def sortTransitionsByProductMZ(self) -> None:

113

"""Sort transitions by product m/z."""

114

115

def getTransitionByRef(self, ref: str) -> ReactionMonitoringTransition:

116

"""

117

Get transition by reference.

118

119

Args:

120

ref (str): Transition reference ID

121

122

Returns:

123

ReactionMonitoringTransition: The transition

124

"""

125

```

126

127

#### ReactionMonitoringTransition

128

129

Individual MRM/SRM transition definition.

130

131

```python { .api }

132

class ReactionMonitoringTransition:

133

def __init__(self) -> None: ...

134

135

def getName(self) -> str:

136

"""

137

Get transition name.

138

139

Returns:

140

str: Transition name

141

"""

142

143

def setName(self, name: str) -> None:

144

"""

145

Set transition name.

146

147

Args:

148

name (str): Transition name

149

"""

150

151

def getNativeID(self) -> str:

152

"""

153

Get native ID.

154

155

Returns:

156

str: Native identifier

157

"""

158

159

def setNativeID(self, id: str) -> None:

160

"""

161

Set native ID.

162

163

Args:

164

id (str): Native identifier

165

"""

166

167

def getPrecursor(self) -> Precursor:

168

"""

169

Get precursor ion.

170

171

Returns:

172

Precursor: Precursor ion definition

173

"""

174

175

def setPrecursor(self, precursor: Precursor) -> None:

176

"""

177

Set precursor ion.

178

179

Args:

180

precursor (Precursor): Precursor ion definition

181

"""

182

183

def getProduct(self) -> Product:

184

"""

185

Get product ion.

186

187

Returns:

188

Product: Product ion definition

189

"""

190

191

def setProduct(self, product: Product) -> None:

192

"""

193

Set product ion.

194

195

Args:

196

product (Product): Product ion definition

197

"""

198

199

def getRetentionTime(self) -> RetentionTime:

200

"""

201

Get retention time constraint.

202

203

Returns:

204

RetentionTime: RT constraint

205

"""

206

207

def setRetentionTime(self, rt: RetentionTime) -> None:

208

"""

209

Set retention time constraint.

210

211

Args:

212

rt (RetentionTime): RT constraint

213

"""

214

215

def getPeptideRef(self) -> str:

216

"""

217

Get peptide reference.

218

219

Returns:

220

str: Peptide reference ID

221

"""

222

223

def setPeptideRef(self, ref: str) -> None:

224

"""

225

Set peptide reference.

226

227

Args:

228

ref (str): Peptide reference ID

229

"""

230

231

def getCompoundRef(self) -> str:

232

"""

233

Get compound reference.

234

235

Returns:

236

str: Compound reference ID

237

"""

238

239

def setCompoundRef(self, ref: str) -> None:

240

"""

241

Set compound reference.

242

243

Args:

244

ref (str): Compound reference ID

245

"""

246

247

def getDecoyTransitionType(self) -> DecoyTransitionType:

248

"""

249

Get decoy type.

250

251

Returns:

252

DecoyTransitionType: Decoy classification

253

"""

254

255

def setDecoyTransitionType(self, type: DecoyTransitionType) -> None:

256

"""

257

Set decoy type.

258

259

Args:

260

type (DecoyTransitionType): Decoy classification

261

"""

262

263

def isTargetTransition(self) -> bool:

264

"""

265

Check if target transition.

266

267

Returns:

268

bool: True if target transition

269

"""

270

271

def isDecoyTransition(self) -> bool:

272

"""

273

Check if decoy transition.

274

275

Returns:

276

bool: True if decoy transition

277

"""

278

279

class DecoyTransitionType:

280

TARGET = 0

281

DECOY = 1

282

UNKNOWN = 2

283

```

284

285

### MRM Features and Analysis

286

287

#### MRMFeature

288

289

Feature detected in MRM experiment.

290

291

```python { .api }

292

class MRMFeature:

293

def __init__(self) -> None: ...

294

295

def getRT(self) -> float:

296

"""

297

Get retention time.

298

299

Returns:

300

float: Retention time in seconds

301

"""

302

303

def setRT(self, rt: float) -> None:

304

"""

305

Set retention time.

306

307

Args:

308

rt (float): Retention time in seconds

309

"""

310

311

def getIntensity(self) -> float:

312

"""

313

Get feature intensity.

314

315

Returns:

316

float: Feature intensity

317

"""

318

319

def setIntensity(self, intensity: float) -> None:

320

"""

321

Set intensity.

322

323

Args:

324

intensity (float): Feature intensity

325

"""

326

327

def getOverallQuality(self) -> float:

328

"""

329

Get overall quality score.

330

331

Returns:

332

float: Quality score

333

"""

334

335

def setOverallQuality(self, quality: float) -> None:

336

"""

337

Set quality score.

338

339

Args:

340

quality (float): Quality score

341

"""

342

343

def getScore(self, score_name: str) -> float:

344

"""

345

Get named score.

346

347

Args:

348

score_name (str): Score name

349

350

Returns:

351

float: Score value

352

"""

353

354

def setScore(self, score_name: str, score: float) -> None:

355

"""

356

Set named score.

357

358

Args:

359

score_name (str): Score name

360

score (float): Score value

361

"""

362

363

def getFeature(self, key: str) -> Feature:

364

"""

365

Get sub-feature by key.

366

367

Args:

368

key (str): Feature key

369

370

Returns:

371

Feature: Sub-feature

372

"""

373

374

def addFeature(self, feature: Feature, key: str) -> None:

375

"""

376

Add sub-feature.

377

378

Args:

379

feature (Feature): Sub-feature to add

380

key (str): Feature key

381

"""

382

383

def getFeatureIDs(self) -> list[str]:

384

"""

385

Get all feature keys.

386

387

Returns:

388

list[str]: List of feature keys

389

"""

390

391

class MRMTransitionGroup:

392

def __init__(self) -> None: ...

393

394

def getTransitionGroupID(self) -> str:

395

"""

396

Get transition group ID.

397

398

Returns:

399

str: Group identifier

400

"""

401

402

def setTransitionGroupID(self, id: str) -> None:

403

"""

404

Set transition group ID.

405

406

Args:

407

id (str): Group identifier

408

"""

409

410

def getTransitions(self) -> list[ReactionMonitoringTransition]:

411

"""

412

Get transitions in group.

413

414

Returns:

415

list[ReactionMonitoringTransition]: Transitions

416

"""

417

418

def addTransition(self, transition: ReactionMonitoringTransition, key: str) -> None:

419

"""

420

Add transition to group.

421

422

Args:

423

transition (ReactionMonitoringTransition): Transition to add

424

key (str): Transition key

425

"""

426

427

def getChromatograms(self) -> list[MSChromatogram]:

428

"""

429

Get chromatograms.

430

431

Returns:

432

list[MSChromatogram]: Transition chromatograms

433

"""

434

435

def addChromatogram(self, chromatogram: MSChromatogram, key: str) -> None:

436

"""

437

Add chromatogram.

438

439

Args:

440

chromatogram (MSChromatogram): Chromatogram to add

441

key (str): Chromatogram key

442

"""

443

```

444

445

### Target Definitions

446

447

#### Compound and Peptide Definitions

448

449

```python { .api }

450

class Compound:

451

def __init__(self) -> None: ...

452

453

def getId(self) -> str:

454

"""Get compound ID."""

455

456

def setId(self, id: str) -> None:

457

"""Set compound ID."""

458

459

def getMolecularFormula(self) -> str:

460

"""Get molecular formula."""

461

462

def setMolecularFormula(self, formula: str) -> None:

463

"""Set molecular formula."""

464

465

def getSmiles(self) -> str:

466

"""Get SMILES string."""

467

468

def setSmiles(self, smiles: str) -> None:

469

"""Set SMILES string."""

470

471

def getInChI(self) -> str:

472

"""Get InChI string."""

473

474

def setInChI(self, inchi: str) -> None:

475

"""Set InChI string."""

476

477

def getTheoreticalMass(self) -> float:

478

"""Get theoretical mass."""

479

480

def setTheoreticalMass(self, mass: float) -> None:

481

"""Set theoretical mass."""

482

483

def getRetentionTimes(self) -> list[RetentionTime]:

484

"""Get retention time constraints."""

485

486

def addRetentionTime(self, rt: RetentionTime) -> None:

487

"""Add retention time constraint."""

488

489

class Peptide:

490

def __init__(self) -> None: ...

491

492

def getId(self) -> str:

493

"""Get peptide ID."""

494

495

def setId(self, id: str) -> None:

496

"""Set peptide ID."""

497

498

def getSequence(self) -> str:

499

"""Get peptide sequence."""

500

501

def setSequence(self, sequence: str) -> None:

502

"""Set peptide sequence."""

503

504

def getModifications(self) -> list[Modification]:

505

"""Get peptide modifications."""

506

507

def addModification(self, mod: Modification) -> None:

508

"""Add modification."""

509

510

def getChargeStates(self) -> list[int]:

511

"""Get charge states."""

512

513

def addChargeState(self, charge: int) -> None:

514

"""Add charge state."""

515

516

def getProteinRefs(self) -> list[str]:

517

"""Get protein references."""

518

519

def addProteinRef(self, ref: str) -> None:

520

"""Add protein reference."""

521

522

def getRetentionTimes(self) -> list[RetentionTime]:

523

"""Get retention time constraints."""

524

525

def addRetentionTime(self, rt: RetentionTime) -> None:

526

"""Add retention time constraint."""

527

```

528

529

### Quantification Methods

530

531

#### OpenSWATH Analysis

532

533

```python { .api }

534

class OpenSwathWorkflow:

535

def __init__(self) -> None: ...

536

537

def performExtraction(self, input: MSExperiment, targeted_exp: TargetedExperiment,

538

output: FeatureMap, trafo: TransformationDescription) -> None:

539

"""

540

Perform OpenSWATH feature extraction.

541

542

Args:

543

input (MSExperiment): Input DIA data

544

targeted_exp (TargetedExperiment): Transition library

545

output (FeatureMap): Output features

546

trafo (TransformationDescription): RT transformation

547

"""

548

549

def getParameters(self) -> Param:

550

"""Get workflow parameters."""

551

552

def setParameters(self, param: Param) -> None:

553

"""Set workflow parameters."""

554

555

class DIAScoring:

556

def __init__(self) -> None: ...

557

558

def dia_score(self, transition_group: MRMTransitionGroup,

559

spectrum: list[MSSpectrum]) -> None:

560

"""

561

Score DIA transition group.

562

563

Args:

564

transition_group (MRMTransitionGroup): Transition group to score

565

spectrum (list[MSSpectrum]): DIA spectra

566

"""

567

568

def getParameters(self) -> Param:

569

"""Get scoring parameters."""

570

```

571

572

#### Peak Integration

573

574

```python { .api }

575

class MRMTransitionGroupPicker:

576

def __init__(self) -> None: ...

577

578

def pickTransitionGroup(self, chromatograms: list[MSChromatogram]) -> MRMFeature:

579

"""

580

Pick peaks in transition group chromatograms.

581

582

Args:

583

chromatograms (list[MSChromatogram]): Input chromatograms

584

585

Returns:

586

MRMFeature: Detected MRM feature

587

"""

588

589

def getParameters(self) -> Param:

590

"""Get picking parameters."""

591

592

def setParameters(self, param: Param) -> None:

593

"""Set picking parameters."""

594

595

class PeakIntegrator:

596

def __init__(self) -> None: ...

597

598

def integratePeak(self, chromatogram: MSChromatogram, left: float,

599

right: float) -> tuple[float, float]:

600

"""

601

Integrate chromatographic peak.

602

603

Args:

604

chromatogram (MSChromatogram): Input chromatogram

605

left (float): Left boundary RT

606

right (float): Right boundary RT

607

608

Returns:

609

tuple[float, float]: (area, height)

610

"""

611

612

def getParameters(self) -> Param:

613

"""Get integration parameters."""

614

```

615

616

### Retention Time Constraints

617

618

#### RetentionTime

619

620

Retention time constraint for targeted analysis.

621

622

```python { .api }

623

class RetentionTime:

624

def __init__(self) -> None: ...

625

626

def getRT(self) -> float:

627

"""

628

Get retention time.

629

630

Returns:

631

float: Retention time in seconds

632

"""

633

634

def setRT(self, rt: float) -> None:

635

"""

636

Set retention time.

637

638

Args:

639

rt (float): Retention time in seconds

640

"""

641

642

def getRTUnit(self) -> RTUnit:

643

"""

644

Get retention time unit.

645

646

Returns:

647

RTUnit: Time unit

648

"""

649

650

def setRTUnit(self, unit: RTUnit) -> None:

651

"""

652

Set retention time unit.

653

654

Args:

655

unit (RTUnit): Time unit

656

"""

657

658

def getRTType(self) -> RTType:

659

"""

660

Get retention time type.

661

662

Returns:

663

RTType: RT type (predicted, observed, etc.)

664

"""

665

666

def setRTType(self, type: RTType) -> None:

667

"""

668

Set retention time type.

669

670

Args:

671

type (RTType): RT type

672

"""

673

674

def getRTWindow(self) -> tuple[float, float]:

675

"""

676

Get retention time window.

677

678

Returns:

679

tuple[float, float]: (lower_bound, upper_bound)

680

"""

681

682

def setRTWindow(self, lower: float, upper: float) -> None:

683

"""

684

Set retention time window.

685

686

Args:

687

lower (float): Lower bound

688

upper (float): Upper bound

689

"""

690

691

class RTUnit:

692

SECOND = 0

693

MINUTE = 1

694

695

class RTType:

696

PREDICTED = 0

697

OBSERVED = 1

698

NORMALIZED = 2

699

```

700

701

## Usage Examples

702

703

### Creating Targeted Experiment

704

705

```python

706

import pyopenms

707

708

# Create targeted experiment

709

targeted_exp = pyopenms.TargetedExperiment()

710

711

# Define protein

712

protein = pyopenms.Protein()

713

protein.setId("P12345")

714

protein.setSequence("MPROTEINSEQUENCK")

715

targeted_exp.addProtein(protein)

716

717

# Define peptide

718

peptide = pyopenms.Peptide()

719

peptide.setId("PEPTIDE_1")

720

peptide.setSequence("PEPTIDE")

721

peptide.addChargeState(2)

722

peptide.addProteinRef("P12345")

723

724

# Add retention time constraint

725

rt = pyopenms.RetentionTime()

726

rt.setRT(123.45)

727

rt.setRTWindow(113.45, 133.45) # ±10 seconds

728

peptide.addRetentionTime(rt)

729

730

targeted_exp.addPeptide(peptide)

731

732

# Create transitions

733

for product_mz in [200.1, 300.2, 400.3]:

734

transition = pyopenms.ReactionMonitoringTransition()

735

transition.setName(f"PEPTIDE_2_{product_mz:.1f}")

736

transition.setPeptideRef("PEPTIDE_1")

737

738

# Set precursor

739

precursor = pyopenms.Precursor()

740

precursor.setMZ(400.7) # [M+2H]2+

741

precursor.setCharge(2)

742

transition.setPrecursor(precursor)

743

744

# Set product

745

product = pyopenms.Product()

746

product.setMZ(product_mz)

747

product.setCharge(1)

748

transition.setProduct(product)

749

750

# Set retention time

751

transition.setRetentionTime(rt)

752

753

targeted_exp.addTransition(transition)

754

755

print(f"Created targeted experiment with {len(targeted_exp.getTransitions())} transitions")

756

757

# Save to TraML file

758

pyopenms.TraMLFile().store("targeted_experiment.traml", targeted_exp)

759

```

760

761

### MRM Data Analysis

762

763

```python

764

import pyopenms

765

766

# Load MRM data and targeted experiment

767

exp = pyopenms.MSExperiment()

768

pyopenms.MzMLFile().load("mrm_data.mzML", exp)

769

770

targeted_exp = pyopenms.TargetedExperiment()

771

pyopenms.TraMLFile().load("transitions.traml", targeted_exp)

772

773

print(f"Loaded {exp.getNrChromatograms()} chromatograms")

774

print(f"Loaded {len(targeted_exp.getTransitions())} transitions")

775

776

# Extract chromatograms for each transition group

777

transition_groups = {}

778

transitions = targeted_exp.getTransitions()

779

780

for transition in transitions:

781

peptide_ref = transition.getPeptideRef()

782

if peptide_ref not in transition_groups:

783

transition_groups[peptide_ref] = []

784

transition_groups[peptide_ref].append(transition)

785

786

print(f"Found {len(transition_groups)} transition groups")

787

788

# Process each transition group

789

picker = pyopenms.MRMTransitionGroupPicker()

790

params = picker.getParameters()

791

params.setValue("min_peak_width", 5.0)

792

params.setValue("peak_integration", "original")

793

picker.setParameters(params)

794

795

results = []

796

for peptide_ref, group_transitions in transition_groups.items():

797

print(f"Processing {peptide_ref} with {len(group_transitions)} transitions")

798

799

# Get chromatograms for this group

800

group_chromatograms = []

801

for chrom in exp.getChromatograms():

802

native_id = chrom.getNativeID()

803

for transition in group_transitions:

804

if transition.getName() in native_id:

805

group_chromatograms.append(chrom)

806

break

807

808

if group_chromatograms:

809

# Pick peaks

810

feature = picker.pickTransitionGroup(group_chromatograms)

811

812

result = {

813

'peptide': peptide_ref,

814

'rt': feature.getRT(),

815

'intensity': feature.getIntensity(),

816

'quality': feature.getOverallQuality()

817

}

818

results.append(result)

819

820

# Display results

821

print("\nMRM Analysis Results:")

822

for result in results:

823

print(f"{result['peptide']}: RT={result['rt']:.2f}, "

824

f"Intensity={result['intensity']:.0f}, "

825

f"Quality={result['quality']:.3f}")

826

```

827

828

### OpenSWATH DIA Analysis

829

830

```python

831

import pyopenms

832

833

# Load DIA data

834

exp = pyopenms.MSExperiment()

835

pyopenms.MzMLFile().load("dia_data.mzML", exp)

836

837

# Load spectral library

838

targeted_exp = pyopenms.TargetedExperiment()

839

pyopenms.TraMLFile().load("spectral_library.traml", targeted_exp)

840

841

# Set up OpenSWATH workflow

842

osw = pyopenms.OpenSwathWorkflow()

843

params = osw.getParameters()

844

845

# Configure scoring parameters

846

params.setValue("Scoring:stop_report_after_feature", 5)

847

params.setValue("Scoring:rt_normalization_factor", 100.0)

848

params.setValue("Scoring:quantification_cutoff", 0.01)

849

params.setValue("Scoring:write_convex_hull", "false")

850

851

# Configure extraction parameters

852

params.setValue("Library:retentionTimeInterpretation", "seconds")

853

params.setValue("Library:override_group_label_check", "false")

854

855

osw.setParameters(params)

856

857

# Run extraction

858

output_features = pyopenms.FeatureMap()

859

trafo = pyopenms.TransformationDescription()

860

861

print("Running OpenSWATH extraction...")

862

osw.performExtraction(exp, targeted_exp, output_features, trafo)

863

864

print(f"Extracted {output_features.size()} features")

865

866

# Export results

867

pyopenms.FeatureXMLFile().store("openswath_results.featureXML", output_features)

868

869

# Analyze results

870

high_confidence = 0

871

for feature in output_features:

872

main_score = feature.getMetaValue("main_var_xx_swath_prelim_score")

873

if main_score < 0.01: # High confidence threshold

874

high_confidence += 1

875

876

print(f"High confidence identifications: {high_confidence}")

877

```

878

879

### Transition List Generation

880

881

```python

882

import pyopenms

883

884

# Load protein sequences

885

fasta_entries = []

886

pyopenms.FASTAFile().load("proteins.fasta", fasta_entries)

887

888

# Set up digestion

889

digester = pyopenms.EnzymaticDigestion()

890

digester.setEnzyme("Trypsin")

891

digester.setMissedCleavages(1)

892

893

# Create targeted experiment

894

targeted_exp = pyopenms.TargetedExperiment()

895

896

peptide_id = 0

897

transition_id = 0

898

899

for entry in fasta_entries[:10]: # Process first 10 proteins

900

protein = pyopenms.Protein()

901

protein.setId(entry.getIdentifier())

902

protein.setSequence(entry.getSequence())

903

targeted_exp.addProtein(protein)

904

905

# Digest protein

906

peptides = []

907

digester.digest(pyopenms.AASequence.fromString(entry.getSequence()), peptides)

908

909

for pep_seq in peptides:

910

if 7 <= len(pep_seq) <= 25: # Reasonable peptide length

911

peptide = pyopenms.Peptide()

912

peptide.setId(f"peptide_{peptide_id}")

913

peptide.setSequence(pep_seq.toString())

914

peptide.addProteinRef(entry.getIdentifier())

915

916

# Add charge states

917

for charge in [2, 3]:

918

peptide.addChargeState(charge)

919

920

# Generate theoretical spectrum

921

generator = pyopenms.TheoreticalSpectrumGenerator()

922

spec = pyopenms.MSSpectrum()

923

generator.getSpectrum(spec, pep_seq, charge, 1)

924

925

precursor_mz = (pep_seq.getMonoWeight() + charge * 1.007276) / charge

926

927

# Create transitions for top 5 fragments

928

peaks = spec.get_peaks()

929

if len(peaks[0]) > 0:

930

# Sort by intensity and take top 5

931

peak_list = list(zip(peaks[0], peaks[1]))

932

peak_list.sort(key=lambda x: x[1], reverse=True)

933

934

for i, (product_mz, intensity) in enumerate(peak_list[:5]):

935

transition = pyopenms.ReactionMonitoringTransition()

936

transition.setName(f"transition_{transition_id}")

937

transition.setPeptideRef(f"peptide_{peptide_id}")

938

939

# Set precursor

940

precursor = pyopenms.Precursor()

941

precursor.setMZ(precursor_mz)

942

precursor.setCharge(charge)

943

transition.setPrecursor(precursor)

944

945

# Set product

946

product = pyopenms.Product()

947

product.setMZ(product_mz)

948

product.setCharge(1)

949

transition.setProduct(product)

950

951

targeted_exp.addTransition(transition)

952

transition_id += 1

953

954

targeted_exp.addPeptide(peptide)

955

peptide_id += 1

956

957

print(f"Generated {len(targeted_exp.getTransitions())} transitions")

958

print(f"for {len(targeted_exp.getPeptides())} peptides")

959

print(f"from {len(targeted_exp.getProteins())} proteins")

960

961

# Save transition list

962

pyopenms.TraMLFile().store("generated_transitions.traml", targeted_exp)

963

```