Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue: shutil.SameFileError in wrap_up Method #513

Open
brchn6 opened this issue May 26, 2024 · 2 comments
Open

Issue: shutil.SameFileError in wrap_up Method #513

brchn6 opened this issue May 26, 2024 · 2 comments
Labels

Comments

@brchn6
Copy link

brchn6 commented May 26, 2024

I've encountered an issue with the wrap_up method in the emapper.py script, where the script throws a shutil.SameFileError when the source and destination paths for copying a file are the same. This error interrupts the execution of the script, preventing it from completing the annotation process.

Steps to Reproduce:

Run the emapper.py script with input parameters that result in the source and destination paths being the same.
Observe the shutil.SameFileError in the traceback.

Error Traceback:

Traceback (most recent call last):
  File "/home/projects/zeevid/barc/.conda/envs/eggnog-mapper/bin/emapper.py", line 708, in <module>
    n, elapsed_time = emapper.run(args, args.input, args.annotate_hits_table, args.cache_file)
  File "/home/projects/zeevid/barc/.conda/envs/eggnog-mapper/lib/python3.9/site-packages/eggnogmapper/emapper.py", line 358, in run
    self.wrap_up(predictor, searcher)
  File "/home/projects/zeevid/barc/.conda/envs/eggnog-mapper/lib/python3.9/site-packages/eggnogmapper/emapper.py", line 318, in wrap_up
    shutil.copy(full_fname, self.output_dir)
  File "/home/projects/zeevid/barc/.conda/envs/eggnog-mapper/lib/python3.9/shutil.py", line 427, in copy
    copyfile(src, dst, follow_symlinks=follow_symlinks)
  File "/home/projects/zeevid/barc/.conda/envs/eggnog-mapper/lib/python3.9/shutil.py", line 244, in copyfile
    raise SameFileError("{!r} and {!r} are the same file".format(src, dst))
shutil.SameFileError: '/home/projects/zeevid/Analyses/2023-VernalPool/2024-Bar_Cohen_analysis/eggNOG-mapper_with_diamond_and_prodigal/cleaned_contigs_annotation.emapper.genepred.fasta' and '/home/projects/zeevid/Analyses/2023-VernalPool/2024-Bar_Cohen_analysis/eggNOG-mapper_with_diamond_and_prodigal/cleaned_contigs_annotation.emapper.genepred.fasta' are the same file

Environment:

emapper-2.1.12 / Expected eggNOG DB version: 5.0.2 / Installed eggNOG DB version: 5.0.2 / Diamond version found: diamond version 2.0.11 / MMseqs2 version found: 13.45111 / Compatible novel families DB version: 1.0.1

LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.9.2009 (Core)
Release:        7.9.2009
Codename:       Core
x86_64 x86_64 GNU/Linux

@brchn6
Copy link
Author

brchn6 commented May 26, 2024

Script Calling:

# Define input and output files
FASTA_DATA_FILE=/home/projects/zeevid/Analyses/2023-VernalPool/2024-Bar_Cohen_analysis/Done_Results/post_Cleannig_Contis_From_low_Q_conting/output_dir_clean_contigs_length_threshold_coverage_threshold/cleaned_contigs.fasta
OUTPUT_DIR=/home/projects/zeevid/Analyses/2023-VernalPool/2024-Bar_Cohen_analysis/eggNOG-mapper_with_diamond_and_prodigal
OUTPUT_DIR_TMP=${OUTPUT_DIR}/tmp
OUTPUT_FILE_PREFIX=${OUTPUT_DIR}/cleaned_contigs_annotation
HITS_FILE=${OUTPUT_FILE_PREFIX}/hits.tsv

# Ensure output directory and file paths are correct
mkdir -p $OUTPUT_DIR_TMP
chmod -R 755 $OUTPUT_DIR_TMP

# Check if the source and destination files are the same
if [ "$FASTA_DATA_FILE" != "$OUTPUT_FILE_PREFIX.fasta" ]; then
    echo "Source and destination files are different. Running emapper.py."
    # Run eggNOG-mapper
    emapper.py \
        -i $FASTA_DATA_FILE \
        --output_dir $OUTPUT_DIR \
        --output $OUTPUT_FILE_PREFIX \
        -m diamond \
        --cpu 4 \
        --itype genome \
        --genepred prodigal \
        --scratch_dir $OUTPUT_DIR_TMP \
        --temp_dir $OUTPUT_DIR_TMP \
        --override


@brchn6 brchn6 closed this as completed May 26, 2024
@brchn6 brchn6 reopened this May 26, 2024
@Cantalapiedra
Copy link
Collaborator

Cantalapiedra commented Jul 1, 2024

Dear @brchn6 ,

Thank you for reporting this. I will label it as a bug, and hopefully we can fix it soon.

Best,
Carlos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants