Repository navigation
Fix expressed known isoforms missing from discovered transcripts and trust read ends with --fl_data - #443
Fix expressed known isoforms missing from discovered transcripts and trust read ends with --fl_data#443andrewprzh wants to merge 12 commits into
Conversation
Review follow-up: 9682e09 and 1a27fddA code review of caae97c found three problems. 9682e09 fixes all of them.
Smaller items: type hints for the new code, and a log note when Local validation, caae97c → 1a27fdd (gffcompare recall/precision, %)
CPU time on the FL test: about +5% in a run on a quiet machine. That is within the baseline, which is unchanged. CI
|
|
CI on 1a27fdd:
|
|
5c9fc3b re-baselines the accuracy metrics that moved out of tolerance in the CI runs on 1a27fdd. The updated tests are SIRVs real R10/R9/opts1, SIRVs simulated R10 (all three configs), Human and Mouse ONT polyA, and Mouse ONT R9/R9 trunc/R10/no_gtf and Mouse PB simulations. The per-test changes are in the description.
🤖 Generated with Claude Code |
…l polyA against assigned isoforms
…other reads splice into
…ne in similar isoform detection
…tated or well-supported intron entering the exon
…d document the --fl_data read end handling
…d and trusted 5' ends threaded past a supported intron
…end and known isoform fixes
…he known isoform and similar isoform detection fixes
…read profiles are built
8f159fa to
cd4f6d2
Compare
Problem
A PacBio FLNC run (
-d pacbio_ccs --fl_data, poly-A tails trimmed) lost about 18% of the annotated transcripts with at least 100 reads fromtranscript_models.gtf, including whole genes. There were three causes:fl_pacbiopreset (pacbio_ccs+--fl_data) setfl_only. That turned off building known isoforms from read assignments, the only rescue for known isoforms without a full-length path.Changes
IntronGraph.collapse_vertex_setnever merges two annotated introns. A graph path maps to every known isoform that threads to it._reference_isoform_for_pathchooses among them using read assignments.fl_onlyis removed, soconstruct_nonfl_isoformsruns for every preset.--fl_data, a read 3' end without a detected tail is treated as a poly-A site and checked against the assigned isoforms. Explicit--polya_trimmedmodes take precedence.--fl_data, a read 5' end at a predicted TSS is kept even inside an exon that other reads splice into.detect_similar_isoforms, a weaker near-identical novel model no longer removes a better-supported one.--fl_data, 5' ends are trusted except near the acceptor of an annotated or well-supported intron entering the exon, where reads with an unaligned short first exon start (IntronGraph.is_trusted_five_prime).Mouse.PB_simulated.FL.reduced_db(1.2M FLNC-like PacBio reads simulated with badread: full length, oriented, no tails;-d pacbio --fl_data, reduced annotation). Also addsmisc/simulate_fl_reads_badread.py, docs and the changelog entry.--fl_data, every--polya_trimmedmode, external tails without a side) now makes the assigner classify the read again, as for a tail found in the read sequence (LongReadAssigner.reassign_with_polya_site). Isoforms the site contradicts are dropped when others agree with it. The read is matched again (match_inconsistent) when the site contradicts all of them or the read was inconsistent. The steps that depend on the assignment run again: the inconsistent-MAPQ filter, exon correction and the antisense check. cd4f6d2 replaces this reclassification.IntronGraph.five_prime_vertex_limit). As inis_trusted_five_prime, only annotated or well-supported introns count; rare novel introns are alignment noise.--fl_dataor--polya_trimmed.--fl_dataand poly-A site text indocs/cmd.md.--fl_dataor--polya_trimmedgoes in before the read profiles are built, exactly as a tail found in the sequence. This replaces the reclassification after assignment from d1bfac4.ReadStrandPredictor(alignment/read_strand.py) tries these signals in order:--stranded forward/reverseas the last resort.The predicted strand only places the site.
read_assignment.strandstill comes from the assignment. When the strand is undecided or the assignment gives the other one,move_polya_sitemoves the site andassign_againrebuilds the profiles and assigns the read once more. This happens for 1.8% of FL reads and 0.9% of genic reads on one ONT chromosome.--polya_trimmed alluses the mapped strand and never assigns twice.LongReadAssigner.reassign_with_polya_siteand its helpers are removed.A
tag:read without aTStag now gets its strand from the predictor. Before, the side came straight from--stranded, which overrode a tail found in the sequence.Cost, measured with per-read timers on the FL dataset (1.2M genic reads):
Re-baselines the FL test's quantification sections. See the Results section.
Results
New FL test, same options on both sides (gffcompare recall/precision, %):
Against the d1bfac4 baselines, cd4f6d2 keeps every accuracy metric of SIRVs.Set4.R10.opts2, Mouse ONT TSS and Human ONT TSS within tolerance. These configs also use
--fl_data. On the FL test, transcript metrics are within tolerance: full recall 93.1→93.2, novel recall 67.3→67.5. Quantification improved enough to leave the tolerance and was re-baselined. For known isoforms, good/fair matches went 41/155→43/158 and missed (overlap) 572→540. For novel isoforms, missed (full) went 2223→2193. For genes, false reports went 23→22. The set of known transcripts missing from the FL run is unchanged: 48 transcripts in the same categories.Re-baselined in 7a86112 (recall/precision, %):
Re-baselined in 770e0c4, from the CI runs on 7a86112. Only sections with a metric outside the 1% tolerance were rewritten. None of these tests uses
--fl_dataor--polya_trimmed, so the drift comes from b18714a, f44b264 and a4b2a33. Transcript metrics are recall/precision, %; td50 and td10 move the same way unless listed.The one extra false novel in SIRVs Set4 real R10 and opts1 is a two-exon fragment of SIRV708. It comes from internal priming at an A-rich exon junction, with a 206-read tail peak. On master it was removed only because a 3-read model that contains it exactly came first in storage order. With a4b2a33 that model's 6-read sibling absorbs it first, so it no longer removes the fragment. This depends on the artificial SIRV708 design and is accepted.
Performance baselines are unchanged. Mouse ONT R10 reduced_db (CPU 33119 s vs 20479 s baseline) and Mouse PB reduced_db (CPU 7209 s vs 5039 s) still exceed CPU and wall time, but master's own runs show the same: 32750 s for Mouse ONT R10 today and 7506 s for Mouse PB on 10-30. RSS is within tolerance.
Known limitation, left for separate work: a read whose short last exon is soft-clipped ends at the preceding donor and gets an injected tail there with
--fl_data. A position-based guard for this was tested and rejected because it cost novel recall.Testing
test_known_isoform_collisions.py,test_nonfl_known_isoforms.pyandtest_read_strand.py, with additions totest_external_polya.py,test_intron_graph_refine.pyandtest_intron_path_threading.py. The poly-A site tests check that a read marked before assignment, or assigned again after its site moved, gets the same assignment as when its tail is found in the sequence.masterdfb2a40. The commit SHAs above are the rebased ones. The CI runs below ran on the same commits before the rebase. The full unit test suite passes after the rebase: 2002 passed, 4 skipped.run_pipeline.pywas run locally on the four configs that use--fl_data(Mouse.PB_simulated.FL.reduced_db, SIRVs.Set4.R10.opts2, Mouse.ONT_simulated.TSS, Human.ONT_simulated.TSS), with the results above. The FL run's CPU and wall time went over the baseline while the machine load was about 40. Performance baselines are unchanged. No CI runs have been dispatched for this commit yet.--fl_data.Mouse.PB_simulated.FL.reduced_dbworkflow can't be dispatched until it is onmaster. Its config was run locally withrun_pipeline.pyon the code of 7a86112, and all accuracy checks passed. CPU and wall time were within the baseline in an earlier run with the same results; the last run exceeded them while other heavy jobs shared the machine. The workflow file differs fromMouse.PB_simulated.reduced_db.ymlonly in its name, cron day and run name.🤖 Generated with Claude Code