hputnam / Becker_E5

3 stars 0 forks source link

RNASeq PERMANOVA #5

Closed hputnam closed 4 months ago

hputnam commented 4 months ago

data look like are scaled twice and then the unscaled data are used for analysis? check and clarify here:

https://github.com/hputnam/Becker_E5/blob/master/RAnalysis/Scripts/RNA-seq/Host/Host_Differential_Gene_Expression_Analysis.Rmd

Conduct PERMANOVA and PCA on global expression and DEG

Export data for PERMANOVA test.

test<-t(assay(gvst)) #export as matrix
test<-as.data.frame(test)

#add category columns
test$sample_id <- rownames(test)
test$treatment <- treatmentinfo_ordered$treatment[match(test$sample_id, treatmentinfo_ordered$sample_id)]

Build PERMANOVA model.

#last column with treatment metadata test[19823] and test[19822], need to start at third to last column for the numberic error issue

scaled_test <-prcomp(test[c(1:19821)], scale=TRUE, center=TRUE)
fviz_eig(scaled_test)

# scale data
vegan <- scale(test[c(1:19821)])

# PerMANOVA 
permanova <- vegan::adonis2(vegan ~ treatment, data = test, method='eu')
permanova
hputnam commented 4 months ago

also pvalues are listed as two different things:

Gene expression is significantly different between Treatments (p=0.023).

Permutation test for adonis under reduced model Terms added sequentially (first to last) Permutation: free Number of permutations: 999

adonis2(formula = vegan ~ treatment, data = test, method = "eu") Df SumOfSqs R2 F Pr(>F)
treatment 1 32572 0.05301 1.6793 0.016 * Residual 30 581879 0.94699
Total 31 614451 1.00000

Signif. codes: 0 ‘’ 0.001 ‘’ 0.01 ‘’ 0.05 ‘.’ 0.1 ‘ ’ 1

hputnam commented 4 months ago

I removed this entirely. It is unnecessary.