← Về thư mục
tests/pydeseq2/test_scripts.py
- TemporaryDirectoryTestCase · class · L51-L60 — class TemporaryDirectoryTestCase(unittest.TestCase)
- setUp · method · L52-L55 — def setUp(self) -> None
- write_csv · method · L57-L60 — def write_csv(self, name: str, frame: pd.DataFrame) -> Path
- LoadAndValidateTests · class · L63-L155 — class LoadAndValidateTests(TemporaryDirectoryTestCase)
- setUp · method · L66-L79 — def setUp(self) -> None
- test_the_counts_matrix_is_transposed_by_default · method · L81-L89 — def test_the_counts_matrix_is_transposed_by_default(self) -> None
- test_an_already_oriented_matrix_is_left_alone · method · L91-L97 — def test_an_already_oriented_matrix_is_left_alone(self) -> None
- test_negative_counts_are_rejected · method · L99-L107 — def test_negative_counts_are_rejected(self) -> None: # DESeq2's negative-binomial model has no meaning for negative counts; # they indicate the file holds normalised or logged values.
- test_zero_counts_are_accepted · method · L109-L116 — def test_zero_counts_are_accepted(self) -> None: # Zero is a legitimate observation -- only negatives are invalid.
- test_extra_metadata_samples_are_dropped_to_the_intersection · method · L118-L129 — def test_extra_metadata_samples_are_dropped_to_the_intersection(self) -> None: # Unequal lengths: element-wise index comparison raises here, so this # is the case the intersection fallback exists for.
- test_extra_count_samples_are_dropped_to_the_intersection · method · L131-L138 — def test_extra_count_samples_are_dropped_to_the_intersection(self) -> None
- test_a_reordered_metadata_index_is_realigned_not_left_shuffled · method · L140-L148 — def test_a_reordered_metadata_index_is_realigned_not_left_shuffled(self) -> None: # Same samples, different order. If the two frames were handed to # DESeq2 as-is, every sample would carry another sample's condition.
- test_a_matching_pair_survives_untouched · method · L150-L155 — def test_a_matching_pair_survives_untouched(self) -> None
- FilterDataTests · class · L158-L205 — class FilterDataTests(unittest.TestCase)
- setUp · method · L159-L168 — def setUp(self) -> None: # Column totals: KEEP 30, EDGE 10, DROP 9.
- test_genes_below_the_total_count_threshold_are_removed · method · L170-L172 — def test_genes_below_the_total_count_threshold_are_removed(self) -> None
- test_the_threshold_is_inclusive_at_the_boundary · method · L174-L179 — def test_the_threshold_is_inclusive_at_the_boundary(self) -> None: # EDGE totals exactly 10;
>= keeps it and > would not.
- test_a_zero_threshold_keeps_every_gene · method · L181-L183 — def test_a_zero_threshold_keeps_every_gene(self) -> None
- test_samples_with_no_condition_are_dropped_from_both_frames · method · L185-L192 — def test_samples_with_no_condition_are_dropped_from_both_frames(self) -> None
- test_no_samples_are_dropped_when_the_column_is_absent · method · L194-L199 — def test_no_samples_are_dropped_when_the_column_is_absent(self) -> None
- test_gene_filtering_does_not_disturb_the_sample_axis · method · L201-L205 — def test_gene_filtering_does_not_disturb_the_sample_axis(self) -> None
- ShrinkageCoefficientTests · class · L208-L240 — class ShrinkageCoefficientTests(unittest.TestCase)
- FakeDataSet · class · L211-L213 — class FakeDataSet
- init · method · L212-L213 — def init(self, columns: list[str]) -> None
- test_the_coefficient_name_follows_the_design_matrix · method · L215-L220 — def test_the_coefficient_name_follows_the_design_matrix(self) -> None
- test_an_absent_coefficient_raises_and_names_the_alternatives · method · L222-L231 — def test_an_absent_coefficient_raises_and_names_the_alternatives(self) -> None: # Reference level as the test level is the classic mistake; the error # has to show what the design actually offers.
- test_a_multi_factor_design_resolves_the_requested_variable_only · method · L233-L240 — def test_a_multi_factor_design_resolves_the_requested_variable_only(self) -> None
- FakeStats · class · L243-L247 — class FakeStats
- init · method · L246-L247 — def init(self, results: pd.DataFrame) -> None
- FakeDataSet · class · L250-L259 — class FakeDataSet
- init · method · L253-L256 — def init(self, samples: int = 2, genes: int = 3) -> None
- to_picklable_anndata · method · L258-L259 — def to_picklable_anndata(self)
- results_frame · function · L262-L273 — def results_frame() -> pd.DataFrame
- SaveResultsTests · class · L276-L329 — class SaveResultsTests(TemporaryDirectoryTestCase)
- setUp · method · L277-L281 — def setUp(self) -> None
- test_the_four_documented_artefacts_are_written · method · L283-L293 — def test_the_four_documented_artefacts_are_written(self) -> None
- test_every_gene_is_kept_in_the_full_table · method · L295-L297 — def test_every_gene_is_kept_in_the_full_table(self) -> None
- test_only_genes_strictly_below_the_fdr_cutoff_are_significant · method · L299-L302 — def test_only_genes_strictly_below_the_fdr_cutoff_are_significant(self) -> None
- test_the_sorted_table_puts_the_strongest_evidence_first · method · L304-L310 — def test_the_sorted_table_puts_the_strongest_evidence_first(self) -> None
- test_the_dataset_is_exported_as_readable_h5ad_not_a_pickle · method · L312-L315 — def test_the_dataset_is_exported_as_readable_h5ad_not_a_pickle(self) -> None: # Pickles execute arbitrary code on load; h5ad does not.
- test_a_missing_output_directory_is_created · method · L317-L320 — def test_a_missing_output_directory_is_created(self) -> None
- test_no_significant_genes_still_writes_every_file · method · L322-L329 — def test_no_significant_genes_still_writes_every_file(self) -> None: # An empty result set is a valid outcome, not an error.
- PlotTests · class · L332-L359 — class PlotTests(TemporaryDirectoryTestCase)
- setUp · method · L333-L336 — def setUp(self) -> None
- test_both_plots_are_written_as_non_empty_files · method · L338-L344 — def test_both_plots_are_written_as_non_empty_files(self) -> None
- test_plotting_does_not_mutate_the_results_table · method · L346-L351 — def test_plotting_does_not_mutate_the_results_table(self) -> None: # The volcano plot adds a -log10 column; leaking it into results_df # would put a derived column into every file written afterwards.
- test_genes_filtered_out_by_deseq2_do_not_break_the_plots · method · L353-L359 — def test_genes_filtered_out_by_deseq2_do_not_break_the_plots(self) -> None: # padj is NaN for independent-filtered genes; -log10(NaN) would be NaN # and matplotlib would silently drop the point, so the script fills 1.
- EndToEndFitTests · class · L362-L406 — class EndToEndFitTests(unittest.TestCase)
- setUpClass · method · L366-L385 — def setUpClass(cls) -> None
- test_the_inferred_coefficient_matches_the_real_design_matrix · method · L387-L393 — def test_the_inferred_coefficient_matches_the_real_design_matrix(self) -> None: # The whole point of infer_shrink_coeff: the composed name must exist # in the matrix PyDESeq2 built, not merely look plausible.
- test_the_planted_eight_fold_change_is_recovered · method · L395-L399 — def test_the_planted_eight_fold_change_is_recovered(self) -> None: # log2(8) == 3. Shrinkage pulls the estimate in slightly, so allow # half a log2 unit -- but the sign and magnitude must be right.
- test_the_planted_gene_is_the_only_significant_one · method · L401-L403 — def test_the_planted_gene_is_the_only_significant_one(self) -> None
- test_every_tested_gene_gets_a_row · method · L405-L406 — def test_every_tested_gene_gets_a_row(self) -> None