mothur

Environmental variables in batch mode

Hi again,

I want to create a batch file where anyone in our lab can use and all they need to change is the name of the project in the environmental variables.

NAME=nv

Now I want to implement this environmental variable in all instances that will matter for the batch file and so each lab member can get their files out with their unique prefix and feed directly into R code.

In Batch file:
make.file(inputdir=/home/amichaud/$NAME_seqs, type=fastq, prefix=$NAME)

From output log:
mothur > make.file(inputdir=/home/amichaud/nv_seqs, type=fastq, prefix=$nv

[ERROR]: You are missing )
[ERROR]: Invalid command.

The first instances of this $NAME works and is replaced with nv
The second instance is replaced, but truncates the “)” from the end of the line and the code fails. I saw that you are fixing this in the update, that is great to hear.

The main issue that I want to alert you to is that when you have a second (and third) instance of NAME in code further down, but it ends in the middle of the code, the second instance also drops the next character and keeps the .

In batch file:
screen.seqs(fasta=$NAME.trim.contigs.good.unique.align, count=$NAME.trim.contigs.good.count_table, summary=$NAME.trim.contigs.good.unique.summary, start=13862, end=23444)

From output log:
mothur > screen.seqs(fasta=nv.trim.contigs.good.unique.align, count=$nvtrim.contigs.good.count_table, summary=$nvtrim.contigs.good.unique.summary, start=13862, end=23444, processors=80)

Unable to open /home/amichaud/nv_out/$nvtrim.contigs.good.count_table. Trying input directory /home/amichaud/nv_out/$nvtrim.contigs.good.count_table.
Unable to open /home/amichaud/nv_out/$nvtrim.contigs.good.unique.summary. Trying input directory /home/amichaud/nv_out/$nvtrim.contigs.good.unique.summary.
Unable to open /home/amichaud/nv_out/$nvtrim.contigs.good.unique.summary. Trying mothur’s executable location $nvtrim.contigs.good.unique.summary.
Unable to open $nvtrim.contigs.good.unique.summary. Trying mothur’s tools location $nvtrim.contigs.good.unique.summary.
Unable to open $nvtrim.contigs.good.unique.summary.
Unable to open /home/amichaud/nv_out/$nvtrim.contigs.good.unique.summary

So mothur correctly inputs the first $NAME, then the count and summary file names are messed up. Is this issue also fixed in the new update?

Thanks for the help!
Alex

Thanks for bringing this to our attention. I have fixed the issue and the change will be part of our next release.

Thanks, Sarah! I will make sure our system administrator downloads it so we can have the bug fixed and use the common batch file!

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.