Skip to content

get_introns() ​

Add the introns between the exons of each transcript.

Exons and UTRs that overlap, nest or touch are one covered region; each gap of at least one base between covered regions becomes an intron. An intron row has the values of the columns that are the same for all exons and UTRs of its transcript (e.g. its gene or group), and is missing the others (e.g. the name of an exon). Exons whose start is after their end (reverse strand) are read as their span, and keep their positions in the result.

Usage ​

python
from geneviewer import get_introns

get_introns(data)

Arguments ​

ArgumentTypeDescription
datapandas.DataFrameExons and UTRs, with start and end. Optional columns: type (rows whose type contains exon or utr, in any case, are used; default "exon") and transcript (default "transcript1").

Value ​

pandas.DataFrame: The rows of data and the introns (type "intron"), by transcript in the order they first appear, then by start. start and end are floats, as R's numbers.

Errors ​

ErrorWhen
ValueErrorWithout start or end.

Examples ​

python
>>> exons = pd.DataFrame({"transcript": "tx1", "type": "exon",
...                       "start": [100, 400, 900], "end": [250, 600, 1100]})
>>> get_introns(exons)[["start", "end", "type"]]
    start     end    type
0   100.0   250.0    exon
1   251.0   399.0  intron
2   400.0   600.0    exon
3   601.0   899.0  intron
4   900.0  1100.0    exon