Package 'transPlotR'

Title: Visualize Transcript Structures in Elegant Way
Description: To visualize the gene structure with multiple isoforms better, I developed this package to draw different transcript structures easily.
Authors: Jun Zhang [aut, cre]
Maintainer: Jun Zhang <[email protected]>
License: MIT + file LICENSE
Version: 0.0.5
Built: 2025-01-27 04:41:43 UTC
Source: https://github.com/junjunlab/transplotr

Help Index


bedVis

Description

visualize peaks(bed files).

Arguments

bdFile

the bed file path, default(NULL).

chr

the chromesome of peak, default(NULL).

region.min

the peak start coordinate, default(NULL).

region.max

the peak end coordinate, default(NULL).

track.width

track width, default(0.1).

collapse

whether collapse the track, default(FALSE).

fill

track fill colors, default(NULL).

show.legend

whether show fill color legend, default(TRUE).

add.label

whether add peak name, default(FALSE).

label.column

the peak name column name, default(NULL).

label.vjsut

the peak label vjust, default(0.1).

Value

a ggplot object.

Author(s)

JunZhang


calcuRotatedCoord

Description

calculate the rotated rectangle coordinate with specified degree.

Arguments

data

data.frame

theta

rotate degree, default(45).

workers

how many workers for parallel calculation, default(1).

rx

x variable name, default(NULL).

ry

y variable name, default(NULL).

Value

a data.frame

Author(s)

JunZhang


This is a test data for this package test data describtion

Description

This is a test data for this package test data describtion

Usage

gtf

Format

An object of class data.frame with 1987 rows and 31 columns.

Author(s)

Junjun Lao


linkVis

Description

visualize the coordinate relation like chromtin accessbility or peak sites correlation.

Usage

linkVis(
  linkData = NULL,
  start = NULL,
  end = NULL,
  group = NULL,
  base_size = 14,
  link.aescolor = NULL,
  link.color = NULL,
  line.size = 0.5,
  curvature = 0.5,
  yshift = 0.1,
  legend.title = "",
  facet = TRUE,
  facet.placement = "outside",
  facet.fill = "grey90",
  facet.color = "black",
  facet.text.angle = 90,
  facet.text.size = 14,
  xAixs.info = TRUE
)

Arguments

linkData

the link data with data.frame format, default(NULL).

start

link start position, default(NULL).

end

link end position, default(NULL).

group

facet group variable name, default(NULL).

base_size

theme base_size, default(14).

link.aescolor

link line color or mapping variable name, default(NULL).

link.color

colors to change the link line colors when "link.aescolor" is a mapping variable, default(NULL).

line.size

link line size, default(0.5).

curvature

the link line curvature, default(0.5).

yshift

the space upper the link line, default(0.1).

legend.title

the legend title, default("").

facet

whether show the plot with facet plot, default(TRUE).

facet.placement

the facet label placement, default("outside").

facet.fill

facet rectangle fill color, default("grey90").

facet.color

facet rectangle border color, default("black").

facet.text.angle

facet text angle, default(90).

facet.text.size

facet text size, default(14).

xAixs.info

whether remove X axis info, default(FASLE).

Value

a ggplot object.

Author(s)

JunZhang


loadBigWig

Description

read bigwig files.

Usage

loadBigWig(bwFile = NULL)

Arguments

bwFile

the path of bigwig files, default(NULL). bigwig files should end with ".bw" or ".bigwig" and directory should not be named "bw" or"bigwig".

Value

a data.frame

Author(s)

JunZhang


trackVis

Description

visualize bigwig files.

Arguments

bWData

the data.frame bigwig data, default(NULL).

gtf.file

whether supply gtf annotation file, default(NULL).

gene.name

the gene name to be choosed for visualization, default(NULL).

chr

chr the chromesome of peak, default(NULL).

region.min

the start coordinate, default(NULL).

region.max

the end coordinate, default(NULL).

show.legend

whether show color legend, default(FALSE).

legend.position

the legend position, default("right").

color

the track color, default(NULL).

extend.up

extend for upstream of start site, default(3000).

extend.dn

extend for downstream of start site, default(3000).

base_size

theme base size, default(14).

label.angle

the facet label angle, default(0).

label.face

the facet label face, default("bold").

space.y

the facet panel space, default(0.5).

sample.order

the sample order to be plotted in graph, default(NULL).

sampleName.dist

the facet label distance from Y axis, default(0.4).

sampleName.hjust

the facet label hjust, default(1).

sampleName.vjust

the facet label vjust, default(0.5).

xAxis.info

whether retain X axis info, default(TRUE).

yAxis.info

whether retain Y axis info, default(TRUE).

ticks.y.len

the y axis ticks length, default(0.3).

theme

plot theme, "bw" or "classic", default("classic").

scales

the facet scales settings, default("fixed").

ncol

the columns to be arranged, default(1).

mark.region

whether highlight regions in plot, default(FALSE).

mark.col

the colors of marked regions, default(NULL).

mark.alpha

the color alpha of marked regions, default(0.5).

new.yaxis

whether add new style Y axis, default(FALSE).

pos.ratio

the new style Y axis relative position, default(c(0.01,0.8)).

yinfo.text.size

the new style Y axis text size, default(5).

back.color

whether add panel background color, default(FALSE).

back.color.alpha

panel background color alpha, default(0.15).

y.max

the ylim, default(NULL).

new.label

whether add label in plot, default(FALSE).

label.color

the label color, default(NULL).

pos.label.ratio

the new label relative position, default(c(0.99,0.8)).

label.text.size

the new label text size, default(5).

