# setting global options figure.outpath <- paste(output.path,"/icreport_figures/",prefix,"/",sep="") opts_chunk$set(fig.path=figure.outpath,dev=file.ext, warning=FALSE, message=FALSE) options(warn=-1,width = 100) flower.palette <- c("#283545","#E09E12","#A72613","#95CDDC","#395717","#3A3B35","#D68931","#442243")
cat("Independent Component Analysis Report \n") cat("Dataset = ", prefix,"\n")
for( i in 1:dim(ica_result$A)[1]){ ###################### Plotting without Gene information ########################## # check if there is a specified order for the ICs (default is by explained variance) p <- ica_summary_df$idx[i] # Running Mclust on IC coefficient to estimate ideal number of clusters in 1D IC coefficient space mclust.obj <- suppressMessages(mclust::Mclust(ica_result$A[p,], modelNames = "V")) component_plots <- list() component_plots[[1]] <- plot_ic_chr(ica_result = ica_result, ic_idx = p, x.axis = x.axis, plot.title = paste(prefix,"_IC#_",p,sep ="")) component_plots[[2]] <- ggplot(coeff.plot.df, aes(x = idx, y = IC, col = color_geno)) + geom_point() + theme_bw()+ theme(legend.position = "none") component_plots[[3]] <- ggplot(coeff.plot.df, aes(x = IC, fill = color_geno)) + geom_histogram() + coord_flip() + theme_bw() if(ica_summary_df[i,"geno_cor"] == 0 ){ component_plots[[3]] <- component_plots[[3]] + theme(legend.position = "none") } cat("------------------------------------------------------------------------------","\n") ic.info <- data.frame(row.names = rownames(ica_summary_df)[i], "plot_number" = i, "Variance_Percent" = ica_summary_df[i,"percent.var"], "N correlated Genotypes" = ica_summary_df[i,"geno_cor"], "Number_of_Peaks" = ica_summary_df[i,"N.peaks"]) print(ic.info) cat("---- Top 10 Gene Weights ---- \n") gene.table <- t(round(ica_result$S[order(abs(ica_result$S[,p]), decreasing = T)[1:10],p, drop = FALSE],digits = 2)) print(gene.table) rm(ic.info, gene.table) cat("------------------------------------------------------------------------------","\n") suppressMessages(multiplot(plotlist = component_plots, layout = matrix(c(1,1,1,1,2,2,3,3),ncol =4 , byrow = TRUE))) }
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.