This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Homer processing multiple files

Hi everyone,

I'm using Homer to map my bed files to genes.

annotatePeaks.pl path/to/file/file.bed mm9 > path/to/file/file_output.txt

This works great but I have a lot of bed files. I tried looping over the files in the directory but it didn't work.

> #!/usr/bin/perl -w
> 
> @files = <"/path/to/file/*.bed">;
> 
> foreach $file (@files) {   annotatePeaks.pl $file mm9 > $file.txt; }

Any ideas what I'm doing wrong?

Thank you.

chip-seq

1 answer

use SHELL

for file in /path/to/file/*.bed; do
    annotatePeaks.pl $file mm9 > $file.txt
done

You are absolutely right. Thank you!

Log in to answer this question.