Question: AddOrReplaceReadGroups error -
1
gravatar for phylofun
6 months ago by
phylofun30
phylofun30 wrote:

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 • 258 views
ADD COMMENTlink modified 6 months ago by RamRS22k • written 6 months ago by phylofun30
2
gravatar for austinjpaul
6 months ago by
austinjpaul40
austinjpaul40 wrote:

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 COMMENTlink modified 6 months ago by RamRS22k • written 6 months ago by austinjpaul40

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 REPLYlink modified 6 months ago • written 6 months ago by RamRS22k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1665 users visited in the last hour