Mercurial > repos > ecology > ecoregion_clara_cluster
comparison nb_clust_G.R @ 1:edb8d19735a6 draft
planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/Ecoregionalization_workflow commit 459ba1277acd7d8d4a02f90dbd7ff444bf8eac92
author | ecology |
---|---|
date | Wed, 24 Jan 2024 15:53:07 +0000 |
parents | 32849c52aa54 |
children |
comparison
equal
deleted
inserted
replaced
0:32849c52aa54 | 1:edb8d19735a6 |
---|---|
19 sample <- as.numeric(args[6]) | 19 sample <- as.numeric(args[6]) |
20 } | 20 } |
21 | 21 |
22 #load data | 22 #load data |
23 | 23 |
24 env.data <- read.table(enviro, header = TRUE, dec = ".", na.strings = "-9999.00") | 24 env.data <- read.table(enviro, sep="\t", header = TRUE, dec = ".", na.strings = "-9999") |
25 | 25 |
26 ##List of modelled taxa used for clustering | 26 ##List of modelled taxa used for clustering |
27 tv <- read.table(taxa_list, dec=".", sep=" ", header=F, na.strings = "NA") | 27 tv <- read.table(taxa_list, dec=".", sep=" ", header=F, na.strings = "NA") |
28 names(tv) <- c("a") | 28 names(tv) <- c("a") |
29 | 29 |
31 | 31 |
32 data_split = str_split(preds,",") | 32 data_split = str_split(preds,",") |
33 data.bio = NULL | 33 data.bio = NULL |
34 | 34 |
35 for (i in 1:length(data_split[[1]])) { | 35 for (i in 1:length(data_split[[1]])) { |
36 data.bio1 <- read.table(data_split[[1]][i], dec=".", sep=" ", header=T, na.strings = "NA") | 36 data.bio1 <- read.table(data_split[[1]][i], dec=".", sep="\t", header=T, na.strings = "NA") |
37 data.bio <- rbind(data.bio,data.bio1) | 37 data.bio <- rbind(data.bio,data.bio1) |
38 remove(data.bio1) | 38 remove(data.bio1) |
39 } | 39 } |
40 | 40 |
41 names(data.bio) <- c("lat", "long", "pred", "taxon") | 41 names(data.bio) <- c("lat", "long", "pred", "taxon") |
67 sih_values[k] <- clara_res$silinfo$avg.width | 67 sih_values[k] <- clara_res$silinfo$avg.width |
68 } | 68 } |
69 | 69 |
70 # Plot SIH Index Chart by Number of Clusters | 70 # Plot SIH Index Chart by Number of Clusters |
71 png("Indices_SIH.png") | 71 png("Indices_SIH.png") |
72 plot(2:max_k, sih_values[2:max_k], type = "b", xlab = "Nombre de clusters", ylab = "Indice SIH") | 72 plot(2:max_k, sih_values[2:max_k], type = "b", xlab = "Number of clusters", ylab = "SIH index") |
73 dev.off() | 73 dev.off() |