trackc.pl.gene_track#
- trackc.pl.gene_track(ax: Axes | None = None, bed12: DataFrame | str | None = None, regions: Sequence[str] | str | None = None, track_type: str | None = 'gene', show_label: bool | Sequence[str] | str = True, pos_strand_gene_color: str | None = '#3366CC', neg_strand_gene_color: str | None = '#EECFA1', line: int | None = 1, gene_fontsize: int | None = 7, label: str | None = None, label_rotation: int | None = 0, label_fontsize: int | None = 12, ax_on: bool = False)[source]#
Plot gene track, support for multiple or reverse genome regions.
- Parameters:
ax (
matplotlib.axes.Axesobject) –bed12 (pd.DataFrame | str) – gene annotation bed12 format DataFrame or filepath Bed12 files can be converted from GTF using trackc gtf2bed. https://trackc.readthedocs.io/en/latest/analysis_guide/genebed12/bed12.html
regions (str | str list) – genome regions, format: chrom:start-end. e.g.
['chr18:47950000-48280000', 'chr18:75280000-74850000']or"chr18:45000000-78077248". If the start is bigger than end, the genome region will be reversedtrack_type (str) – you can select one of the options: gene or dendity gene: gene track style dendity: gene density style. Under development
show_label (bool | str | str list) – If the value is False, the gene name will not show If want show one gene, and hide others, just set the gene or gene list as the value, eg: PIBF1 | [‘PIBF1’, ‘KLF5’]
pos_strand_gene_color (str) – positive strand gene name color
neg_strand_gene_color (str) – negative strand gene name color
line (int) – rows occupied by the genes in the region plotted
gene_fontsize (int) – gene label fontsize
label (str) – the title of the track, will show on the left
label_rotation (int) – the label text rotation
label_fontsize (int) – the label text fontsize
ax_on (bool) – If True, top, left and right spines will show
- Return type:
None
Example
>>> import trackc as tc >>> regions = ['chr18:47950000-48280000', 'chr18:75280000-74850000'] >>> gene_bed12 = '/path/GRCh38.84.bed12'
>>> fig, axs = tc.make_spec(figsize=(7,2), height_ratios=[1]) >>> tc.pl.gene_track(gene_bed12, ax=axs[0], regions=regions, line=12) >>> tc.savefig('trackc_gene_track.pdf')