Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major rewrite to enable use of newer pysam, fix several bugs, and add filtering options #104

Merged
merged 105 commits into from
Jun 12, 2019

Conversation

iskandr
Copy link
Contributor

@iskandr iskandr commented Feb 22, 2019

This is a rewrite of significant portions with several goals:

  1. Allow late filtering of variants (even those without assembled protein sequences) after all other computations. This allows us to preserve all information computed within Isovar, better explain why some variants are included or excluded, and use Isovar for diverse analyses (rather than just supplying the minimal amount of information used by Vaxrank).

  2. Allow filtering of fragment counts, not just reads (we often end up finding two supporting reads are the same fragment in IGV)

  3. Add new filtering options, such as ratio of alt to "other" (non-ref/non-alt) reads.

  4. Don't use the pysam pileup engine and instead access pysam.AlignedSegment objects directly via pysam.AlignmentFile.fetch. This is both faster and eliminates some delicate error-prone logic.

  5. Introduce a single IsovarResult type which contains all the information that a user could conceivably want (e.g. different read counts, fractions, best protein sequence, comparison with Varcode predicted sequence).

  6. The current CLI situation is messy since many different steps of Isovar have their own commands the most useful (isovar-protein-sequences) omits potentially useful information for which you have to run other commands. This PR introduce a single command isovar which generates and saves a large DataFrame from a list of IsovarResult objects that hopefully contain all (or most) of the information a user might want. The other commands might still be useful for diagnostics (e.g. looking at protein sequences which weren't the best supported for a variant) but the CLI entry-point for Isovar will hopefully be more obvious and complete.

  7. Reduce the extreme repetition of parameter lists by aggregating parameters onto objects such as ReadCollector and ProteinSequenceCreator.

  8. Make the organization and location of code slightly more predictable by splitting data objects (e.g. ProteinSequence) from how they are created (ProteinSequenceCreator) and related helper functions (protein_sequence_helpers). This pattern is used across several other modules, such as variant_sequence/VariantSequenceCreator/variant_sequence_helpers, allele_read/ReadCollector/allele_ read_helpers. In the latter case the creator is called ReadCollector since it creates both AlleleRead and LocusRead objects, which rely on some intertwined logic.

Fixes:

This PR does not:

  1. make phasing explicit: Make phasing of multiple variants on a read explicit (group reads into phase groups) #72, though it should now be easier, just look at intersection of read names supporting protein sequences of two IsovarResult objects. Future plan: add phased_with_somatic_variants, phased_with_germline_variants to IsovarResult and fill these fields at the end of run_isovar.

  2. fix existing issues with reading missing for variants on edge of exon boundary: (Isovar undercounting supporting reference reads #55, reads_at_locus incorrect when variant occurs in the first or last nucleotide of an exon #14) but due to simplified logic in ReadCreator these should now be much easier to fix.

@coveralls
Copy link

coveralls commented May 16, 2019

Coverage Status

Coverage increased (+1.7%) to 92.872% when pulling fbc01de on more-rna-filtering-options into b39b684 on master.

@iskandr iskandr merged commit e6a870e into master Jun 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants