plotprocessing: Process the results of the functions 'metaplot' and...

View source: R/supps.R

plotprocessingR Documentation

Process the results of the functions metaplot and mmetaplot

Description

Process the metagene results from metaplot and mmetaplot and remove the extremely large FPM outliers in the original metagene plots.

Usage

plotprocessing(
  fwdlist,
  revlist,
  groupnames,
  lineposes,
  labels,
  title,
  cutoff = 0.01,
  titlesize = 17,
  textsize = 16
)

Arguments

fwdlist

A list containing the metagene FPM values from the function metaplot or mmetaplot's result list. Each element in it is an FPM value vector contained in the original result list, and its slot name there is "TSSfwdFPMmeans", "TTSfwdFPMmeans", "GeneBodyfwdFPMmeans", or "combinefwdFPMmeans". It is the FPM value vector for the metagene's sense strand and should match the corresponding list element transferred to another parameter revlist, which is the FPM value vector for the metagene's antisense strand. For the different elements of fwdlist, they should come from the same regions, such as the TSS region, the TTS region, the gene body region, etc. Their difference is that they may from different experimental conditions, such as the TSS region's metagene data of wildtype samples and gene knockout samples, respectively.

revlist

A list containing the metagene FPM values from the function metaplot or mmetaplot's result list. Each element in it is an FPM value vector contained in the original result list, and its slot name there is "TSSrevFPMmeans", "TTSrevFPMmeans", "GeneBodyrevFPMmeans", or "combinerevFPMmeans". It is the FPM value vector for the metagene's antisense strand and should match the list element transferred to another parameter fwdlist, which is the FPM value vector for the metagene's sense strand. For the different elements of fwdlist, they should come from the same regions, such as the TSS region, the TTS region, the gene body region, etc. Their difference is that they may from different experimental conditions, such as the TSS region's metagene antisense FPM values of wildtype samples and gene knockout samples, respectively.

groupnames

A vector with elements as strings to show the different elements' experimental conditions in fwdlist and revlis.

lineposes

A vector with elements as integers to show the coordinates of the TSS and/or TTS points in the metagene. These coordinates use the beginning of the metagene x-coordinate as 1.

labels

A vector with elements as strings to show the x-axis labels for the beginning and end of the metagene's x-axis and for the positions indicated by the parameter lineposes. The labels should be ordered following their coordinates along the x-axis.

title

The title for the metagene plot.

cutoff

To remove the extremely large FPM outliers from the original metagene plot, this parameter needs to be set. The default value is 0.01, which means the 1 - 1% (0.01) = 99% quantile of the metagene FPMs will be defined as their maximum, and any larger ones will be reduced.

titlesize

The font size for the plot title. Default is 17.

textsize

The font size for the plot texts. Default is 16.

Value

The processed metagene plot with the FPM outliers removed.

Examples

library(proRate)

wt0file <- system.file("extdata", "wt0.bam", package = "proRate")
ko0file <- system.file("extdata", "ko0.bam", package = "proRate")

metareslist <- mmetaplot(metafiles = c(wt0file, ko0file), 
                        labels = c("WT", "KO"), 
                        tssradius = c(1000, 500), 
                        ttsradius = c(1000), 
                        genebodylen = 2000, 
                        strandmethod = 1, 
                        genomename = "mm10", 
                        genelencutoff = 40000, 
                        fpkmcutoff = 1)

combinefwdlist <- list()

combinerevlist <- list()

for(i in seq(1, 2, 1)){
 
 groupname <- c("WT", "KO")[i]
 
 combinefwdlist[[i]] <- metareslist[[groupname]]$combinefwdFPMmeans
 
 combinerevlist[[i]] <- metareslist[[groupname]]$combinerevFPMmeans
 
}

plotprocessing(fwdlist = combinefwdlist, 
              revlist = combinerevlist, 
              
              cutoff = 0.01, 
              groupnames = c("WT", "KO"), 
              labels = c("-1000", "TSS", "TTS", "+1000"), 
              lineposes = c(1001, 3000), 
              
              title = "WT_KO metagene from -1000bp of TSS to +1000bp of TTS", 
              titlesize = 17, 
              textsize = 16)




yuabrahamliu/proRate documentation built on Nov. 3, 2024, 10:14 a.m.