Working on LBM seq analysis
This commit is contained in:
parent
691ad05b25
commit
20d26e8634
1 changed files with 34 additions and 6 deletions
|
|
@ -203,14 +203,42 @@ ggplot(seq_df_otu_lodes, aes(x = x, alluvium = alluvium, stratum = stratum, labe
|
|||
```
|
||||
|
||||
```{r}
|
||||
ARI_ranks <- function(df_otu) {
|
||||
list_memberships <- function(df_otu) {
|
||||
memb_mat <- df_otu |> select(starts_with("Z"))
|
||||
memb_list <- lapply(seq_len(ncol(memb_mat)), function(i) memb_mat[,i] |> unlist() |> as.vector())
|
||||
outer(memb_list,memb_list, FUN = Vectorize(ARI))}
|
||||
ARI_ranks(seq_df_otu)
|
||||
ARI_ranks(notrans_df_otu)
|
||||
memb_list <- lapply(seq_len(ncol(memb_mat)), function(i) {
|
||||
memb_mat[, i] |>
|
||||
unlist() |>
|
||||
as.vector()
|
||||
})
|
||||
return(memb_list)
|
||||
}
|
||||
seq_memb_list <- list_memberships(seq_df_otu)
|
||||
notrans_memb_list <- list_memberships(notrans_df_otu)
|
||||
outer(seq_memb_list, seq_memb_list, Vectorize(ARI))
|
||||
outer(notrans_memb_list, notrans_memb_list, Vectorize(ARI))
|
||||
```
|
||||
|
||||
### ARI phylogénie et clustering
|
||||
|
||||
```{r}
|
||||
phylo_df <- data.frame(merged = rownames(tail(per_taxa_networks, 1)[[1]])) %>% separate(col = "merged", into = c("Kingdom", "Phylum", "Class", "Order", "Family", "Genus", "Species"), sep = ";_;")
|
||||
|
||||
phylo_df <- phylo_df %>% rename_all(~ str_c("Rank", which(colnames(phylo_df) == .)))
|
||||
|
||||
phylo_df <- phylo_df %>% mutate_all(as.factor)
|
||||
|
||||
phylo_memb_list <- lapply(seq_len(ncol(phylo_df)), function(i) {
|
||||
phylo_df[, i] |>
|
||||
unlist() |>
|
||||
as.factor()
|
||||
})
|
||||
|
||||
outer(phylo_memb_list, , Vectorize(ARI))
|
||||
```
|
||||
|
||||
|
||||
## ICL
|
||||
|
||||
```{r}
|
||||
# Extract ICL
|
||||
ICL_per_ranks <- function(model_results) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue