jtamames / SqueezeMeta

A complete pipeline for metagenomic analysis
GNU General Public License v3.0
372 stars 80 forks source link

Problem with $installpath in SqueezeMeta #715

Closed lichen-fungus closed 1 year ago

lichen-fungus commented 1 year ago

when running SqueezeMeta in Sequential mode like this: SqueezeMeta.pl -m sequential -s samples -f /data/scratch/ projects/p_citrina_transcriptome/tmp/trimmomatic/ -extassembly /data/scratch/ projects/p_citrina_transcriptome/tmp/trinity/P_citrina_metatranscriptome_unfiltered_Trinity.fasta, I get the following error message:

[5 hours, 18 minutes, 41 seconds]: STEP14 -> BINNING: 14.runbinning.pl
Error running command:    /data/home/admin/anaconda3/envs/SqueezeMeta/SqueezeMeta/bin/jgi_summarize_bam_contig_depths  /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/p-citrina2/data/bam/p-citrina2.p-citrina2.bam --outputDepth /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/p-citrina2/intermediate/binners/metabat2/contigs.depth.txt.PROV >> /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/p-citrina2/syslog 2>&1 at /data/home/admin/anaconda3/envs/SqueezeMeta/SqueezeMeta/lib/SqueezeMeta/bin_metabat2.pl line 62.

The variable $installpathis wrongly defined adding /data in front of the correct path, and therefore the jgi_summarize_bam_contig_depths script can't be found. Can you please advise how I can change $installpath to the correct path, or where $installpath gets defined? I would prefer not to have to change all instances of $installpath in the configuration file SqueezeMeta_conf.pl if that can be avoided somehow.

fpusan commented 1 year ago

That's weird. What is the value of $installpath in the /data/scratch/projects/p_citrina_transcriptome/SqueezeMeta_conf.pl file?

lichen-fungus commented 1 year ago

Yes weird. Unfortunately, $installpath is not defined in the SqueezeMeta_conf.pl, I see only$databasepath , $extdatapath = "$installpath/data" and $scriptdir = "$installpath/scripts" defined in SqueezeMeta_conf.pl in the section #-- Generic paths.

I luckily found the place where the $installpath defined: it is in SqueezeMeta.pl at the very top of the file.

###scriptdir patch v2, Fernando Puente-Sánchez, 18-XI-2019
use File::Basename;
use Cwd 'abs_path';

our $scriptdir;
if(-l __FILE__)
        {
        my $symlinkpath = dirname(__FILE__);
        my $symlinkdest = readlink(__FILE__);
        $scriptdir = dirname(abs_path("$symlinkpath/$symlinkdest"));
        }
else
        {
        $scriptdir = abs_path(dirname(__FILE__));
        }
       our $installpath = abs_path("$scriptdir/..");
###

Do you think it may work if I use the following fix in SqueezeMeta.pl, replacing the code above by the code below? I hope $symlinkpath or $symlinkdest or FILE are not used elsewhere.

###my own scriptdir patch 
# use File::Basename;
use Cwd 'abs_path';
our $scriptdir = "~/anaconda3/envs/SqueezeMeta/SqueezeMeta/scripts/";
our $installpath = abs_path("$scriptdir/..");
###
fpusan commented 1 year ago

Note that I mentioned the SqueezeMeta_conf.pl file inside the project directory. That one should have $installpath defined. E.g. 1) I just ran the command SqueezeMeta.pl -m sequential -f raw -s test2.samples 2) This created a directory named H1 (the name of one of my samples) 3) This are the first lines of the H1/SqueezeMeta_conf.pl file

$version = "1.6.2, March 2023";
$mode = "sequential";
$date = "Fri Jul 21 16:38:01 2023";

$installpath = "/home/fer/.local/opt/miniconda3/envs/SqueezeMeta/SqueezeMeta";
$userdir       = "/data/fer/SQMtestData/Hadza/raw";

$installpath is defined right at the beginning. How did you install the databases? By any chance did you rename the file SqueezeMeta_conf_original.pl inside the SqueezeMeta scripts directory to SqueezeMeta.pl?

fpusan commented 1 year ago

So answering to your previous question, I wouldn't recommend the fix you suggest. If anything, you should instead edit the SqueezeMeta_conf.pl file inside the project's directory (note that this is not the same as the file inside SqueezeMeta's script directory in the source code) and add the right value for $installpath at the beginning. But this should already be present without the need for you to add anything (it works for me using the latest version and I don't remember this having been an issue in the past). So I would rather like to understand what is the origin of your current issue.

fpusan commented 1 year ago

Try going below the directory named p-citrina2/ (the one that contains the data. results, etc folders and then restart again with SqueezeMeta.pl -p p-citrina2 --restart -step 2 Sobre 21/07/2023 17:50:45, lichen-fungus @.***> escribió: Thanks a lot for all your help!

lichen-fungus commented 1 year ago

Hi Fernando, I tried to restart the older analysis that ran until step 16 from one level above the p-citrina2 directory containing the data/ and results/after copying the samples file into the p-citrina2 folder and it starts and dies: SqueezeMeta.pl -p p-citrina2 --restart -step 14

SqueezeMeta v1.6.2, March 2023 - (c) J. Tamames, F. Puente-Sánchez CNB-CSIC, Madrid, SPAIN

Please cite: Tamames & Puente-Sanchez, Frontiers in Microbiology 9, 3349 (2019). doi: https://doi.org/10.3389/fmicb.2018.03349

Run started Fri Jul 21 18:28:27 2023 in sequential mode
1 metagenomes found: p-citrina2

--- SAMPLE p-citrina2 ---
Binning results for concoct,metabat2 already found, skipping step 14
DASTool results in /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/restart_old/p-citrina2/results/bins already found, skipping step 15
DASTool results in /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/restart_old/p-citrina2/intermediate/16.p-citrina2.bintax already found, skipping step 16
[0 seconds]: STEP17 -> CHECKING BINS: 17.checkM_batch.pl
Can't find SqueezeMeta_conf.pl in /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/restart_old/p-citrina2/p-citrina2. Is the project path ok? at /home/admin/anaconda3/envs/SqueezeMeta/SqueezeMeta/scripts/17.checkM_batch.pl line 17.
Stopping in STEP17 -> 17.checkM_batch.pl
Died at /home/admin/anaconda3/envs/SqueezeMeta/bin/SqueezeMeta.pl line 816.

If I move into the p-citrina2directory containing data/ and results/and execute the same code, then I get this error message:

***
Can't open samples file (-s) in p-citrina2/data/00..samples. Please check that it is the correct file

in SqueezeMeta_conf.pl inside the p-citrina2 directory I set the project directory like this because with the original code it wouldn't work: $projectdir = "/data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/restart_old/p-citrina2";

Sorry to bother you with this problem but no matter what I do there is still something not quite right...

fpusan commented 1 year ago

Hi again, What is the content of the /data/scratch/projects/p_citrina_transcriptome/tmp/SqueezeMeta/restart_old/p-citrina2/p-citrina2 directory? I suspect that you'd be better reinstalling from scratch following the instructions. It seems that something in your install got broken along the way...

fpusan commented 1 year ago

Closing due to lack of activity, feel free to reopen