This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Cannot read non-existent file: when executing MarkDuplicates in a script

I am running GATK4 MarkDuplicates and when it is run directly in the command line

 gatk MarkDuplicates --INPUT ./minimap2_sort.sam --METRICS_FILE ./dupMetrics.txt --CREATE_INDEX true --OUTPUT ./sorted_rmdupMINIMAP.bam

This works fine. However, if I create a script with exactly the same code I got this error

 To get help, see http://broadinstitute.github.io/picard/index.html#GettingHelp
htsjdk.samtools.SAMException: Cannot read non-existent file: file:///mainfs/home/mdb1c20/my_onw_NGS_pipeline/scripts_my_first_NGS/comparing_tools/results/assample_results/minipap/to_variants/./minimap_sort.sam 
                                                                  ^^^                                                                                                                          ^

Can you see the 3 ///

gatk4

Are you running MarkDuplicates in the directory that has minimap2_sort.sam?

In other words, I think this file doesn't exist, /mainfs/home/mdb1c20/my_onw_NGS_pipeline/scripts_my_first_NGS/comparing_tools/results/assample_results/minipap/to_variants/minimap_sort.sam, but minimap_sort.sam exists somewhere. To avoid this issue, you could try providing the absolute path to minimap_sort.sam (e.g. --INPUT /mainfs/home/...intermediate_path.../minimap2_sort.sam)

This exist

/mainfs/home/mdb1c20/my_onw_NGS_pipeline/scripts_my_first_NGS/comparing_tools/results/assample_results/minipap/to_variants/minimap_sort.sam

This doesn't

///mainfs/home/mdb1c20/my_onw_NGS_pipeline/scripts_my_first_NGS/comparing_tools/results/assample_results/minipap/to_variants/./minimap_sort.sam

With the absolute path, the 3 /// are added as well

With the absolute path, the 3 /// are added as well

Why is GATK adding ///?

What does "when I create a script" mean? Just a file that you try to submit as bash script.sh with the command in it?

It looks like this is Java's Path class doing this -

Sorry it is not a solution to the file:/// issue since from everything reported, it looks like MarkDuplicates isn't finding a file that exists. If it's a one-off analysis I would try to just add the absolute path.

gatk MarkDuplicates --INPUT /mainfs/home/mdb1c20/my_onw_NGS_pipeline/scripts_my_first_NGS/comparing_tools/results/assample_results/minipap/to_variants/minimap_sort.sam \
    --METRICS_FILE ./dupMetrics.txt --CREATE_INDEX true --OUTPUT ./sorted_rmdupMINIMAP.bam

0 answers

No answers yet.

Log in to answer this question.