# Tag Info

8

You only have 4 samples total. I think it would be difficult to not have the PCA show big differences between the groups with so few points. On the other hand, for differential expression, it is hard to get something to be statistically significant with only 2 replicates.

4

You can easily color 3D pca plots in R based on the code given below: library("scatterplot3d") colors <- c("#999999", "#E69F00", "#56B4E9") # Number of color according to the number of groups colors <- colors[as.numeric(iris$Species)] # you can put here the column containing the name of population or sample etc. pca1 <- prcomp(iris[, -5]) s3d <-... 4 All that plots like this are telling you is that there are some genes that contribute more to the variability seen between your various samples than others. In an ideal world these genes will also be differentially expressed between your groups, but since we don't live in an ideal world that might not be the case. In general, the longer the line and the ... 4 Just to add to the great summary by Devon Ryan: admixture analysis tools are much more flexible than PCA (which is just a fixed mathematical operation), so they can be designed to incorporate LD patterns, phase information, different population evolution models etc. Here's a paper from the creators of fineSTRUCTURE and Chromopainter admixture tools ... 4 From my memory of what a statistician told me, a PCA aims to determine independent linear combinations of variables (i.e. genotypes) that account for the most variation in the dataset. With 10 million SNPs, the vectors describing the genotypes of all individuals reside somewhere inside a 10-million-dimension hypersphere, and the first principle component ... 3 When the gene expression is scaled and centred you reduce the difference between genes. Imagine you have one gene A that is highly expressed usually and has a standard deviation of 500 units compared to a gene B that is not much expressed and only have a standard deviation of 5. In the scaled and centred genes both contribute the same because A usually ... 3 The general goal of PCA in RNA-seq can be stated as, "I'd like a low-dimension representation of my data to allow easy assessment of the gross structure of my samples, specifically for assessing missing batch effects, samples swaps, etc." Ideally, this low-dimension representation can fit into a plot or two. In other words, we'd like the first 2 (... 3 You can filter out genes that do not show variation across samples, they would not differentiate samples anyway. For the specifics on how to do so, please see the Subpopulation Analysis section of a nice single cell RNA-seq workflow from the Kharchenko Lab. I believe there won't be fundamental differences when applying this approach to bulk RNA-seq. 3 Yes, you can safely concatenate the technical replicates. Odds are good that these are even the same libraries just sequenced twice, so even labeling them as replicates is a bit of a stretch. As an aside, it would be surprising if you actually had a batch effect in a situation like this. You will commonly see sequencing facilities just sequence a given ... 3 The PCHeatmap function (renamed DimHeatmap in Seurat v3) can be used to help determine the number of principal components to use in downstream analysis, as well as to visualize the top genes contributing to each PC. Both cells and genes are ordered by their PC scores, and by default the 15 genes with the highest and 15 genes with the lowest PC loadings are ... 3 You can make a 'dummy variable' for each allele. That means that you don't have info per SNP, but for SNPs with more alleles, the allele is present (1) or not (0). 3 The fundamental difference lies mostly in the math. An admixture analysis involves assuming that genotypes (or more likely, genotype likelihoods) in an unknown sample can be modeled with Hardy-Weinburg equilibrium as arising from the combination from two or more source pools of background variants. The output is then an admixture proportion that dictates ... 3 There is a way to do this, and even better--there is documentation for how to do it! No surprise coming from the Satija Lab. In the vignette they perform multidimensional scaling, but the idea is the same. cmdscale() returns the cell embeddings. SetDimReduction() is the Seurat function you are looking for. No manual editing using @ required. The authors use ... 2 Maybe try plot(evecdat$PC1, evecdat$PC2, xlab="PC1", ylab="PC2", pch="24", cex.lab=2.5, cex.axis=1, type="n") text(evecdat$PC1, evecdat$PC2, evecdat$Sample, col=as.vector(evecdat$color)) This should plot the sample names as text (taken from the evecdat$Sample column), colored as specified in the evecdat$color column. See ?text for details. 2 I recommend the Hamming distance and doing a multidimensional scaling (a procedure similar to PCA but for distances), that way you don't create new variables for the same position. The distance function can be defined as hamming_dist <- function(x, y) { if (x != y) { 1 } else { 0 } Or you can use a package: library(e1071) ... 2 Try to make your rownames unique first. So if you have this matrix with duplicate rownames: m <- replicate(20, rnorm(6)) rownames(m) <- c("B", "C", "C", "B", "E1", "E3") m [,1] [,2] [,3] [,4] [,5] [,6] [,7] B 2.4071997 1.30040528 1.0765500 0.2005440 1.1732384 2.34462132 0.3702172 C -0.2683534 -0.... 2 I was using dudi_pca incorrectly. The supplied parameter to as.matrix() should have been dudi_pca$li: rtsne_out <- Rtsne(as.matrix(dudi_pca$li), pca=FALSE) 2 PCA = principle component analysis and a multivariate statistic, today it is trendily retermed "unsupervised learning" and here is likely being deployed for individuals within your data set. It works by identifying the maximum variance within multidimensional space, shearing it and describing this as the first principle component. The second principle ... 2 First of all, I am not a statistician but have been performing RNA-seq analysis for a while, here is my take: I think performing PCA on the samples makes sense in terms of mathematics. What I mean is you can compute eigenvectors and subsequently principal components either on your genes or on your samples. I don't think performing PCA on the samples makes ... 2 Can't say I've ever used autoplot, but this is fairly easy to achieve using "base" ggplot. One thing autoplot does is put the axis on the same scale reflecting the percentage variation captured by each PC - I think this is a good thing, but most PCA plots you'll see don't do this. As you haven't given us any info on your metadata, I'll just make a ... 1 I've found this the way to work with autoplot (ggfortify's prcomp autoplot) - Use a df that has the field you need for color as the first column (to make things easy), then do: autoplot(prcomp(df[,-1], data=df, color='column1_name') If the color-by field is not the first column, do: autoplot(prcomp(df[,!(colnames(df) == "color_by_column_name")], ... 1 First of all, PCA is a technique for dimension reduction. Basically, the goal is to compare tens of thousands of SNPs in Drosophila. Now if you only have 2 SNPs, you can plot them on a 2D scatter plot. If you have 3 SNPs, you may try a 3D plot. But now imagine you have 30,000 SNPs, but you CANNOT plot a 30000-dimensional plot. To visualize this high ... 1 It is quite possible to make a PCA plot with the samples. Follow this tutorial : https://hbctraining.github.io/DGE_workshop/lessons/03_DGE_QC_analysis.html 1 If you use, say, R's prcomp, you can use my_pca_object$x to get PC coordinates for the samples, and my_pca_object\$rotation to get how much each gene contributes to each PCA. (You might need to transpose your transformed count file to get it to work right)

