NBISweden / aMeta

Ancient microbiome snakemake workflow
MIT License
21 stars 14 forks source link

problem with MapDamage #131

Closed MinLuke closed 1 year ago

MinLuke commented 1 year ago

Hello everyone, I am currently running aMeta on some sample but I get an error message when it starts to compute with MapDamage. It seems that the problem is that it is not able to import 'pysam' module but if I enter in python and writing 'import pysam' it works correctly. I attach here the log file, in case someone have the solution:

[main_samview] region "KY933470.1" specifies an invalid region or unknown reference. Continue anyway.
[main_samview] region "KC118516.1" specifies an invalid region or unknown reference. Continue anyway.
Error: Could not import required module 'pysam':
    - libhts.so.2: cannot open shared object file: No such file or directory
       If module is not installed, please download from 'http://code.google.com/p/pysam/'.
       A local install may be performed using the following command:
       $ python setup.py install --user

Thank you

ZoePochon commented 1 year ago

Hey Luca!

I have just encountered that error myself and I think I have found a small fix. I added pysam into the code for the environment of the mapdamage rule. So in workflow/envs/mapdamage.yaml I added pysam like this:

channels:

Seems to have done the trick for me at least. Do you mind trying it out? You might need to recreate the pipeline subenvironments like explained in the Quickstart part of the README:

cd aMeta snakemake --snakefile workflow/Snakefile --use-conda --conda-create-envs-only -j 20 env=$(grep krona .snakemake/conda/*yaml | awk '{print $1}' | sed -e "s/.yaml://g" | head -1) cd $env/opt/krona/ ./updateTaxonomy.sh taxonomy cd -

Let me know if it worked! Best, Zoé

MinLuke commented 1 year ago

Thank you @ZoePochon It seems to work now thanks to your support. It performs the mapdamage but now I am getting a different error.

[Wed May 31 18:44:35 2023]
Job 18: Plot_Authentication_Score: PLOTTING HEATMAP OF AUTHENTICATION SCORES
Reason: Missing output files: results/overview_heatmap_scores.pdf; Input files updated by another job: results/AUTHENTICATION/.F23_done

Activating conda environment: .snakemake/conda/d271b60378d8a88aa9c86ad5214c3b8b_
[Wed May 31 18:44:37 2023]
Error in rule Plot_Authentication_Score:
    jobid: 18
    input: results/AUTHENTICATION/.F23_done
    output: results/overview_heatmap_scores.pdf
    log: logs/PLOT_AUTHENTICATION_SCORE/plot_authentication_score.log (check log file(s) for error details)
    conda-env: /home/minluke/aMeta/.snakemake/conda/d271b60378d8a88aa9c86ad5214c3b8b_
    shell:
        Rscript /home/minluke/aMeta/workflow/scripts/plot_score.R results/AUTHENTICATION $(dirname results/overview_heatmap_scores.pdf) &> logs/PLOT_AUTHENTICATION_SCORE/plot_authentication_score.log
        (one of the commands exited with non-zero exit code; note that snakemake uses bash strict mode!)

Shutting down, this might take some time.
Exiting because a job execution failed. Look above for error message
Complete log: .snakemake/log/2023-05-31T160258.391137.snakemake.log

is it related to some R script?

ZoePochon commented 1 year ago

Hmm, I'm not sure about this error. Have you tried rerunning it ? Did it come up when running the test or on real data ? Just beware of creating some files of your own manually in the results folders because some of the R scripts can be sensitive to that and bug if there is a supplementary unexpected file in the result folder.

MinLuke commented 1 year ago

Sorry I noticed only after that one sample name was reported incorrectly. Correcting that now it works perfectly!!! Thank you

ZoePochon commented 1 year ago

Just trying to reopen the issue because we still need to make that small change into the code.