<p>Something like this:</p>
<pre><code>db_dir=$CONDA_PREFIX/share/RepeatMasker/Libraries/CONS-Dfam_3.3/

if [ -d &quot;<span class="math-container">${db_dir}" ] &amp;&amp; [ -n "$</span>(ls -A ${db_dir})&quot; ]; then
    echo &quot;CONS-Dfam folder is not empty&quot;
    # ... do something
else
    echo &gt; sequence.fasta
    RepeatMasker -e rmblast -species human -dir . sequence.fasta
fi
</code></pre>
<p>If the folder exists and is not empty, otherwise build it using an empty file.</p>

CC BY-SA 4.0
2021-10-26T11:53:58.387Z
That's what I mentioned in my question, using a decoy FASTA. It seems there are not alternatives
MeisterAbababa
CC BY-SA 4.0
2021-10-25T19:14:52.100Z
2021-10-25T19:14:52.100Z
zorbax
<p>I'm using RepeatMasker on human sequences. When running RepeatMasker this way:</p>
<pre><code>RepeatMasker -e rmblast -species human -dir . myFile.fa
</code></pre>
<p>RepeatMasker builds some libraries:</p>
<pre><code>Building general libraries in: /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/general
Building species libraries in: /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/human
</code></pre>
<p>(Paths edited)
On subsequent runs, this does not happen.
I want to check if these libraries exist beforehand (which I can easily do with <code>ls /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/</code>), and if they don't, build them.</p>
<p>I could do a run with a decoy fasta to trigger that step, but it's a bit hacky. Is there a better way to force Repeat Masker to build those libraries?</p>
<p>(I mention that I'm using bioconda in the title because I'm working on a remote server with restrictions, so that should be taken into account, no because there is already a solution for other installation methods).</p>

<repeatmasker>
Build RepeatMasker default libraries beforehand (bioconda installation)
# Build RepeatMasker default libraries beforehand (bioconda installation)

(Asked by: username_0 on 2021-10-25)

I'm using RepeatMasker on human sequences. When running RepeatMasker this way:
RepeatMasker -e rmblast -species human -dir . myFile.fa

RepeatMasker builds some libraries:
Building general libraries in: /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/general
Building species libraries in: /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/human

(Paths edited)
On subsequent runs, this does not happen.
I want to check if these libraries exist beforehand (which I can easily do with ls /path/to/share/RepeatMasker/Libraries/CONS-Dfam_3.3/), and if they don't, build them.
I could do a run with a decoy fasta to trigger that step, but it's a bit hacky. Is there a better way to force Repeat Masker to build those libraries?
(I mention that I'm using bioconda in the title because I'm working on a remote server with restrictions, so that should be taken into account, no because there is already a solution for other installation methods).

**Tags:** repeatmasker

---

## 1 answers

### Answer by username_1 on 2021-10-25. Score: 1

Something like this:
db_dir=$CONDA_PREFIX/share/RepeatMasker/Libraries/CONS-Dfam_3.3/

if [ -d "${db_dir}" ] && [ -n "$(ls -A ${db_dir})" ]; then
    echo "CONS-Dfam folder is not empty"
    # ... do something
else
    echo > sequence.fasta
    RepeatMasker -e rmblast -species human -dir . sequence.fasta
fi

If the folder exists and is not empty, otherwise build it using an empty file.

> **Comments:**
> **username_0**: That's what I mentioned in my question, using a decoy FASTA. It seems there are not alternatives  

---