1

Scaling (or centering) makes the genes comparable: Putting the expression levels of genes in the same scale (i.e. between 0 and 1) sustains that all of your genes contribute equally to the PCA or distance calculations. On the other hand, without this step, such calculations would be dominated by the highly/lowly expressed genes. I get "better" ...

1

If you got DEGs with statistically significant p-values after multiple testing following a valid pipeline, I'd believe that, even if looking at the first few PCs doesn't look promising.

1

I think to identify latent variables, PCA is probably not going to work. NMF might be worth trying. You might want to check out a method called consensus NMF (cNMF) (https://elifesciences.org/articles/43803) published in eLife. The author described some latent variables corresponds to cell types, while others corresponds to cell-cycle or metabolic states of ...

1

I would stay away from using k-means, and instead use a method that doesn't a priori define a number of clusters to detect. It also looks as though your clusters aren't exactly spherical, which is an assumption of k-means. I personally am a fan of dbscan, which is available in the R package of the same name. The other poster recommended t-SNE (available in ...

1

Regarding your question on how to decide which PCs to choose for plotting, prcomp is ordering PCs by their proportions in the variance. For example, using the dataset iris: iris_pc <- prcomp(iris[,1:4], scale = TRUE, center = TRUE) and you get > summary(iris_pc) Importance of components: PC1 PC2 PC3 PC4 ...

1

Prepping the RNA on different days, or making Illumina libraries on different days, or having different technicians handle different samples; that can lead to batch effects. Running samples on two different days does not cause a significant batch effect, as you can plainly see in your PCA. You should just combine the fastqs.

Only top voted, non community-wiki answers of a minimum length are eligible