label.hjust

the new label text hjust, default(1).

yinfo.hjust

the new style Y axis text hjust, default(0).

facetGroup

the annotation for samples, default(NULL).

annoLine.size

the annotation line size, default(1).

line.arrow

the annotation line arrow, default(NULL).

Value

a ggplot object.

Author(s)

JunZhang


trancriptVis

Description

This package is to visualize gene diffrent isoforms.

Arguments

gtfFile

GTF file.

gene

Target gene to plot.

myTranscript

Specify which transcripts to plot use transcipt id.

Chr

Chromosome number.

posStart

Region start position on genome.

posEnd

Region end position on genome.

collapse

Whether to collapse multiple transcripts into one, default(FALSE).

exonWidth

Exon width to plot, default(0.3).

relTextDist

Transcripts name or gene name relative to exon, default(0.3).

intronSize

Intron line size, default(0.5).

arrowBreak

How many gap distance to draw arrows, the smaller the more arrows, default(0.15).

exonColorBy

Whether color group by "transcript_id" or "gene_name", default(NULL).

exonFill

Exon fill color, default('#333399').

circle

Whether make plot into a circle plot, default(FALSE).

cicStart

Circle plot start position, default(pi).

circSegCol

Circle sgement color, default('#333399').

text_only

When circle plot labeled by gene name, whether remove the line connected with gene name, default(FALSE).

ylimLow

The Y axis lower limitation of Circle plot, default(-10).

openAngle

The gap of the circle plot, default(0.5).

arrowCol

Normal arrow color, default('#333399').

arrowAngle

Normal arrow angle, default(30).

arrowLength

Normal arrow length, default(0.1).

arrowType

Normal arrow type, default('open').

addNormalArrow

Whether add normal arrow on plot, default(TRUE).

newStyleArrow

Whether add new style arrow on plot, default(FALSE).

absSpecArrowLen

Whether make new style arrow length to be relative to each transcript length or absolute length to the longest transcript, default(FALSE).

speArrowRelPos

The relative position to the transcript on horizontal direction of new style arrow, default(0).

speArrowRelLen

The relative length to the transcript length of new style arrow, default(0.05).

speArrowStart

The new style arrow start position on the vertical direction, default(-0.15).

speArrowRelHigh

The relative height of new style arrow to the vertical length, default(2).

speArrowLineSize

The new style arrow line size, default(0.5).

speArrowCol

The new style arrow line color, default('black').

speArrowAngle

The new style arrow angle, default(30).

speArrowLen

The new style arrow length, default(0.1).

speArrowType

The new style arrow type, default('closed').

textLabel

The text label aesthetic mappings, default('transcript_id').

textLabelSize

The text label size, default(5).

textLabelColor

The text label color, default('black').

base_size

Theme basesize, default(14).

marginX

Plot left and right margins, default(0.2).

marginY

Plot top and bottomn margins, default(0.2).

aspect.ratio

Plot ratio, default(NULL).

facetByGene

Whether facet by gene to plot, this useful for your genes which are far away from each other or not located on the same chromosome, default(FALSE).

ncolGene

The column numbers to plot, default(NULL).

scales

Facet plot scales, same as "facet_wrap" function, default('free').

strip.position

Facet plot strip.position, same as "facet_wrap" function, default('top').

forcePosRel

Whether force the genome coordinate to relative position to transcript start/end position, default('FALSE').

panel.spacing

Facet plot panel space, default(0.3).

revNegStrand

Whether reverse the negtive strand when set "forcePosRel=TRUE", default('FALSE').

xAxis.info

Whether retain X axis ticks and text, default(TRUE).

reverse.y

whether reverse the Y axis, default(FALSE).

text.pos

the label position(left/right), default(middle).

selecType

choose the representative transcript to show("lt(longest transcript)" or "lcds(longest CDS)"), default(NULL).

topN

the top number representative transcript to be shown, default(1).

show.legend

whether show color legend, default(FALSE).

Value

A ggplot object.

Author(s)

JunZhang

Examples

##############################################################
# test function

########################################################
# load data
data(gtf)

# non-coding gene
trancriptVis(gtfFile = gtf,
             gene = 'Xist')

# coding gene
trancriptVis(gtfFile = gtf,
             gene = 'Nanog')

# change fill color
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             exonFill = '#CCFF00')

# change inrton line size
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             intronSize = 1)

# change label size,color and position
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             textLabelSize = 4,
             textLabelColor = 'red',
             relTextDist = 0)

# aes by gene name
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             textLabel = 'gene_name')

# color aes by transcript
trancriptVis(gtfFile = gtf,
             gene = 'Tpx2',
             exonColorBy = 'transcript_id')

# change arrow color and type
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             arrowCol = 'orange',
             arrowType = 'closed')

# no intron gene and add arrow color
# change arrow color and type
trancriptVis(gtfFile = gtf,
             gene = 'Jun',
             textLabel = 'gene_name',
             arrowCol = 'white',
             arrowType = 'closed') +
  theme_void()

# add arrow breaks
trancriptVis(gtfFile = gtf,
             gene = 'Nanog',
             arrowCol = 'orange',
             arrowType = 'closed',
             arrowBreak = 0.1)

# draw specific transcript
p1 <- trancriptVis(gtfFile = gtf,
                   gene = 'Commd7')

p2 <- trancriptVis(gtfFile = gtf,
                   gene = 'Commd7',
                   myTranscript = c('ENSMUST00000071852','ENSMUST00000109782'))

# combine
cowplot::plot_grid(p1,p2,ncol = 2,align = 'hv')