Skip to content

feat: add transcript.length#213

Open
ovesh wants to merge 1 commit intomainfrom
add-transcript-length-to-all-transcript-objects-tinf-078
Open

feat: add transcript.length#213
ovesh wants to merge 1 commit intomainfrom
add-transcript-length-to-all-transcript-objects-tinf-078

Conversation

@ovesh
Copy link
Copy Markdown
Contributor

@ovesh ovesh commented Apr 20, 2026

No description provided.


@property
def length(self) -> int:
"""The total length of this transcript, summing all exon lengths (includes UTRs)."""
Copy link
Copy Markdown
Collaborator

@s22chan s22chan Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

introns are part of a transcript... are we conflating this with transcriptome mrna?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gkaur can you comment on this?

The original request:

Currently, transcript length is calculated by iterating over the exons, computing the difference between each exon’s start and end positions, and summing those values. It would be much easier if this was recalculated and stored for each transcript.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was hoping to capture post processed transcript length based on exons and cdss components only

return sum(len(exon) for exon in self.exons)

@property
def length_cds(self) -> int:
Copy link
Copy Markdown
Collaborator

@s22chan s22chan Apr 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel like the naming will be confusing in code.

eg.
len(trans.cdss)
vs
trans.length_cds

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a reasonable concern. I'm coming up empty trying to think of a clearer alternative.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about .exonic_length and .coding_length?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me!

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.

3 participants