forked from Isabelggayte/DEgenesHunter
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
493f32b
commit 30ef824
Showing
4 changed files
with
97 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
|
||
|
||
|
||
|
||
### **Principal Component Analysis** | ||
This is a PCA plot of the count values normalized following the default method and then they are scaled: | ||
|
||
```{r , echo = FALSE, results = "asis", warning = TRUE, message = TRUE} | ||
std_pca <- FactoMineR::PCA(pca_data, scale.unit=TRUE, graph = FALSE) | ||
dim_to_keep <- get_PCA_dimensions(std_pca) | ||
rownames(target) <- as.character(target$sample) | ||
string_factors <- final_main_params$string_factors | ||
numeric_factors <- final_main_params$numeric_factors | ||
pca_data <- merge_factors(pca_data, target, string_factors) | ||
pca_data <- merge_factors(pca_data, target, numeric_factors) | ||
full_pca <- FactoMineR::PCA(pca_data,ncp = dim_to_keep, scale.unit=TRUE, graph = FALSE, quanti.sup = numeric_factors, quali.sup=string_factors) | ||
``` | ||
#### **Representation of the samples in the two first dimension of PCA** | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis'} | ||
FactoMineR::plot.PCA(full_pca, invisible = "quali" , title = "") | ||
``` | ||
|
||
#### **Representation of the samples and the categories of qualitative valiables in the two first dimension of PCA** | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis'} | ||
FactoMineR::plot.PCA(full_pca, title = "") | ||
``` | ||
|
||
#### **Representation of the variable contribution to the PCA axis 1 and 2** | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis', eval = !is.null(numeric_factors)} | ||
factoextra::fviz_pca_var(full_pca, axes = c(1, 2),select.var = list(name=numeric_factors), col.var="steelblue", title="") + | ||
ggplot2::theme_minimal() | ||
``` | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis', eval = (dim_to_keep > 3 & !is.null(numeric_factors)) } | ||
cat("#### **Representation of the variable contribution to the PCA axis 3 and 4**") | ||
factoextra::fviz_pca_var(full_pca, axes = c(3, 4),select.var = list(name=numeric_factors), col.var="steelblue", title="") + | ||
ggplot2::theme_minimal() | ||
``` | ||
|
||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis', eval = !is.null(numeric_factors)} | ||
cat("#### **Representation of the individuals and the variable contribution to the PCA axis 1 and 2**") | ||
factoextra::fviz_pca_biplot(full_pca, repel = TRUE,select.var = list(name=numeric_factors), col.var="steelblue", title="") + | ||
ggplot2::theme_minimal() | ||
``` | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis'} | ||
cat(paste("#### **Hierarchical clustering of individuals using first", dim_to_keep, "significant PCA dimensions**",sep=' ')) | ||
res.hcpc <- FactoMineR::HCPC(full_pca, graph = FALSE) | ||
plot(res.hcpc , choice="tree", title="") | ||
``` | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis'} | ||
cat(paste("#### **PCA representation of 1 and 2 axis with individuals coloured by its cluster membership. The first ", dim_to_keep, "significant PCA dimensions are used for HCPC**",sep=' ')) | ||
plot(res.hcpc , axes=c(1,2), choice="map", draw.tree= FALSE, title="") | ||
``` | ||
|
||
```{r , echo = FALSE, warning =FALSE, message=FALSE, results = 'asis'} | ||
dim_data <- FactoMineR::dimdesc(full_pca, axes=seq(1, dim_to_keep)) | ||
dim_data_simp <- dim_data[grepl("Dim",names(dim_data))] | ||
test <- lapply(names(dim_data_simp), parse_dim_table, dim_data = dim_data_simp, tag = "####") | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters