AddOrReplaceReadGroups error -
1
1
Entering edit mode
5.3 years ago
phylofun ▴ 50

I want to do a for loop around the picard tool, AddOrReplaceReadGroups, but I get an error that has something to do with my input and output paths (I think). Can someone tell me where I went wrong with this:

# pwd: /Users/phylofun/Downloads/project

for i in mapping/*-pe.bam;
do
    java -jar ~/miniconda2/jar/AddOrReplaceReadGroups.jar \
    I="$i" \
    SORT_ORDER=coordinate \
    RGPL=illumina \
    RGPU=D109LACXX \
    RGLB=Lib1 \
    RGID="${i%-pe.bam}" \
    RGSM="${i%-pe.bam}" \
    VALIDATION_STRINGENCY=LENIENT \
    O=picard/"${i%-pe.bam}-pe-RG.bam"
done

error: Cannot write file: /Users/phylofun/Downloads/project/picard/mapping/sample1-pe-RG.bam. Neither file nor parent directory exist.
picard • 1.6k views
ADD COMMENT
2
Entering edit mode
5.3 years ago
austinjpaul ▴ 40

Your input files are coming from the ./mapping/ directory.

Your output path is specified as ./picard/mapping/ directory. However, files can't be written there if that folder doesn't exist.

Try running mkdir ./picard/mapping and then running the script again. Or change your output file names to not be nested under ./picard so that they use the existing ./mapping folder.

Hope that helps!

ADD COMMENT
0
Entering edit mode

Welcome to Biostars and thank you for the contribution! Please use the formatting bar (especially the code option) to present your post better. You can use backticks (`text` becomes text) for inline code, or select a chunk of text and use the highlighted button to format it as a code block. I've done it for you this time.
code_formatting

ADD REPLY

Login before adding your answer.

Traffic: 1471 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6