comparison PhyloIndex.R @ 0:71a46f890035 draft

planemo upload for repository https://github.com/galaxyecology/tools-ecology/tree/master/tools/Phylodiversity_workflow commit 0de557d919c26eb0b5ab61504bc597d551503ac3
author ecology
date Tue, 20 May 2025 09:53:58 +0000
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:71a46f890035
1 #!/bin/Rscript
2 # Indice de phylodiversite
3
4
5 # args
6 args = commandArgs(trailingOnly=TRUE)
7 #args = c("comm_matrix", "comm_tree.txt")
8
9 # library
10 library(Matrix)
11 library(ape)
12 library(phyloregion)
13 library(SparseArray)
14
15 # functions
16 write_results <- function(){
17 write.table(ses_PD, output_file, sep = "\t", row.names=FALSE)
18 }
19
20 # verif args
21 if (length(args)<5){stop('Usage : input_tree_file input_matrix_file random_seed clustering_model output_file')
22 }else{
23 # read enter file
24 comm_tree <- read.tree(args[1])
25
26 comm_matrix <- readSparseCSV(args[2] , sep="\t")
27 comm_matrix <- as(comm_matrix,"dgCMatrix")
28
29 seed <- args[3]
30
31 model <- args[4]
32
33 output_file <- args[5]
34
35 # rdm + compute
36 set.seed(seed)
37 ses_PD <- PD_ses(comm_matrix, comm_tree, model = model, reps = 999)
38
39 # write res
40 write_results()
41 }