plotBins {ASpli} | R Documentation |
Creates a plot with gene counts, bin counts, PSI/PIR value, inclusion and exclusion junctions for selected bins and conditions.
plotBins( counts, as, bin, factorsAndValues, targets, main = NULL, colors = c( '#2F7955', '#79552F', '#465579', '#A04935', '#752020', '#A07C35') , panelTitleColors = '#000000', panelTitleCex = 1, innerMargins = c( 2.1, 3.1, 1.1, 1.1 ), outerMargins = c( 0, 0, 2.4, 0 ), useBarplots = NULL, barWidth = 0.9, barSpacer = 0.4, las.x = 2, useHCColors = FALSE, legendAtSide = TRUE, outfolder = NULL, outfileType = c( 'png', 'bmp', 'jpeg', 'tiff', 'pdf')[1], deviceOpt = NULL )
counts |
An object of class |
as |
An object of class |
bin |
A character vector with the names of the bins to be plotted. |
factorsAndValues |
A list containing the factor and the values for each
factor to be plotted. The order of the factors will modify how the
conditions are grouped in the plot. |
targets |
A data frame containing sample, bam files and experimental factor columns |
main |
Main title of the plot. If |
colors |
A vector of character colors for lines and bar plots. |
panelTitleColors |
A vector of character colors for the titles of each plot panel. |
panelTitleCex |
Character size expansion for panel titles. |
innerMargins |
A numerical vector of the form c(bottom, left, top, right) which gives the size of each plot panel margins. Defaults to c( 2.1, 3.1, 1.1, 1.1 ) |
outerMargins |
A numerical vector of the form c(bottom, left, top, right) which gives the size of margins. Defaults to c( 0, 0, 2.4, 0 ) |
useBarplots |
A logical value that indicates the type of plot to be
used. If |
barWidth |
The width of the bars in bar plots. |
barSpacer |
Fraction of |
las.x |
Text orientation of x-axis labels. |
useHCColors |
A logical value. If |
are not used, instead panel title are automatically chosen to have high
contrast against colors
.
legendAtSide |
A logical value that forces panel title to be shown on the y-axis, instead of over the plot. |
outfolder |
Path to output folder to write plot images. Is |
outfileType |
File format of the output files used if |
deviceOpt |
A list of named options to be passed to the graphic device
selected in |
Returns a png for each selected bin
Estefania Mancini, Andres Rabinovich, Javier Iserte, Marcelo Yanovsky, Ariel Chernomoretz
# Create a transcript DB from gff/gtf annotation file. # Warnings in this examples can be ignored. #library(GenomicFeatures) #genomeTxDb <- makeTxDbFromGFF( system.file('extdata','genes.mini.gtf', # package="ASpli") ) # Create an ASpliFeatures object from TxDb #features <- binGenome( genomeTxDb ) # Define bam files, sample names and experimental factors for targets. #bamFileNames <- c( "A_C_0.bam", "A_C_1.bam", "A_C_2.bam", # "A_D_0.bam", "A_D_1.bam", "A_D_2.bam", # "B_C_0.bam", "B_C_1.bam", "B_C_2.bam", # "B_D_0.bam", "B_D_1.bam", "B_D_2.bam" ) #targets <- data.frame( # row.names = paste0('Sample_',c(1:12)), # bam = system.file( 'extdata', bamFileNames, package="ASpli" ), # factor1 = c( 'A','A','A','A','A','A','B','B','B','B','B','B'), # factor2 = c( 'C','C','C','D','D','D','C','C','C','D','D','D') ) # Load reads from bam files #bams <- loadBAM( targets ) # Read counts from bam files #counts <- readCounts( features, bams, targets, cores = 1, readLength = 100, # maxISize = 50000 ) # Calculate differential usage of genes, bins and junctions #du <- DUreport.norm( counts, targets , contrast = c(1,-1,-1,1)) # Calculate PSI / PIR for bins and junction. #as <- AsDiscover( counts, targets, features, bams, readLength = 100, # threshold = 5, cores = 1 ) # Plot bin data. Factor2 is the main factor for graphic representation in # this example as it is the first in factorsAndValues argument. # This makes a bar plot comparing four conditions, grouped by factor1. #plotBins( counts, as, 'GENE03:E002', # factorsAndValues = list( # factor2 = c('C','D'), # factor1 = c('A','B') ), # las.x = 1, # legendAtSide = TRUE, # useHCColors = TRUE, # targets = targets, # barWidth = 0.95, # innerMargins = c( 2.1, 4.1, 1.1, 1.1 ) ) # Redefine targets #targets <- data.frame( # row.names = paste0('Sample_',c(1:12)), # bam = system.file( 'extdata', bamFileNames, package="ASpli" ), # factor1 = c( 'A','A','B','B','C','C','D','D','E','E','F','F') ) #as <- AsDiscover( counts, targets, features, bams, readLength = 100, # threshold = 5, cores = 1 ) # This makes a line plot for six conditions, grouped by factor1. #plotBins( counts, as, 'GENE03:E002', # factorsAndValues = list( # factor1 = c('A','B','C','D','E','F') ), # las.x = 1, # legendAtSide = FALSE, # targets = targets, # innerMargins = c( 2.1, 4.1, 1.1, 1.1 ) )