-
Notifications
You must be signed in to change notification settings - Fork 3
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
Consider more advanced views into the alignments in Template #207
Comments
One mockup for a new class: @dataclass(frozen=True)
class Template(Iterable):
r1: AlignedSegment | None = None
r2: AlignedSegment | None = None
r1_auxiliaries: list[AlignedSegment] = field(default_factory=list)
r2_auxiliaries: list[AlignedSegment] = field(default_factory=list)
def primaries(self) -> Iterator[AlignedSegment]:
yield from ([] if self.r1 is None else [self.r1])
yield from ([] if self.r2 is None else [self.r2])
def r1_supplementals(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r1() if rec.is_supplementary and not rec.is_secondary)
def r2_supplementals(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r2() if rec.is_supplementary and not rec.is_secondasry)
def r1_secondaries(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r1() if rec.is_secondary and not rec.is_supplementary)
def r2_secondaries(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r2() if rec.is_secondary and not rec.is_supplementary)
def r1_secondary_supplementals(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r1() if rec.is_secondary and rec.is_supplementary)
def r2_secondary_supplementals(self) -> Iterator[AlignedSegment]:
yield from (rec for rec in self.all_r2() if rec.is_secondary and rec.is_supplementary)
def r1_primary_and_supplementals(self) -> Iterator[AlignedSegment]:
yield from ([] if self.r1 is None else [self.r1])
yield from self.r1_supplementals()
def r2_primary_and_supplementals(self) -> Iterator[AlignedSegment]:
yield from ([] if self.r2 is None else [self.r2])
yield from self.r2_supplementals()
def r1_secondary_and_supplementals(self) -> Iterator[AlignedSegment]:
yield from self.r1_secondaries()
yield from self.r1_secondary_supplementals()
def r2_secondary_and_supplementals(self) -> Iterator[AlignedSegment]:
yield from self.r2_secondaries()
yield from self.r2_secondary_supplementals()
def all_r1(self) -> Iterator[AlignedSegment]:
yield from ([] if self.r1 is None else [self.r1])
yield from self.r1_auxiliaries
def all_r2(self) -> Iterator[AlignedSegment]:
yield from ([] if self.r2 is None else [self.r2])
yield from self.r2_auxiliaries
def __iter__(self) -> Iterator[AlignedSegment]:
yield from self.all_r1()
yield from self.all_r2() If the namespace is too cluttered we could shim a template.r1
template.r2
template.r1_auxiliaries
template.r2_auxiliaries
template.view.all_r1()
template.view.all_r2()
template.view.r1_secondaries()
template.view.r2_secondaries()
... Additionally, I think we should make |
After fixing an issue in
Template
where records were added twice to different internal fields in this PR:We might want to consider more specific "views" into the different categories of alignments for multi-mapping chimeric use cases.
Some ideas for useful ways to view the alignments for either the R1 or R2 ordinal:
The text was updated successfully, but these errors were encountered: