<p>You just need to strip the <code>/</code> from <code>$d</code>, for which there are a number of options:</p>

<pre><code>for d in */ ; do 
    dname=`basename $d`
    findPeaks <span class="math-container">$d -style factor -o $</span>{dname}.txt
done
</code></pre>

<p>or</p>

<pre><code>for d in */ ; do
    dname=<span class="math-container">${d%%/}
    findPeaks $</span>d -style factor -o ${dname}.txt
done
</code></pre>

<p>There are likely other ways one could go about this. Having said that, since you're not running these in parallel you could simply move the default output file (<code>peak.txt</code>) to a file name of your choice (using one of the strategies above).</p>

CC BY-SA 4.0
2019-11-13T10:35:52.663Z
2019-11-13T10:35:52.663Z
Devon Ryan
<p>I have a total of 78 ATAC seq samples from which Im trying to do a peak call .I tried this <code>batchParallel.pl findPeaks peaks</code> function but i couldn't find the output what it makes.</p>

<p>So I tried using loop but again the peak file is not written due to incorrect argument usage I guess.</p>

<p>These are my sample directories where i have all the tags</p>

<pre><code>SRR2920564  SRR2920565
</code></pre>

<p>I used homer to make tag directories and now i using it for peakcalling.</p>

<p>here is my command.</p>

<pre><code>for d in */ ; do findPeaks <span class="math-container">$d -style factor -o "$</span>{d}.txt" ; done 
</code></pre>

<p>What i need is all the peakfile should be written as the directory name.</p>

<p>Such as if directory is "<code>SRR2920564</code>" then my peak file should be written in the same directory as <code>SRR2920564.txt</code></p>

<p>I do run the loop it runs successfully but no output written. May be a mundane mistake am not able to figure it out.</p>

<p>Any suggestion or help would be highly appreciated .</p>

CC BY-SA 4.0
2019-11-12T10:36:20.720Z
Your output file is a bit weird.
*findPeaks directoryname/ -style factor -o directoryname/.txt*

You would be attempting to create a file called ".txt" inside each directory? (Also do you need those quotes).

Did you try running this with "-o auto" and checking in each directory if the corresponding files (i.e peaks.txt, regions.txt, transcripts.txt, etc..) were generated?
story
CC BY-SA 4.0
2019-11-12T14:42:48.733Z
I tried running auto it gives an output peak.txt but when it would be easy if i can name them as the directory name for as unique name for each file
kcm
<shell><atac-seq><peak-calling>
Peak-calling using homer
# Peak-calling using homer

(Asked by: username_0 on 2019-11-12)

I have a total of 78 ATAC seq samples from which Im trying to do a peak call .I tried this batchParallel.pl findPeaks peaks function but i couldn't find the output what it makes.
So I tried using loop but again the peak file is not written due to incorrect argument usage I guess.
These are my sample directories where i have all the tags
SRR2920564  SRR2920565

I used homer to make tag directories and now i using it for peakcalling.
here is my command.
for d in */ ; do findPeaks $d -style factor -o "${d}.txt" ; done 

What i need is all the peakfile should be written as the directory name.
Such as if directory is "SRR2920564" then my peak file should be written in the same directory as SRR2920564.txt
I do run the loop it runs successfully but no output written. May be a mundane mistake am not able to figure it out.
Any suggestion or help would be highly appreciated .

**Tags:** shell, atac-seq, peak-calling
> **Comments:**
> **username_1**: Your output file is a bit weird. *findPeaks directoryname/ -style factor -o directoryname/.txt*  You would be attempting to create a file called ".txt" inside each directory? (Also do you need those quotes).  Did you try running this with "-o auto" and checking in each directory if the corresponding files (i.e peaks.txt, regions.txt, transcripts.txt, etc..) were generated?  
> **username_0**: I tried running auto it gives an output peak.txt but when it would be easy if i can name them as the directory name for as unique name for each file  

---

## 1 answers

### Answer by username_2 on 2019-11-13. Score: 1 | Accepted answer

You just need to strip the / from $d, for which there are a number of options:
for d in */ ; do 
    dname=`basename $d`
    findPeaks $d -style factor -o ${dname}.txt
done

or
for d in */ ; do
    dname=${d%%/}
    findPeaks $d -style factor -o ${dname}.txt
done

There are likely other ways one could go about this. Having said that, since you're not running these in parallel you could simply move the default output file (peak.txt) to a file name of your choice (using one of the strategies above).


---

