
<?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_BES-flaxESTs</id>
	<title>Parse BES-flaxESTs - 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_BES-flaxESTs"/>
	<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=Parse_BES-flaxESTs&amp;action=history"/>
	<updated>2026-07-09T20:12:00Z</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_BES-flaxESTs&amp;diff=1869&amp;oldid=prev</id>
		<title>Raj: Created page with &#039;Category: Bioinformatics  &lt;source lang=perl&gt;  #!/usr/bin/perl -w  # Libraries 	use Bio::SearchIO; 	use Parallel::ForkManager;  # Variables 	my ($i)   = $_; 	 # Input prompt  …&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=Parse_BES-flaxESTs&amp;diff=1869&amp;oldid=prev"/>
		<updated>2010-07-20T03:29:13Z</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 Bio::SearchIO; 	use Parallel::ForkManager;  # Variables 	my ($i)   = $_; 	 # Input prompt  …&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;
&lt;br /&gt;
#!/usr/bin/perl -w&lt;br /&gt;
&lt;br /&gt;
# Libraries&lt;br /&gt;
	use Bio::SearchIO;&lt;br /&gt;
	use Parallel::ForkManager;&lt;br /&gt;
&lt;br /&gt;
# Variables&lt;br /&gt;
	my ($i)   = $_;&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;
# Multithreading&lt;br /&gt;
	my $pm = new Parallel::ForkManager(16);&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Some counting&lt;br /&gt;
	my $c_entries = `grep -c &amp;quot;Sequences producing significant alignments&amp;quot; $inFile`;&lt;br /&gt;
	chomp $c_entries;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Making the outfile&lt;br /&gt;
	open (GFF, &amp;quot;&amp;gt;&amp;quot;.$inFile.&amp;quot;.csv&amp;quot;);&lt;br /&gt;
	print GFF &amp;quot;Query\tHitName\tHitDesc\tHSP_rank\t\%ID\teValue\tHSP_length\n&amp;quot;;&lt;br /&gt;
	close GFF;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Parsing Function&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;
	# Go through BLAST reports one by one              &lt;br /&gt;
	while($result = $report-&amp;gt;next_result) {&lt;br /&gt;
	&lt;br /&gt;
	$i++;&lt;br /&gt;
	$pm-&amp;gt;start and next;&lt;br /&gt;
&lt;br /&gt;
		# Go through each each matching sequence&lt;br /&gt;
		while($hit = $result-&amp;gt;next_hit) { &lt;br /&gt;
			&lt;br /&gt;
			# Go through each each HSP for this sequence&lt;br /&gt;
	        	while ($hsp = $hit-&amp;gt;next_hsp) { &lt;br /&gt;
		&lt;br /&gt;
				&lt;br /&gt;
				&lt;br /&gt;
				# Capture the results&lt;br /&gt;
				my $accesssion = $result-&amp;gt;query_accession;&lt;br /&gt;
				my $hitname    = $hit-&amp;gt;name;&lt;br /&gt;
 				my $HitDesc    = $hit-&amp;gt;description;&lt;br /&gt;
 				my $rank       = $hsp-&amp;gt;rank;  &lt;br /&gt;
				my $identity   = $hsp-&amp;gt;percent_identity;&lt;br /&gt;
				my $evalue     = $hsp-&amp;gt;evalue;&lt;br /&gt;
				my $hsp_length = $hsp-&amp;gt;hsp_length;&lt;br /&gt;
				&lt;br /&gt;
				#Conditions&lt;br /&gt;
				next if $hsp-&amp;gt;percent_identity &amp;lt; 80 ;&lt;br /&gt;
				next if $hsp-&amp;gt;hsp_length &amp;lt; 80 ;&lt;br /&gt;
				$identity = sprintf (&amp;quot;%.2f&amp;quot;, $identity);&lt;br /&gt;
				&lt;br /&gt;
				&lt;br /&gt;
				&lt;br /&gt;
				# Writing into files&lt;br /&gt;
				open (GFF, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$inFile.&amp;quot;.csv&amp;quot;);&lt;br /&gt;
				print GFF &amp;quot;$accesssion\t$hitname\t$HitDesc\t$rank\t$identity\t$evalue\t$hsp_length\n&amp;quot;;&lt;br /&gt;
				close GFF;&lt;br /&gt;
				&lt;br /&gt;
				&lt;br /&gt;
				&lt;br /&gt;
				#Decorating the log&lt;br /&gt;
				my $percent = ($i/$c_entries)*100;&lt;br /&gt;
				$percent = sprintf(&amp;quot;%.2f&amp;quot;, $percent);&lt;br /&gt;
&lt;br /&gt;
				print &amp;quot;\n\tCompleted [$i of $c_entries] | $percent% &amp;quot;;&lt;br /&gt;
				&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
			} &lt;br /&gt;
		}&lt;br /&gt;
	&lt;br /&gt;
	&lt;br /&gt;
	$pm-&amp;gt;finish;&lt;br /&gt;
	}&lt;br /&gt;
	$pm-&amp;gt;wait_all_children;&lt;br /&gt;
&lt;br /&gt;
# END&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/perl&amp;gt;&lt;/div&gt;</summary>
		<author><name>Raj</name></author>
	</entry>
</feed>