-
Notifications
You must be signed in to change notification settings - Fork 13
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
Conversation
This file contains 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
…rts of ReadCreator
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.
This is a rewrite of significant portions with several goals:
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).
Allow filtering of fragment counts, not just reads (we often end up finding two supporting reads are the same fragment in IGV)
Add new filtering options, such as ratio of alt to "other" (non-ref/non-alt) reads.
Don't use the
pysam
pileup engine and instead accesspysam.AlignedSegment
objects directly viapysam.AlignmentFile.fetch
. This is both faster and eliminates some delicate error-prone logic.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).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 commandisovar
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.Reduce the extreme repetition of parameter lists by aggregating parameters onto objects such as
ReadCollector
andProteinSequenceCreator
.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 asvariant_sequence
/VariantSequenceCreator
/variant_sequence_helpers
,allele_read
/ReadCollector
/allele_ read_helpers
. In the latter case the creator is calledReadCollector
since it creates bothAlleleRead
andLocusRead
objects, which rely on some intertwined logic.Fixes:
This PR does not:
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: addphased_with_somatic_variants
,phased_with_germline_variants
toIsovarResult
and fill these fields at the end ofrun_isovar
.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.