Develop#265
Merged
Merged
Conversation
…T into feature/karen_bacterial_wrapper
Markov integration
Bug fixing
test_error_models.py (21 tests): - TraditionalQualityModel: default construction, quality score range, error rate dict, uniform mode init and score bounds, get_quality_scores for uniform/non-uniform/exact-length/shorter-than-model cases, ndarray return, reproducibility - SequencingErrorModel: default construction, variant prob sum, custom error rate, zero-error returns empty list, high-error produces ErrorContainers with valid locations and alt bases, padding returned - ErrorContainer: field storage for SNV, Deletion, Insertion types test_single_runner.py (37 tests, 3 classes): - TestInitializeAllModels: returns 4-tuple of correct types, rng attached, mutation_rate override, fragment_mean path, default mean=read_len*2 - TestWriteBlockVcf: single SNV written, ref/alt/qual correct, empty input produces no output, multiple SNVs in sorted order, 10 VCF columns - TestReadSimulatorSingle: return tuple structure, thread_idx/contig_name passthrough, ContigVariants return, all file_dict keys present, FASTQ file created and valid, content has FASTQ records, seed reproducibility, vcf=None when produce_vcf=False Note: quality_score_model.py is a standalone Markov analysis script with hardcoded BAM paths — not a library module and not tested here. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- test_error_models.py: 4 new indel error tests (deletion, insertion, blacklist deduplication); fix monkeypatch approach for numpy Generator - test_single_runner.py: 2 new tests covering produce_bam=True path (lines 127-152) and bam=None when not requested - test_runner.py: 8 new integration tests covering discard_bed, mutation_bed, ploidy=1, ploidy=4, min_mutations, and produce_bam=True; also input VCF, target_bed, and mutation_rate override - tests/test_variants/: new test_variant_types.py (73 tests for all comparison operators, __repr__, contains(), get_alt()) and test_contig_variants.py (24 tests documenting known bugs in remove_variant and check_if_ins) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
generate_variants.py:
- N in mutation region (lines 139-157 avoidance logic)
- N-heavy subsequence skip (line 204)
- Trinucleotide with N triggers disallowed_chars path (lines 246-249)
- High-rate deletion overlap handling (lines 291-302)
error_models.py:
- MarkovQualityModel stub coverage (lines 112-118)
- Score clamped to min 1 and max 42 via extreme qual_score_probs (lines 102-104)
- Documents unreachable indel branches (lines 209-235, 252) caused by
the total_indel_length > read_length//4 circular gate; includes
TODO comment with proposed assertions for after the bug fix
vcf_func.py:
- Three WP-genotype tests document that the WP condition is always False
(string "WP" never equals a list); each includes a TODO comment with
exact updated assertions to apply once the condition is corrected to
any(x.split('=')[0] == "WP" for x in ...)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Duplicates removed: - test_error_and_mut_models.py: test_sequencing_error_model_zero_error_returns_none_or_empty (covered by test_error_models.py::test_sem_zero_error_rate_returns_empty) - test_error_and_mut_models.py: test_traditional_quality_model_reproducible_with_seed (covered by test_error_models.py::test_tqm_get_quality_scores_reproducible) - test_seq_error.py: test_no_errors_when_avg_zero (same as above) - test_models/test_stitch_outputs.py: test_concat_joins_files_in_order (covered by test_read_simulator/test_stitch_outputs.py) Vacuous assertions fixed: - test_error_models.py: rename indel dead-code tests and assert == 0 (not >= 0) - test_output_file_writer.py: replace `assert True` with bam_handle.tell() > pos_before - test_output_file_writer.py: strengthen test_reg2bin_same_16kb_bin to check determinism - test_runner.py: test_filter_bed_regions_returns_list now checks content - test_single_runner.py: test_returns_four_element_tuple now checks element types - test_vcf_func.py: test_variant_genotype_returns_correct_ploidy_length checks values - test_generate_variants.py: test_generate_variants_variant_types_are_valid checks attributes - test_contig_variants.py: test_remove_variant_method_exists adds TODO comment for post-fix update Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- generate_reads.py lines 234-236: paired-end discard check for read2 (test_generate_reads_paired_discard_region_removes_all) - generate_reads.py: paired no-discard regression guard (test_generate_reads_paired_no_discard_produces_read_pairs) - single_runner.py line 85: "Record too small" debug log path, with generate_reads/generate_variants patched to avoid infinite loop (test_record_too_small_logs_and_continues) - bed_func.py line 209: mutation rate > 0.3 warning log (test_parse_single_bed_mutation_high_rate_logs_warning) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2. Change version to 4.3.6 in pyproject.toml 3. Fixed channel order in environment.ylm which cause crash due to not satisfied requirements of bcftools
Feature/claude assisted tests
Collaborator
|
I have tested all of the changes listed in these commits. Notably I have not found further coverage bugs across several tests. I believe the code is ready to merge into (I believe the discrepancy I found earlier could have come from a Git-related artifact.) |
Feature/karen bacterial wrapper
Markov integration
Solving VCF-related issues.
…ut requested The no-files guard in OutputFileWriter.__init__ was raising ValueError whenever file_handles was empty, but in BAM-only mode the top-level OFW intentionally has no open file handle (pysam manages the merged BAM directly). Guard now exempts the case where a BAM output path is set. Adds unit tests for BAM-only and VCF-only OFW construction, and integration tests for all three produce_fastq=false output combinations through the full runner, which would have caught this regression. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Fix OutputFileWriter crash when produce_fastq=false and only BAM outp…
Collaborator
Author
|
still seeing duplicated variants at the same position. The fix corrected exact duplicates, but we're still seeing same position variants, which shouldn't happen except maybe rarely, in large datasets. |
Removed excess details and streamlined the introduction to focus on key features and improvements in NEAT 4.4.
test_qual_score_models.py: - Fix two tests that used -1 as a quality score key in position_distributions (invalid data that bypassed real validation); replace with valid scores - Add 11 new tests covering the previously untested Markov chain path: transition chain is exercised, fallback to marginal for unknown q_prev, wrong transition_distributions length raises, out-of-range score clamping, length=0/1 edge cases, read-length interpolation via _position_index_for_length test_error_models.py: - Remove two stub tests that imported from error_models.MarkovQualityModel (a dead TODO class never called at runtime); they passed unconditionally and gave false confidence about the real model test_markov_utils.py (new): - 36 tests covering all previously untested functions in markov_utils.py: _down_bin_quality (6), compute_initial_distribution (4), compute_position_distributions (4), compute_transition_distributions (5), read_quality_lists (6), build_markov_model (3) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Updating version in README.md.
Add Markov quality model test coverage and fix invalid test data
keshav-gandhi
approved these changes
May 3, 2026
Collaborator
keshav-gandhi
left a comment
There was a problem hiding this comment.
Tests make sense and look great!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.