← Về thư mục
tests/pyopenms/test_scripts.py
- run_script · function · L84-L98 — def run_script(name: str, *arguments: str, cwd: Path) -> subprocess.CompletedProcess
- spectrum · function · L101-L114 — def spectrum(rt: float, level: int, peaks, precursor_mz: float | None = None)
- feature_map · function · L117-L128 — def feature_map(entries)
- TemporaryDirectoryTestCase · class · L131-L135 — class TemporaryDirectoryTestCase(unittest.TestCase)
- setUp · method · L132-L135 — def setUp(self) -> None
- ExampleExperimentMixin · class · L138-L152 — class ExampleExperimentMixin
- experiment · method · L147-L152 — def experiment()
- ProtonMassTests · class · L155-L171 — class ProtonMassTests(unittest.TestCase)
- test_the_proton_mass_matches_codata · method · L156-L159 — def test_the_proton_mass_matches_codata(self) -> None: # Every reported m/z is (M + z*PROTON)/z, so an error here is a constant # offset on every row of every output table.
- test_both_scripts_that_convert_to_mz_use_the_same_constant · method · L161-L164 — def test_both_scripts_that_convert_to_mz_use_the_same_constant(self) -> None: # mass_calculator and digest_protein each define PROTON; tables produced # by the two would otherwise disagree in the last digits.
- test_the_proton_is_lighter_than_a_hydrogen_atom · method · L166-L171 — def test_the_proton_is_lighter_than_a_hydrogen_atom(self) -> None: # A protonated ion has lost an electron. Using the neutral H mass # instead is the classic off-by-one-electron error, worth ~0.5 mDa.
- IsotopePatternTests · class · L174-L216 — class IsotopePatternTests(TemporaryDirectoryTestCase)
- rows · method · L177-L185 — def rows(self, formula: str, count: int) -> list[tuple[float, float]]
- test_the_first_peak_is_the_monoisotopic_mass · method · L187-L190 — def test_the_first_peak_is_the_monoisotopic_mass(self) -> None
- test_consecutive_peaks_are_one_neutron_apart · method · L192-L198 — def test_consecutive_peaks_are_one_neutron_apart(self) -> None: # The 13C-12C mass difference is 1.00336 u; anything near 0.5 or 2 would # mean the container was misread.
- test_the_abundances_fall_away_from_the_monoisotopic_peak · method · L200-L207 — def test_the_abundances_fall_away_from_the_monoisotopic_peak(self) -> None
- test_a_single_requested_peak_is_the_monoisotopic_one · method · L209-L212 — def test_a_single_requested_peak_is_the_monoisotopic_one(self) -> None
- test_no_csv_is_written_when_none_is_requested · method · L214-L216 — def test_no_csv_is_written_when_none_is_requested(self) -> None
- MassCalculatorCliTests · class · L219-L262 — class MassCalculatorCliTests(TemporaryDirectoryTestCase)
- test_the_reference_peptide_masses_are_reported · method · L222-L237 — def test_the_reference_peptide_masses_are_reported(self) -> None
- test_a_formula_reports_the_neutral_and_the_protonated_mass · method · L239-L246 — def test_a_formula_reports_the_neutral_and_the_protonated_mass(self) -> None
- test_negative_mode_subtracts_the_proton_instead_of_adding_it · method · L248-L257 — def test_negative_mode_subtracts_the_proton_instead_of_adding_it(self) -> None: # [M-H]- for glucose is 179.05611; reporting 181.07 would be a sign bug # that silently invalidates every negative-mode search.
- test_neither_a_peptide_nor_a_formula_is_a_usage_error · method · L259-L262 — def test_neither_a_peptide_nor_a_formula_is_a_usage_error(self) -> None
- DigestionTests · class · L265-L339 — class DigestionTests(TemporaryDirectoryTestCase)
- peptides · method · L268-L280 — def peptides(self, sequence: str, **overrides) -> list[str]
- test_trypsin_cleaves_after_lysine_and_arginine · method · L282-L283 — def test_trypsin_cleaves_after_lysine_and_arginine(self) -> None
- test_trypsin_does_not_cleave_before_proline · method · L285-L288 — def test_trypsin_does_not_cleave_before_proline(self) -> None: # The Keil rule: K/R followed by P is not a cleavage site. Getting this # wrong inflates the search space and invents peptides that never exist.
- test_allowing_a_missed_cleavage_adds_the_joined_peptide · method · L290-L294 — def test_allowing_a_missed_cleavage_adds_the_joined_peptide(self) -> None
- test_lysc_ignores_the_arginine_site_trypsin_uses · method · L296-L299 — def test_lysc_ignores_the_arginine_site_trypsin_uses(self) -> None: # Proves the --enzyme argument reaches the digester rather than being # accepted and dropped.
- test_the_length_window_excludes_at_both_ends · method · L301-L305 — def test_the_length_window_excludes_at_both_ends(self) -> None: # Both peptides are 7 residues long.
- test_a_fasta_entry_keeps_its_accession_and_sequence · method · L307-L317 — def test_a_fasta_entry_keeps_its_accession_and_sequence(self) -> None
- test_the_peptide_table_reports_published_masses · method · L319-L339 — def test_the_peptide_table_reports_published_masses(self) -> None: # DFPIANGER ends in R, so trypsin returns the whole sequence and the row # can be checked against the documented monoisotopic mass and m/z.
- TheoreticalSpectrumTests · class · L342-L378 — class TheoreticalSpectrumTests(TemporaryDirectoryTestCase)
- test_the_y_ion_series_of_the_reference_peptide · method · L343-L361 — def test_the_y_ion_series_of_the_reference_peptide(self) -> None
- test_the_default_series_omits_b1_as_openms_does · method · L363-L368 — def test_the_default_series_omits_b1_as_openms_does(self) -> None: # b+y for a 9-mer would be 16 peaks if b1 were generated; OpenMS leaves # it out because b1 ions are not observed, giving 15.
- test_restricting_the_series_reduces_the_peak_count · method · L370-L378 — def test_restricting_the_series_reduces_the_peak_count(self) -> None
- FilterExperimentTests · class · L381-L438 — class FilterExperimentTests(ExampleExperimentMixin, unittest.TestCase)
- test_an_ms_level_filter_keeps_only_that_level · method · L384-L388 — def test_an_ms_level_filter_keeps_only_that_level(self) -> None
- test_an_unused_ms_level_yields_an_empty_experiment · method · L390-L392 — def test_an_unused_ms_level_yields_an_empty_experiment(self) -> None
- test_the_retention_time_window_includes_its_endpoints · method · L394-L402 — def test_the_retention_time_window_includes_its_endpoints(self) -> None
- test_an_intensity_threshold_prunes_peaks_and_keeps_the_scan · method · L404-L412 — def test_an_intensity_threshold_prunes_peaks_and_keeps_the_scan(self) -> None: # Emptied scans are retained on purpose: dropping them would renumber # every spectrum index downstream.
- test_the_threshold_is_inclusive · method · L414-L416 — def test_the_threshold_is_inclusive(self) -> None
- test_filtering_does_not_mutate_the_experiment_it_reads · method · L418-L423 — def test_filtering_does_not_mutate_the_experiment_it_reads(self) -> None: # The source is often written back out under a different name; pruning # its peaks in place would corrupt an unrelated output.
- test_chromatograms_survive_only_when_no_ms_level_is_selected · method · L425-L438 — def test_chromatograms_survive_only_when_no_ms_level_is_selected(self) -> None
- StoreExperimentTests · class · L441-L463 — class StoreExperimentTests(ExampleExperimentMixin, TemporaryDirectoryTestCase)
- test_an_unknown_extension_names_the_supported_ones · method · L442-L444 — def test_an_unknown_extension_names_the_supported_ones(self) -> None
- test_an_mzml_round_trip_preserves_every_scan · method · L446-L453 — def test_an_mzml_round_trip_preserves_every_scan(self) -> None
- test_the_extension_test_is_case_insensitive · method · L455-L458 — def test_the_extension_test_is_case_insensitive(self) -> None
- test_mgf_is_accepted_as_an_output_format · method · L460-L463 — def test_mgf_is_accepted_as_an_output_format(self) -> None
- CollectMs1Tests · class · L466-L488 — class CollectMs1Tests(ExampleExperimentMixin, unittest.TestCase)
- test_only_ms1_scans_contribute_a_chromatogram_point · method · L467-L474 — def test_only_ms1_scans_contribute_a_chromatogram_point(self) -> None: # A TIC that included MS2 scans would show spurious dips and spikes.
- test_the_three_returned_lists_stay_index_aligned · method · L476-L483 — def test_the_three_returned_lists_stay_index_aligned(self) -> None
- test_an_ms2_only_experiment_yields_nothing · method · L485-L488 — def test_an_ms2_only_experiment_yields_nothing(self) -> None
- SpectrumTableTests · class · L491-L535 — class SpectrumTableTests(ExampleExperimentMixin, TemporaryDirectoryTestCase)
- rows · method · L494-L498 — def rows(self, experiment) -> list[dict[str, str]]
- test_every_scan_is_summarised_once_in_order · method · L500-L504 — def test_every_scan_is_summarised_once_in_order(self) -> None
- test_the_tic_is_the_sum_of_the_scan_intensities · method · L506-L509 — def test_the_tic_is_the_sum_of_the_scan_intensities(self) -> None
- test_the_base_peak_is_the_most_intense_peak_not_the_first · method · L511-L516 — def test_the_base_peak_is_the_most_intense_peak_not_the_first(self) -> None
- test_precursor_columns_are_filled_only_for_msn_scans · method · L518-L521 — def test_precursor_columns_are_filled_only_for_msn_scans(self) -> None
- test_an_empty_scan_reports_zero_rather_than_failing · method · L523-L529 — def test_an_empty_scan_reports_zero_rather_than_failing(self) -> None
- test_the_experiment_summary_reads_a_stored_file · method · L531-L535 — def test_the_experiment_summary_reads_a_stored_file(self) -> None
- PlotTests · class · L538-L594 — class PlotTests(ExampleExperimentMixin, TemporaryDirectoryTestCase)
- setUp · method · L539-L543 — def setUp(self) -> None
- args · method · L545-L548 — def args(self, **overrides) -> argparse.Namespace
- test_every_advertised_plot_kind_has_a_function · method · L550-L556 — def test_every_advertised_plot_kind_has_a_function(self) -> None: #
--kind uses choices=list(PLOTS), and main() dispatches through the # same dict, so the two cannot drift; what matters is that the kinds # documented in the module docstring are all present.
- test_a_spectrum_is_selected_by_index · method · L558-L561 — def test_a_spectrum_is_selected_by_index(self) -> None
- test_a_requested_retention_time_selects_the_nearest_scan · method · L563-L569 — def test_a_requested_retention_time_selects_the_nearest_scan(self) -> None: # 21 s is nearest the 20 s scan; picking the first scan instead would # silently plot the wrong spectrum.
- test_a_retention_time_beyond_the_run_clamps_to_the_last_scan · method · L571-L573 — def test_a_retention_time_beyond_the_run_clamps_to_the_last_scan(self) -> None
- test_the_tic_plot_sums_ms1_scans_only · method · L575-L579 — def test_the_tic_plot_sums_ms1_scans_only(self) -> None
- test_the_signal_map_plots_one_point_per_ms1_peak · method · L581-L585 — def test_the_signal_map_plots_one_point_per_ms1_peak(self) -> None
- test_a_plot_can_be_saved_through_the_cli · method · L587-L594 — def test_a_plot_can_be_saved_through_the_cli(self) -> None
- AdductDefaultTests · class · L597-L658 — class AdductDefaultTests(unittest.TestCase)
- entries · method · L601-L602 — def entries(table: str) -> list[list[str]]
- test_every_entry_has_elements_a_charge_and_a_probability · method · L604-L614 — def test_every_entry_has_elements_a_charge_and_a_probability(self) -> None
- test_every_element_string_parses_as_an_empirical_formula · method · L616-L622 — def test_every_element_string_parses_as_an_empirical_formula(self) -> None: # A typo here surfaces only as an OpenMS parameter error deep inside # MetaboliteFeatureDeconvolution.
- test_the_charge_signs_match_the_ionisation_mode · method · L624-L632 — def test_the_charge_signs_match_the_ionisation_mode(self) -> None: # An H-1 (deprotonation) adduct offered in positive mode, or Na+ in # negative mode, would explain mass differences that cannot occur.
- test_protonation_is_the_most_likely_form_in_each_mode · method · L634-L645 — def test_protonation_is_the_most_likely_form_in_each_mode(self) -> None
- test_the_water_loss_adduct_has_the_mass_of_a_lost_water · method · L647-L652 — def test_the_water_loss_adduct_has_the_mass_of_a_lost_water(self) -> None: #
H-2O-1 is the OpenMS spelling of a neutral water loss; if it parsed # as an addition the sign of the mass shift would flip.
- test_the_negative_defaults_include_a_chloride_adduct · method · L654-L658 — def test_the_negative_defaults_include_a_chloride_adduct(self) -> None
- AlignAndLinkTests · class · L661-L725 — class AlignAndLinkTests(TemporaryDirectoryTestCase)
- test_the_reference_map_is_the_one_with_the_most_features · method · L664-L672 — def test_the_reference_map_is_the_one_with_the_most_features(self) -> None: # Aligning to the sparsest map throws away the retention-time anchors # the pose-clustering algorithm needs.
- test_co_eluting_features_are_linked_across_samples · method · L674-L682 — def test_co_eluting_features_are_linked_across_samples(self) -> None
- test_features_outside_the_retention_time_tolerance_stay_separate · method · L684-L691 — def test_features_outside_the_retention_time_tolerance_stay_separate(self) -> None
- test_the_column_headers_record_each_sample_and_its_size · method · L693-L705 — def test_the_column_headers_record_each_sample_and_its_size(self) -> None: # The headers become the column names of the quantification matrix, so # a missing filename produces an unusable table.
- test_the_metabolomics_detector_is_shared_rather_than_reimplemented · method · L707-L714 — def test_the_metabolomics_detector_is_shared_rather_than_reimplemented(self) -> None: # align_link_quantify imports detect_features under a bare #
except Exception, which would silently fall back to "featureXML # inputs only" if the import ever broke.
- test_a_featurexml_input_is_loaded_rather_than_re_detected · method · L716-L725 — def test_a_featurexml_input_is_loaded_rather_than_re_detected(self) -> None
- ConsensusMatrixTests · class · L728-L819 — class ConsensusMatrixTests(TemporaryDirectoryTestCase)
- setUp · method · L731-L739 — def setUp(self) -> None
- test_the_wide_matrix_has_one_row_per_feature_and_one_column_per_sample · method · L741-L759 — def test_the_wide_matrix_has_one_row_per_feature_and_one_column_per_sample(self) -> None
- test_the_long_table_has_one_row_per_feature_and_sample · method · L761-L774 — def test_the_long_table_has_one_row_per_feature_and_sample(self) -> None
- test_a_missing_input_file_exits_rather_than_writing_an_empty_matrix · method · L776-L783 — def test_a_missing_input_file_exits_rather_than_writing_an_empty_matrix(self) -> None
- sample_medians · method · L785-L791 — def sample_medians(self, path: Path) -> dict[str, float]
- test_median_normalization_equalises_the_per_sample_medians · method · L793-L819 — def test_median_normalization_equalises_the_per_sample_medians(self) -> None: # Sample two was built 10% hotter than sample one -- medians 1600 and # 1500 -- which is exactly the loading difference median scaling exists # to remove. Comparing medians rather than a single cell keeps the # assertion independent of the order the linker emits features in.