Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
library(ggplot2)
#############################
# Load Data
#############################
base_path <- './'
file_name <- 'datasets/gan_datasets/tham_lasso_dataset.csv'
all_data <- read.csv(paste(base_path, file_name, sep=''), header=TRUE)
gene_list_file_name <- 'human_mouse_gene_lists/lasso_gene_list.csv'
gene_list <- read.csv(paste(base_path, gene_list_file_name, sep=''), header=TRUE)
################################
# Functions
################################
# Function from https://stackoverflow.com/questions/22742737/function-to-save-ggplot
# Special Thanks to enricoferrero
# https://stackoverflow.com/users/1540663/enricoferrero
savePlot <- function(myPlot, file_name) {
png(paste(file_name, '.png', sep=''), width=732, height=543)
print(myPlot)
dev.off()
}
################################
# Variables
################################
# Vector of fields to examine
# columns_to_exclude <- c('test', 'class')
# fields <- colnames(all_data)[match(columns_to_exclude, colnames(all_data))]
for (field in gene_list$Symbol) {
if (field %in% colnames(all_data)) {
the_title <- paste('Expression Historgram of', field)
x_lab <- paste(field, 'Expression Value')
the_plot <- ggplot(all_data, aes(x=all_data[ , field])) +
geom_histogram() +
geom_vline(xintercept=mean(all_data[ , field]), color='red', size=2) +
labs(title=the_title, x=x_lab)
print(the_plot)
savePlot(the_plot, field)
# Pause until ready for next
readline("Press Enter for next")
}
}