Description Usage Arguments Details Value Author(s) References Examples
This function create a boxplot using a melted data frame as it is normaly used with Reshape and ggplot. It is focused on a specific value (e.g gene) and the fill, color options are related to other columns of your choice you have in the melted dataframe. It also plot an horizontal line on the graph, this the threshold value we use in RNA-Seq to filter our gene count.
1 | RC_boxplot(Data_melt, Name_project, ...)
|
Data_melt |
A melted dataframe from your Data and Design. You should use the RC_melt function to create this or directly the reshape2::melt function. |
Name_project |
A title name for your project. You should define it as an env variable at the beginning of your work. |
xVar |
The feature you want to focus on from your column variables in your melted dataframe (e.g PDCD1). |
colVar |
The Design feature you want to use to split the data on the boxplot. It should be a column name in your melted dataframe. |
Hline |
If provided, just plot an horizontal line. |
The function use the geom_boxplot option to draw useful boxplot. The choice2 is used in the color option in aes_string() to split the boxplot. If Hline is not NULL it will add a simple horizontal line on the boxplot. It is useful to see if the differents boxplot are in range or not from the filter count used in RNA-Seq for example.
The function return a ggplot graph object. You can save it and add any ggplot line with the + geom_ ... .
Benjamin Vittrant
https://cran.r-project.org/web/packages/ggplot2/ggplot2.pdf
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | ##---- Should be DIRECTLY executable !! ----
##-- ==> Define data, use random,
##-- or do help(data=index) for the standard data sets.
## The function is currently defined as
RC_boxplot = function(Data_melt, Name_Project, choice1, choice2, Hline = NULL){
# choice1, a value from the column variable from data_melt (e.g. a gene, a proteine etc)
# choice2, any column from your design file that was used to create the data_melt
#Hline, value to plot on horizontal line
tmp = ggplot(Data_melt[Data_melt$variable == choice1,], aes(x = variable, y = value)) +
geom_boxplot(aes_string(col = choice2),position=position_dodge(1) ) +
ggtitle(Name_Project)+ xlab(choice1) + ylab("")
if(!is.null(Hline)){
tmp = tmp +
geom_hline(yintercept=Hline, linetype="dashed", color = "black")
}
return(tmp)
}
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.