GSE1563 Lung Cancer Gene Expression Analysis: PCA and Heatmap Visualization
These R code snippets perform gene expression analysis on the GSE1563 dataset, which contains gene expression data and survival information for lung cancer patients.
-
gse_1563_topInter_pca <- prcomp(t(eMat_1563_scaled_top_inter_genes))This line performs Principal Component Analysis (PCA) to reduce the dimensionality of the dataset and identify key variables. Specifically, it performs PCA on the top 15 interacting genes from the standardized GSE1563 dataset. -
summary(gse_1563_topInter_pca)This line summarizes and outputs the PCA results. -
df_1563_toplot <- data.frame(gse_1563$Outcome, pc1 = gse_1563_topInter_pca$x[,1], pc2 = gse_1563_topInter_pca$x[,2])This line converts the PCA results into a data frame and stores it indf_1563_toplot. Here,pc1andpc2represent the reduced principal components, whilegse_1563$Outcomeindicates the survival status (alive or dead) of the lung cancer patients. -
ggplot_PCA_1563 <- ggplot(df_1563_toplot, aes(x = pc1, y= pc2, color=gse_1563$Outcome)) + geom_point(size = 4) + theme_minimal() + labs(title ='Scatter Plot of PCA on PC1 vs PC2')This line uses theggplot2package to create a scatter plot where the x and y axes represent the reduced principal components, and the color of the points indicates the survival status of the lung cancer patients. -
merged_top_inter_genes <- merge(eMat_1563_scaled_top_inter_genes, tT_1563_filtered_top_inter, by = 'row.names')This line merges the standardized top 15 interacting genes with the sample information from the GSE1563 dataset into a single data frame. -
rownames(merged_top_inter_genes) = merged_top_inter_genes$IDThis line sets the row names of the merged data frame to the ID of each gene. -
eMat_1563_scaled_top_inter_genes_withTD <- merged_top_inter_genes[,2:63]This line extracts the gene expression data from the merged data frame and stores it ineMat_1563_scaled_top_inter_genes_withTD. -
t_eMat_1563_scaled_top_inter_genes_withTD <- t(eMat_1563_scaled_top_inter_genes_withTD)This line transposeseMat_1563_scaled_top_inter_genes_withTDfor subsequent heatmap plotting. -
t_eMat_1563_scaled_top_inter_genes_withTD <- as.data.frame(t_eMat_1563_scaled_top_inter_genes_withTD)This line converts the transposed data into a data frame. -
t_eMat_1563_scaled_top_inter_genes_withTD$Outcome <- gse_1563$OutcomeThis line adds the survival status information from the GSE1563 dataset to the data frame. -
t_eMat_1563_scaled_top_inter_genes_withTD <- t_eMat_1563_scaled_top_inter_genes_withTD[order(t_eMat_1563_scaled_top_inter_genes_withTD$Outcome),]This line sorts the data frame by survival status for subsequent heatmap plotting. -
annotation_row = data.frame(gse_1563$Outcome, row.names = rownames(t_eMat_1563))This line creates an annotation row that includes the survival status information for the lung cancer patients. -
heatmap_1563_genes_top <- heatmaply(t_eMat_1563_scaled_top_inter_genes_withTD, scale='column', k_col=2, Rowv = FALSE, Colv = 2, xlab = 'Genes', ylab = 'Patients', fontsize_row = 5, fontsize_col = 10, main = 'Heatmap of the Expression set of Selected Genes', annotation_row = t_eMat_1563_scaled_top_inter_genes_withTD$Outcome, colors=c('blue','white','red'))This line uses theheatmaplypackage to create a heatmap based on the selected genes. Here, the x-axis represents genes, the y-axis represents lung cancer patients, the color indicates the level of gene expression, and the annotation row displays the survival status of each patient.
原文地址: https://www.cveoy.top/t/topic/ogvg 著作权归作者所有。请勿转载和采集!