Hello! I am trying to calculate alpha and beta diversity using the script calculate_diversity.R which is present in the packages of Metaphlan4. I run the command in the conda environment where I installed Metaphlan4, but it does not work.
The command I used to calculate beta diversity:
Rscript calculate_diversity.R -f merged_metaphlan_samples.tsv -d beta -m bray-curtis
Fatal Error:
Cannot open file ‘calculate_diversity.R’: No such file or directory
Hi @angel
Have you try to call the script using the absolute path to it?
Rscript /absolute_path/calculate_diversity.R -f merged_metaphlan_samples.tsv -d beta -m bray-curtis
Hi! I am encountering the same issue but am having trouble finding the absolute path. I used the path to the directory where I created the metaphlan environment, but I get the same error.
For example, these were the commands I used to create and activate the environment:
Hi @samanthagoldman
Running metaphlan --help will provide you the path where the MetaPhlAn scripts are installed. If you look at the default value of the --bowtie2db , e.g:
Mapping arguments:
--force Force profiling of the input file by removing the bowtie2out file
--bowtie2db METAPHLAN_BOWTIE2_DB
Folder containing the MetaPhlAn database. You can specify the location by exporting the DEFAULT_DB_FOLDER variable in the shell.[default /etc/anaconda3/e
nvs/metaphlan-4/lib/python3.9/site-packages/MetaPhlAn/metaphlan/metaphlan_databases]
Your metaphlan and utils script will be in the parent folder of the databases. E.g in my case will be
I am also encountering a similar problem.
Rscript /absolute_path /calculate_diversity.R -f merged_metaphlan_samples.tsv -d beta -m bray-curtis
I tried this command. However, I am getting an error as below.
Installing package into ‘/usr/local/lib/R/site-library’
(as ‘lib’ is unspecified)
Warning in install.packages(x, repos = “http://cran.us.r-project.org”) :
‘lib = “/usr/local/lib/R/site-library”’ is not writable
Error in install.packages(x, repos = “http://cran.us.r-project.org”) :
unable to install packages
Calls: sapply → lapply → FUN → install.packages
Execution halted
How to find the Rscript or activate it in this case or make the path writable?