Hot answers tagged

5

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 ...


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

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

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

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 ...


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)


1

You can filter our genes that do not show variation across samples, they would not differentiate samples anyhow. 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.


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.


1

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 ...


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