Following what you saw in the theoretical lesson, choose an experiment available in cBioPortalData package and explore it in cBioPortal web page. Choose ten genes for which mutation data are available and plot them using g3viz. Remember to adjust the themes and customize the graphical parameters to your preference.

library(g3viz)
library(cBioPortalData)

project<-"msk_impact_2017"
all.themes=c("default","blue","simple","cbioportal","nature","nature2","ggplot2","dark")
all.genes=c("TP53","KRAS","TERT","PIK3CA","APC","ARID1A","KMT2D","PTEN","EGFR","FAT1")
i=1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))

i=i+1
gene=all.genes[i]
theme.sel=sample(all.themes,1)
mutation.dat <- getMutationsFromCbioportal(project, gene)

plot.options <- g3Lollipop.theme(theme.name = theme.sel,
                                 title.text = paste0(gene," gene (",theme.sel," theme)"),
                                 y.axis.label = paste0("# of ",gene," Mutations"))

g3Lollipop(mutation.dat,
           gene.symbol = gene,
           plot.options = plot.options,
           output.filename = paste0("plot_",gene,"_",theme.sel))