← Về thư mục
tests/gget/test_scripts.py
- WorkingDirectoryTestCase · class · L53-L93 — class WorkingDirectoryTestCase(unittest.TestCase)
- setUp · method · L56-L77 — def setUp(self) -> None
- stub · method · L79-L88 — def stub(self, name: str, **kwargs)
- quietly · method · L90-L93 — def quietly(self, function, args, *kwargs)
- blast_frame · function · L96-L100 — def blast_frame(description: str = "hypothetical protein") -> pd.DataFrame
- FastaReadingTests · class · L103-L141 — class FastaReadingTests(unittest.TestCase)
- setUp · method · L104-L107 — def setUp(self) -> None
- read · method · L109-L112 — def read(self, text: str)
- test_wrapped_sequence_lines_are_joined · method · L114-L118 — def test_wrapped_sequence_lines_are_joined(self) -> None: # FASTA wraps at 60-80 columns; keeping the newlines would corrupt # every downstream BLAST query.
- test_the_final_record_is_not_dropped · method · L120-L125 — def test_the_final_record_is_not_dropped(self) -> None: # The loop flushes on the next '>', so the last record needs the # explicit flush after the file ends.
- test_the_identifier_excludes_the_angle_bracket · method · L127-L129 — def test_the_identifier_excludes_the_angle_bracket(self) -> None
- test_an_empty_file_yields_no_records · method · L131-L132 — def test_an_empty_file_yields_no_records(self) -> None
- test_a_header_with_no_sequence_is_still_a_record · method · L134-L138 — def test_a_header_with_no_sequence_is_still_a_record(self) -> None: # Dropping it would silently renumber every later sequence.
- test_a_missing_trailing_newline_is_tolerated · method · L140-L141 — def test_a_missing_trailing_newline_is_tolerated(self) -> None
- BatchSequenceAnalysisTests · class · L144-L250 — class BatchSequenceAnalysisTests(WorkingDirectoryTestCase)
- fasta · method · L145-L150 — def fasta(self, records: int = 2) -> Path
- test_each_sequence_is_blasted_once_with_the_documented_parameters · method · L152-L169 — def test_each_sequence_is_blasted_once_with_the_documented_parameters(self) -> None
- test_one_csv_is_written_per_sequence_named_after_it · method · L171-L179 — def test_one_csv_is_written_per_sequence_named_after_it(self) -> None
- test_a_failed_blast_does_not_abort_the_remaining_sequences · method · L181-L192 — def test_a_failed_blast_does_not_abort_the_remaining_sequences(self) -> None: # A batch run that dies on sequence 1 of 50 is useless.
- test_alignment_asks_gget_to_write_the_file · method · L194-L204 — def test_alignment_asks_gget_to_write_the_file(self) -> None: # gget.muscle returns None, so the alignment must be requested via #
out=; writing the return value would raise TypeError.
- test_a_single_sequence_is_not_aligned · method · L206-L213 — def test_a_single_sequence_is_not_aligned(self) -> None: # An alignment of one sequence is meaningless and wastes a request.
- test_alignment_can_be_switched_off · method · L215-L224 — def test_alignment_can_be_switched_off(self) -> None
- test_structure_prediction_stays_a_no_op_even_when_requested · method · L226-L238 — def test_structure_prediction_stays_a_no_op_even_when_requested(self) -> None: # The AlphaFold call is commented out on purpose (it needs
gget setup # alphafold and hours of compute); the flag must not silently start it.
- test_an_empty_fasta_file_runs_no_queries · method · L240-L250 — def test_an_empty_fasta_file_runs_no_queries(self) -> None
- GeneListReadingTests · class · L253-L279 — class GeneListReadingTests(unittest.TestCase)
- setUp · method · L254-L257 — def setUp(self) -> None
- write · method · L259-L262 — def write(self, name: str, text: str) -> Path
- test_a_plain_list_drops_blank_lines_and_whitespace · method · L264-L266 — def test_a_plain_list_drops_blank_lines_and_whitespace(self) -> None
- test_a_csv_takes_the_first_column_and_skips_the_header · method · L268-L271 — def test_a_csv_takes_the_first_column_and_skips_the_header(self) -> None: # The header row must not become a gene symbol.
- test_a_csv_read_as_text_would_keep_the_commas · method · L273-L276 — def test_a_csv_read_as_text_would_keep_the_commas(self) -> None: # Guards the suffix check: the same content named .txt is not a CSV.
- test_an_empty_list_file_yields_no_genes · method · L278-L279 — def test_an_empty_list_file_yields_no_genes(self) -> None
- enrichr_frame · function · L282-L289 — def enrichr_frame(term: str = "p53 signaling pathway") -> pd.DataFrame
- archs4_frame · function · L292-L300 — def archs4_frame() -> pd.DataFrame
- EnrichmentPipelineTests · class · L303-L404 — class EnrichmentPipelineTests(WorkingDirectoryTestCase): #: The five Enrichr categories the script sweeps, in order.
- test_every_documented_database_is_queried_once_in_order · method · L307-L314 — def test_every_documented_database_is_queried_once_in_order(self) -> None
- test_species_background_and_plotting_are_forwarded · method · L316-L331 — def test_species_background_and_plotting_are_forwarded(self) -> None
- test_one_csv_per_database_plus_a_summary_is_written · method · L333-L343 — def test_one_csv_per_database_plus_a_summary_is_written(self) -> None
- test_a_database_with_no_hits_is_left_out_of_the_summary · method · L345-L356 — def test_a_database_with_no_hits_is_left_out_of_the_summary(self) -> None: # Reporting an empty category as a result would overstate the analysis.
- test_a_failing_database_does_not_stop_the_sweep · method · L358-L373 — def test_a_failing_database_does_not_stop_the_sweep(self) -> None
- test_expression_lookups_are_capped_at_five_genes · method · L375-L386 — def test_expression_lookups_are_capped_at_five_genes(self) -> None: # One ARCHS4 request per gene would make a 2,000-gene list unusable.
- test_the_top_tissue_is_the_one_with_the_highest_median · method · L388-L395 — def test_the_top_tissue_is_the_one_with_the_highest_median(self) -> None
- test_an_expression_failure_leaves_the_enrichment_results_intact · method · L397-L404 — def test_an_expression_failure_leaves_the_enrichment_results_intact(self) -> None
- search_frame · function · L407-L417 — def search_frame(ensembl_id: str = "ENSG00000141510") -> pd.DataFrame
- info_frame · function · L420-L423 — def info_frame() -> pd.DataFrame
- correlation_frame · function · L426-L429 — def correlation_frame() -> pd.DataFrame
- diseases_frame · function · L432-L435 — def diseases_frame() -> pd.DataFrame
- GeneAnalysisTests · class · L438-L551 — class GeneAnalysisTests(WorkingDirectoryTestCase)
- stub_everything · method · L439-L450 — def stub_everything(self) -> dict
- test_the_search_is_scoped_to_the_species_and_a_single_hit · method · L452-L461 — def test_the_search_is_scoped_to_the_species_and_a_single_hit(self) -> None
- test_a_gene_that_does_not_exist_stops_before_any_other_request · method · L463-L472 — def test_a_gene_that_does_not_exist_stops_before_any_other_request(self) -> None: # Without the early return the Ensembl ID lookup would index an empty # frame and raise instead of reporting "not found".
- test_the_ensembl_identifier_from_the_search_drives_every_lookup · method · L474-L480 — def test_the_ensembl_identifier_from_the_search_drives_every_lookup(self) -> None
- test_both_sequence_forms_are_requested · method · L482-L489 — def test_both_sequence_forms_are_requested(self) -> None
- test_the_fasta_files_hold_the_lines_gget_returned · method · L491-L497 — def test_the_fasta_files_hold_the_lines_gget_returned(self) -> None: # gget.seq returns a list of FASTA lines; writing the list itself # raises TypeError, so the join is what makes the file valid.
- test_an_already_joined_string_is_written_unchanged · method · L499-L505 — def test_an_already_joined_string_is_written_unchanged(self) -> None: # Older gget releases returned one string; both shapes must work.
- test_the_output_prefix_defaults_to_the_lowercased_gene · method · L507-L510 — def test_the_output_prefix_defaults_to_the_lowercased_gene(self) -> None
- test_an_explicit_prefix_is_used_verbatim · method · L512-L515 — def test_an_explicit_prefix_is_used_verbatim(self) -> None
- test_expression_and_correlation_are_separate_archs4_queries · method · L517-L523 — def test_expression_and_correlation_are_separate_archs4_queries(self) -> None
- test_both_opentargets_resources_are_requested_with_a_limit · method · L525-L533 — def test_both_opentargets_resources_are_requested_with_a_limit(self) -> None
- test_an_empty_drug_table_is_not_written · method · L535-L539 — def test_an_empty_drug_table_is_not_written(self) -> None
- test_optional_lookups_may_fail_without_failing_the_run · method · L541-L551 — def test_optional_lookups_may_fail_without_failing_the_run(self) -> None: # Steps 4-7 are wrapped in warnings on purpose: the sequences and # annotations already retrieved are worth keeping.