#!/usr/local/bin/perl -w
# Can be easily modified to run any command on every sequence in a folder
# Directory of sequences
$myDir = "/home/anjana/seqs";
# Output directory (relative to $myDir or full path)
$outputDir = "OutDir";
# Path to pattern file
$patFile = "/home/anjana/patterns/polyA.pat";
# Go to sequence directory and open it (i.e, read contents)
chdir($myDir) || die "Cannot change to $myDir: $!"; # Go to $myDir
opendir(DIR, ".") || die "Cannot open .: $!"; # Open $myDir
foreach $seqFile (sort readdir(DIR))
{
if ($seqFile =~ /\.fa$/) # if file ends in .fa
{
print "Processing $seqFile\n";
$outFile = $seqFile; # Create $outFile name
$outFile =~ s/\.fa/\.polyA\.out/; # s/old/new/;
#User can process these files as per their need
print "$patFile \t$seqFile \t $outputDir/$outFile\n";
}
}