zktuong/dandelion

Singularity having trouble with pathing

wkwong-henlix opened this issue · 14 comments

Description of the bug

Singularity is having issues trying to find the path to the fasta file.

Minimal reproducible example

# Current directory with the dandelion container and the folder with the samples
wkwong@LAPTOP-C5097PPO:/mnt/c/Users/Wesley Kwong/OneDrive - Hengenix Biotech, Inc/Documents/bcr_analysis/dandelion_bcr_analysis$ ls
sc-dandelion_latest.sif  sc5p_v2_hs_B_1k

# Sample folder
wkwong@LAPTOP-C5097PPO:/mnt/c/Users/Wesley Kwong/OneDrive - Hengenix Biotech, Inc/Documents/bcr_analysis/dandelion_bcr_analysis/sc5p_v2_hs_B_1k$ ls
filtered_contig.fasta  filtered_contig_annotations.csv

# Singularity command running at the current directory
singularity run sc-dandelion_latest.sif dandelion-preprocess --file_prefix sc5p_v2_hs_B_1k

The error message produced by the code above

--------------------------------------------------------------

Formating fasta(s) :   0%|          | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
  File "/share/dandelion_preprocess.py", line 303, in <module>
    main()
  File "/share/dandelion_preprocess.py", line 208, in main
    ddl.pp.format_fastas(
  File "/opt/conda/envs/sc-dandelion-container/lib/python3.9/site-packages/dandelion/preprocessing/_preprocessing.py", line 383, in format_fastas
    format_fasta(
  File "/opt/conda/envs/sc-dandelion-container/lib/python3.9/site-packages/dandelion/preprocessing/_preprocessing.py", line 111, in format_fasta
    raise FileNotFoundError(
FileNotFoundError: Path to fasta file is unknown. Please specify path to fasta file or folder containing fasta file. Starting folder should only contain 1 fasta file.

OS information

No response

Version information

No response

Additional context

No response

hi, can you try binding your current directory to see if it helps:

singularity run -B $PWD sc-dandelion_latest.sif dandelion-preprocess --file_prefix sc5p_v2_hs_B_1k

This is the output of that:
FATAL: could not open image /mnt/c/Users/Wesley Kwong/OneDrive - Hengenix Biotech, Inc/Documents/bcr_analysis/dandelion_bcr_analysis/Kwong/OneDrive: failed to retrieve path for /mnt/c/Users/Wesley Kwong/OneDrive - Hengenix Biotech, Inc/Documents/bcr_analysis/dandelion_bcr_analysis/Kwong/OneDrive: lstat /mnt/c/Users/Wesley Kwong/OneDrive - Hengenix Biotech, Inc/Documents/bcr_analysis/dandelion_bcr_analysis/Kwong: no such file or directory

i wonder if the spaces and commas are interferring with how the path is being interpreted. What if you make a copy of your files in a location where there are no spaces and weird characters and rerun there?

So after moving to a new location, it solved that fatal error message. But I'm still getting the same error message about the path to the fasta file is unknown.

oh sorry - it should be:

singularity run -B $PWD sc-dandelion_latest.sif dandelion-preprocess --file_prefix filtered

Nope, I'm still getting the same error.

are you above the sc5p_v2_hs_B_1k directory? you should run the singularity function there.

Yes, I've been running the function in the User folder which has both the sc-dandelion_latest.sif file and the sc5p_v2_hs_B_1k folder

ok, what about pointing it to a csv file like:

singularity run -B $PWD sc-dandelion_latest.sif dandelion-preprocess --file_prefix filtered --meta meta.csv

where meta.csv is:

sample
sc5p_v2_hs_B_1k

Yes that worked! The preprocessing ran smoothly.

Thanks a lot for the debugging!

No worries, thank you for the interest in the package!

just pinging @ktpolanski as he is busy working on improving the user experience so maybe something we can document on in the updates

Could you do an ls -lah of the directory where you ran into this issue? I've also ran into this at some point and got fed up and made a metadata file, may have forgotten to liaise with Kelvin.

wkwong@LAPTOP-C5097PPO:/mnt/c/Users$ ls -lah
total 2.0G
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 14:36 .
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 09:12 ..
lrwxrwxrwx 1 wkwong wkwong 18 Dec 7 2019 'All Users' -> /mnt/c/ProgramData
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 3 15:44 Default
lrwxrwxrwx 1 wkwong wkwong 20 Dec 7 2019 'Default User' -> /mnt/c/Users/Default
drwxrwxrwx 1 wkwong wkwong 4.0K Apr 28 2021 Public
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 09:31 Wesley
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 14:33 'Wesley Kwong'
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 14:09 bcr_preprocessing_dandelion
-rwxrwxrwx 1 wkwong wkwong 174 Dec 7 2019 desktop.ini
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 3 13:48 henge
-rwxrwxrwx 1 wkwong wkwong 28 Oct 18 14:35 meta.csv
-rwxrwxrwx 1 wkwong wkwong 2.0G Oct 18 14:10 sc-dandelion_latest.sif
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 14:36 sc5p_v2_hs_B_1k
drwxrwxrwx 1 wkwong wkwong 4.0K Oct 18 14:37 tigger

Without a metadata file present, dandelion treats every subfolder in the folder as a sample. Your folder is full of subfolders that are not samples.

I will be sure to stress this in the docs.