<?xml version='1.0'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:atom="http://www.w3.org/2005/Atom" >
<channel>
	<title><![CDATA[BOL: Check all seqs in a folder]]></title>
	<link>https://bioinformaticsonline.com/snippets/view/27294/check-all-seqs-in-a-folder?</link>
	<atom:link href="https://bioinformaticsonline.com/snippets/view/27294/check-all-seqs-in-a-folder?" rel="self" type="application/rss+xml" />
	<description><![CDATA[]]></description>
	
	<item>
	<guid isPermaLink="true">https://bioinformaticsonline.com/snippets/view/27294/check-all-seqs-in-a-folder</guid>
	<pubDate>Wed, 11 May 2016 10:16:47 -0500</pubDate>
	<link>https://bioinformaticsonline.com/snippets/view/27294/check-all-seqs-in-a-folder</link>
	<title><![CDATA[Check all seqs in a folder]]></title>
	<description><![CDATA[<code>#!/usr/local/bin/perl -w

# Can be easily modified to run any command on every sequence in a folder
# Directory of sequences
$myDir = &quot;/home/anjana/seqs&quot;;

# Output directory (relative to $myDir or full path)
$outputDir = &quot;OutDir&quot;;

# Path to pattern file
$patFile = &quot;/home/anjana/patterns/polyA.pat&quot;;

# Go to sequence directory and open it (i.e, read contents)
chdir($myDir) || die &quot;Cannot change to $myDir: $!&quot;;      # Go to $myDir
opendir(DIR, &quot;.&quot;) || die &quot;Cannot open .: $!&quot;;      # Open $myDir

foreach $seqFile (sort readdir(DIR))
{
    if ($seqFile =~ /\.fa$/)      # if file ends in .fa
    {
        print &quot;Processing $seqFile\n&quot;;
        $outFile = $seqFile;         # Create $outFile name
        $outFile =~ s/\.fa/\.polyA\.out/;      # s/old/new/; 

        #User can process these files as per their need
        print &quot;$patFile \t$seqFile \t $outputDir/$outFile\n&quot;;
     }
}</code>]]></description>
	<dc:creator>Anjana</dc:creator>
</item>

</channel>
</rss>