Description Usage Arguments Details Author(s) See Also
These functions aid plotting a-la xmapbridge but in a format that is more publication friendly
1 2 3 4 5 6 7 8 9 10 11 12 | # Utility Methods
convertBamToRle( bam.file.name, chr, start, end, chr.name.mapping=function( name ){ name } )
generateBridgeData( xrange, bamFiles, colours=NULL, names=NULL )
ngsTraceScale( vector.of.xbams.and.ybams )
ngsTraceLabel( rle.data )
ngsTracePlotter( rle.data, start, end, ylim, trace.label.properties=list(), smoothing.function=function( rle, ... ) { IRanges::runmean( rle, k=1001, endrule='constant' ) },
trace.clip='inherit', trace.draw.scale=FALSE, trace.bor='transparent', trace.pad=c(0,0), ... )
# Plotting Methods
ngsBridgePlot( xrange, data=list(), main=NULL, sub=NULL, highlights=NULL, trace.plotter=ngsTracePlotter, genome.layout.weight=4,
trace.scale=ngsTraceScale, trace.draw.scale=NULL, trace.match.strand=TRUE, probe.plot=NULL, exon.depth.plot=genomicExonDepthPlot,
.genes=NULL, .exons=NULL, ... )
|
bam.file.name |
The name of the BAM file to read in |
chr |
The chromosome of interest. |
start |
The start of the region of interest |
end |
The end of the region of interest |
chr.name.mapping |
The function to convert between the Annmap chr name to the chr name in the BAM file. By default, this just uses chr supplied as the parameter, however it can be set to any function you like. One example of this is |
xrange |
The genomic range for the x-axis. Should be a GRanges object. |
bamFiles |
A vector containing the filenames of your BAM files. |
colours |
A vector of colours for each file (sensible defaults will be chosen if NULL). |
names |
A vector of names to show on the traces drawn by |
vector.of.xbams.and.ybams |
The |
rle.data |
A list containing fields |
ylim |
A vector of min and max values for this plot (usually retrieved from |
trace.label.properties |
Properties to be sent to the |
smoothing.function |
A function that generates a smoothed RLE object. |
trace.clip |
Is the trace clipped to it's bounding box? One of |
trace.draw.scale |
If |
trace.bor |
The colour for a box that is drawn round this trace.plot. |
trace.pad |
A 2 element vector consisting of the number of 'lines' of padding to allow at the top and bottom of the plot respecively |
data |
A list containing an element per trace. Each element of this list is, in turn, passed to the |
main |
The main title for the plot. |
sub |
A sub-title for the plot. |
highlights |
Highlight regions for the plot. See |
trace.plotter |
The function to call to draw the traces (see |
genome.layout.weight |
The weight for the genomic plot in the layout of this grid |
trace.scale |
Either a function to calculate the global max for the NGS traces (see |
trace.match.strand |
If |
probe.plot |
The function to plot the probes (see |
exon.depth.plot |
The function to draw the exon depth (see |
.genes |
Optionally pass a list of genes to limit the plot to. |
.exons |
An optional list of exons to limit the plot to. |
... |
Parameters passed on to functions called by this function |
convertBamToRle
will take a BAM file name, and a region of interest and return a list()
containing two elements, '+'
and '-'
. Each element will be an Rle
object, one for each strand.
The data
parameter to ngsBridgePlot
is a list of elements as defined in the rle.data
parameter, one element per NGS trace, ie:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | library(grid)
library(annmap)
# Connect to datasource with annmapConnect()
# Ensure we have a clean plot
grid.newpage()
bamFiles = c( 'data1.bam', 'data2.bam', 'data3.bam' )
colours = rainbow( 3, v=0.5, s=0.5 )
data = lapply( seq_along( bamFiles ), function( idx ) {
list( rle=convertBamToRle( bamFiles[ idx ], 'I', 40000, 100000 ),
col=colours[ idx ],
name=paste( 'Trace', bamFiles[ idx ] ) )
} )
ngsBridgePlot( RangedData( space='I', ranges=IRanges( 40000, 100000 ) ), data=data, main='Example Plot' )
|
Tim Yates
genomicProbePlot
, genomicPlot
, genomicExonDepthPlot
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.