Thanks for your quickly reply , dose it mean that normally some normal samples should surrounded by tumour samples in PCA and their distance may not cluster in a heatmap? and I'll check if there are some same samples to confirm no mix-up samples from TCGA. here is my code. Thanks you to remove my doubts, I have been Googling this problem for one day.
library(TCGAbiolinks)
library(DESeq2)
library(pheatmap)
counts_query <- GDCquery(project = "TCGA-PRAD",
data.category = "Transcriptome Profiling",
data.type = "Gene Expression Quantification",
workflow.type = "HTSeq - Counts")
GDCdownload(counts_query, files.per.chunk = 8)
counts_se <- GDCprepare(counts_query, save = TRUE,
save.filename = "counts_prostate.rda",
summarizedExperiment = TRUE)
counts_se$shortLetterCode <- factor(counts_se$shortLetterCode)
counts_dds <- DESeqDataSet(counts_se, design = ~shortLetterCode)
counts_dds$shortLetterCode
summary(counts_dds$shortLetterCode)
counts_dds <- counts_dds[,counts_dds$shortLetterCode != "TM"]
counts_dds$shortLetterCode <- droplevels(counts_dds$shortLetterCode)
counts_dds$shortLetterCode <- relevel(counts_dds$shortLetterCode, ref = "NT")
nrow(counts_dds)
counts_dds <- counts_dds[rowSums(counts(counts_dds)) > 1,]
nrow(counts_dds)
vst_counts <- vst(counts_dds, blind = F)
CairoPNG(filename = "vst_meansdplot.png")
meanSdPlot(assay(vst_counts), ranks = T)
dev.off()
vst_dist <- dist(t(assay(vst_counts)))
dist_matrix <- as.matrix(vst_dist)
annotation <- data.frame(vst_counts$shortLetterCode)
colnames(dist_matrix) <- rownames(annotation)
rownames(dist_matrix) <- rownames(annotation)
CairoSVG(file = "sample_distance_heatmap.svg")
pheatmap(dist_matrix,
clustering_distance_cols = vst_dist,
clustering_distance_rows = vst_dist,
show_colnames = F,
show_rownames = F,
annotation_col = annotation,
annotation_row = annotation,
annotation_names_col = F,
annotation_names_row = F,
main = "sample-distance")
CairoPNG(filename = "vst_pca.png")
DESeq2::plotPCA(vst_counts, intgroup = "shortLetterCode")
dev.off()


Thanks for your quickly reply , dose it mean that normally some normal samples should surrounded by tumour samples in PCA and their distance may not cluster in a heatmap? and I'll check if there are some same samples to confirm no mix-up samples from TCGA. here is my code. Thanks you to remove my doubts, I have been Googling this problem for one day.