Skip to content

Input validation: crashes and misleading errors in check-input and infer-roothogs #118

Open

Description

@alpae

Problem

Several inputs make fastoma-check-input or fastoma-infer-roothogs crash or stop with an error that does not point at the cause. Grouped here because the fixes are small and independent.

Input folders

  • Hidden files are taken as proteomes or hogmaps: ._AQUAE.fa (AppleDouble files that macOS tar/zip add to archives) or .DS_Store. check-input then stops with "These species are not in the species tree: ._AQUAE" (check_input.py:39,91, _utils_roothog.py:165-170). This broke the archive-input nf-test on Linux CI.
  • A file without an extension (e.g. README) in the proteome folder crashes parse_proteomes (file.rsplit, _utils_roothog.py:166); check-input only warns about it.
  • Dots are dropped from species names derived from hogmap file names ("".join(i.split(".")[:-2]), check_input.py:91), so Homo.sapiens.fa.hogmap never matches the proteome Homo.sapiens.fa.
  • An empty proteome raises ZeroDivisionError (check_input.py:65) instead of being reported as invalid.

Species tree

  • Duplicate internal node names are never reported: the name list is reset inside the loop (check_input.py:100).
  • A tree without internal nodes raises UnboundLocalError (check_input.py:106).
  • An internal node name made only of special characters becomes empty (check_input.py:168).
  • An internal node named like a leaf makes ete3's prune fail with "Ambiguous node name" (check_input.py:180). Such names would also clash later, because per-level pickle files are named after nodes.
  • read_species_tree calls sys.exit() (exit status 0) when the tree can't be read (_utils_subhog.py:78,81), so Nextflow sees the task as successful.

Splice files

  • A species whose splice file has a single line is ignored (len(isoforms) > 1, check_input.py:195).

Tests (strict xfail on PR #112)

  • tests/test_check_input.py::TestCheckProteomeFiles::test_hidden_files_ignored
  • tests/test_check_input.py::TestCheckHogmapFiles::test_hidden_files_ignored
  • tests/test_roothog_io.py::TestParseProteomes::test_hidden_files_ignored
  • tests/test_roothog_io.py::TestParseProteomes::test_non_fasta_files_ignored
  • tests/test_check_input.py::TestCheckHogmapFiles::test_dotted_species_name
  • tests/test_check_input.py::TestCheckProteome::test_empty_proteome_rejected
  • tests/test_check_input.py::TestSpeciesTreeChecks::test_internalnode_duplicates_reported
  • tests/test_check_input.py::TestSpeciesTreeChecks::test_internalnode_single_leaf
  • tests/test_check_input.py::TestAddInternalNodePrune::test_special_char_only_name
  • tests/test_check_input.py::TestAddInternalNodePrune::test_internal_node_named_like_leaf
  • tests/test_check_input.py::TestCheckSplice::test_single_gene_with_isoforms
  • (no test yet for the sys.exit() exit status)

Proposed fix

One shared helper that lists input files (skip names starting with ., accept known extensions only) used by check-input and infer-roothogs, so both agree on what a proteome is; then fix the remaining cases individually. Bare except: around tree parsing should become specific exceptions with a non-zero exit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions