
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.rajkumar.in/index.php?action=history&amp;feed=atom&amp;title=Parse_blast_stat.pl</id>
	<title>Parse blast stat.pl - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.rajkumar.in/index.php?action=history&amp;feed=atom&amp;title=Parse_blast_stat.pl"/>
	<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=Parse_blast_stat.pl&amp;action=history"/>
	<updated>2026-07-09T20:12:04Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.46.0</generator>
	<entry>
		<id>https://www.rajkumar.in/index.php?title=Parse_blast_stat.pl&amp;diff=1883&amp;oldid=prev</id>
		<title>Raj: Created page with &#039;Category: Bioinformatics  &lt;source lang=perl&gt; #!/usr/bin/perl -w  # Libraries 	use strict; 	use Bio::SearchIO;  # Variables 	my ($i, $j, $inFile, $result, $hit, $report, $temp…&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=Parse_blast_stat.pl&amp;diff=1883&amp;oldid=prev"/>
		<updated>2010-07-22T12:01:00Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;#039;&lt;a href=&quot;/index.php/Category:Bioinformatics&quot; title=&quot;Category:Bioinformatics&quot;&gt;Category: Bioinformatics&lt;/a&gt;  &amp;lt;source lang=perl&amp;gt; #!/usr/bin/perl -w  # Libraries 	use strict; 	use Bio::SearchIO;  # Variables 	my ($i, $j, $inFile, $result, $hit, $report, $temp…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category: Bioinformatics]]&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=perl&amp;gt;&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
# Libraries&lt;br /&gt;
	use strict;&lt;br /&gt;
	use Bio::SearchIO;&lt;br /&gt;
&lt;br /&gt;
# Variables&lt;br /&gt;
	my ($i, $j, $inFile, $result, $hit, $report, $temp, $filecontent) = $_;&lt;br /&gt;
	&lt;br /&gt;
	my $path        = &amp;quot;/home/raj/bio&amp;quot;;&lt;br /&gt;
	my $path1       = &amp;quot;$path/user/raja&amp;quot;;&lt;br /&gt;
	my $path2       = &amp;quot;$path1/parse_blast&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
# Input prompt&lt;br /&gt;
&lt;br /&gt;
	if (! $ARGV[0]) {&lt;br /&gt;
		print &amp;quot;What is the BLAST file to parse? &amp;quot;;&lt;br /&gt;
		chomp ($inFile = &amp;lt;STDIN&amp;gt;);&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		$inFile = $ARGV[0];&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
	my $outfile     = &amp;quot;$path2/$inFile.hits.txt&amp;quot;;&lt;br /&gt;
	$temp        = &amp;quot;$path2/temp&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
	&lt;br /&gt;
# Parsing Function&lt;br /&gt;
	&lt;br /&gt;
	$report = new Bio::SearchIO(&lt;br /&gt;
         		-file=&amp;gt;&amp;quot;$inFile&amp;quot;,&lt;br /&gt;
			-format =&amp;gt; &amp;quot;blast&amp;quot;);&lt;br /&gt;
&lt;br /&gt;
	$i = 0;&lt;br /&gt;
	while($result = $report-&amp;gt;next_result) {&lt;br /&gt;
	&lt;br /&gt;
		$i++;&lt;br /&gt;
		my $query = $result-&amp;gt;query_accession;&lt;br /&gt;
&lt;br /&gt;
		$j = 0;&lt;br /&gt;
		while ( $hit = $result-&amp;gt;next_hit) {&lt;br /&gt;
&lt;br /&gt;
			$j++;&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		$filecontent = &amp;quot;$i\t$query\t$j\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		open (F, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$temp);&lt;br /&gt;
		print F &amp;quot;$filecontent&amp;quot;;&lt;br /&gt;
		close F;&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
# Sort the temp File&lt;br /&gt;
	$filecontent = `sort -t &amp;#039;\t&amp;#039; -k3 -nr $temp`;&lt;br /&gt;
	&lt;br /&gt;
# Making the outfile&lt;br /&gt;
	open (FH, &amp;quot;&amp;gt;&amp;quot;.$outfile);&lt;br /&gt;
	print FH &amp;quot;Query_No\tQuery_Name\tNumber of Hits\n$filecontent&amp;quot;;&lt;br /&gt;
	close FH;&lt;br /&gt;
		&lt;br /&gt;
	if (-e $temp) {`rm $temp`};	&lt;br /&gt;
&lt;br /&gt;
# END&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Raj</name></author>
	</entry>
</feed>