
<?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=N_stat_fasta.pl</id>
	<title>N stat fasta.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=N_stat_fasta.pl"/>
	<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=N_stat_fasta.pl&amp;action=history"/>
	<updated>2026-07-09T20:32:01Z</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=N_stat_fasta.pl&amp;diff=1879&amp;oldid=prev</id>
		<title>Raj: Created page with &#039;Category:Bioinformatics  &lt;source lang=perl&gt; #! /usr/bin/perl -w # ************************************************************* # This Programme does the following in sequenc…&#039;</title>
		<link rel="alternate" type="text/html" href="https://www.rajkumar.in/index.php?title=N_stat_fasta.pl&amp;diff=1879&amp;oldid=prev"/>
		<updated>2010-07-22T08:38:31Z</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 # ************************************************************* # This Programme does the following in sequenc…&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;
# This Programme does the following in sequence&lt;br /&gt;
# -&amp;gt; Parses a multi fasta&lt;br /&gt;
# -&amp;gt; Makes the separate file with completely &amp;#039;N&amp;#039;, &amp;gt;80 Ns and &amp;lt;80 Ns&lt;br /&gt;
# -&amp;gt; Written as individual files.&lt;br /&gt;
# Author : Rajkumar (itc@rajkumar.in)&lt;br /&gt;
# Release: JUL 2009&lt;br /&gt;
# *************************************************************&lt;br /&gt;
&lt;br /&gt;
# Libraries&lt;br /&gt;
	use strict;&lt;br /&gt;
	use Bio::Perl;&lt;br /&gt;
	use Bio::SeqIO;&lt;br /&gt;
&lt;br /&gt;
# Variables&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/blast/BES-NR&amp;quot;;&lt;br /&gt;
	my $multifasta  = &amp;quot;$path2/BES.fa&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
	my $outfile1    = &amp;quot;$path2/BES_All_N.fa&amp;quot;;&lt;br /&gt;
	my $outfile2    = &amp;quot;$path2/BES_MoreThan_80N.fa&amp;quot;;&lt;br /&gt;
	my $outfile3    = &amp;quot;$path2/BES_LessThan_81N.fa&amp;quot;;&lt;br /&gt;
	my $outfile4    = &amp;quot;$path2/BES_withNo_N.fa&amp;quot;;&lt;br /&gt;
	my $outfile5    = &amp;quot;$path2/BES_Atlest_1N.fa&amp;quot;;&lt;br /&gt;
	my $stat        = &amp;quot;$path2/stat.txt&amp;quot;;&lt;br /&gt;
	&lt;br /&gt;
# Getting the Grip of folders&lt;br /&gt;
	if (-e $outfile1)   {`rm $outfile1`;}&lt;br /&gt;
	if (-e $outfile2)   {`rm $outfile2`;}&lt;br /&gt;
	if (-e $outfile3)   {`rm $outfile3`;}&lt;br /&gt;
	if (-e $outfile4)   {`rm $outfile4`;}&lt;br /&gt;
	if (-e $outfile5)   {`rm $outfile5`;}&lt;br /&gt;
&lt;br /&gt;
# making several Fasta files of GDNA&lt;br /&gt;
	my $in  = Bio::SeqIO-&amp;gt;new(-file =&amp;gt; &amp;quot;$multifasta&amp;quot;, -format =&amp;gt; &amp;#039;Fasta&amp;#039;);&lt;br /&gt;
	my $identifier;&lt;br /&gt;
	my $sequence;&lt;br /&gt;
	&lt;br /&gt;
	while ( my $seq = $in-&amp;gt;next_seq() ) {&lt;br /&gt;
		$identifier = $seq-&amp;gt;id;&lt;br /&gt;
  		$sequence = $seq-&amp;gt;seq;&lt;br /&gt;
  		&lt;br /&gt;
  		#Trim the identifier&lt;br /&gt;
  		#$identifier =~ s/_Size:[0-9]+bp//g; &lt;br /&gt;
		&lt;br /&gt;
		my ($fasta) = $_;&lt;br /&gt;
		$fasta = &amp;quot;&amp;gt;$identifier\n$sequence\n&amp;quot;;&lt;br /&gt;
&lt;br /&gt;
		my $count_seq = length($sequence);&lt;br /&gt;
		my $count_N = ($sequence =~ tr/N//);&lt;br /&gt;
  		&lt;br /&gt;
  		&lt;br /&gt;
		if ($count_seq eq $count_N) {&lt;br /&gt;
		&lt;br /&gt;
			open (FASTA, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$outfile1);&lt;br /&gt;
			print FASTA $fasta;&lt;br /&gt;
			close FASTA;		&lt;br /&gt;
		}  		&lt;br /&gt;
		&lt;br /&gt;
		&lt;br /&gt;
		if ($count_N &amp;gt;80) {&lt;br /&gt;
		&lt;br /&gt;
			open (FASTA, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$outfile2);&lt;br /&gt;
			print FASTA $fasta;&lt;br /&gt;
			close FASTA;		&lt;br /&gt;
		}  		&lt;br /&gt;
  		&lt;br /&gt;
		if ($count_N &amp;lt;=80) {&lt;br /&gt;
		&lt;br /&gt;
			open (FASTA, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$outfile3);&lt;br /&gt;
			print FASTA $fasta;&lt;br /&gt;
			close FASTA;		&lt;br /&gt;
		}  		&lt;br /&gt;
&lt;br /&gt;
		if ($count_N &amp;lt;1) {&lt;br /&gt;
		&lt;br /&gt;
			open (FASTA, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$outfile4);&lt;br /&gt;
			print FASTA $fasta;&lt;br /&gt;
			close FASTA;		&lt;br /&gt;
		}&lt;br /&gt;
&lt;br /&gt;
		if ($count_N &amp;gt;=1) {&lt;br /&gt;
		&lt;br /&gt;
			open (FASTA, &amp;quot;&amp;gt;&amp;gt;&amp;quot;.$outfile5);&lt;br /&gt;
			print FASTA $fasta;&lt;br /&gt;
			close FASTA;		&lt;br /&gt;
		}  				  		&lt;br /&gt;
&lt;br /&gt;
	}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
# Generating STAT&lt;br /&gt;
	&lt;br /&gt;
	my $c_outfile1 = `grep -c &amp;quot;&amp;gt;&amp;quot; $outfile1`; chomp $c_outfile1;&lt;br /&gt;
	my $c_outfile2 = `grep -c &amp;quot;&amp;gt;&amp;quot; $outfile2`; chomp $c_outfile2;	&lt;br /&gt;
	my $c_outfile3 = `grep -c &amp;quot;&amp;gt;&amp;quot; $outfile3`; chomp $c_outfile3;&lt;br /&gt;
	my $c_outfile4 = `grep -c &amp;quot;&amp;gt;&amp;quot; $outfile4`; chomp $c_outfile4;&lt;br /&gt;
	my $c_outfile5 = `grep -c &amp;quot;&amp;gt;&amp;quot; $outfile5`; chomp $c_outfile5;		&lt;br /&gt;
	my $total      = `grep -c &amp;quot;&amp;gt;&amp;quot; $multifasta`; chomp $total;	&lt;br /&gt;
	&lt;br /&gt;
&lt;br /&gt;
	my $stat_content = &amp;quot;Total sequences:\t$total\nBES with No &amp;#039;N&amp;#039;:\t$c_outfile4\nBES with atleast one &amp;#039;N&amp;#039;:\t$c_outfile5\nBES with all &amp;#039;N&amp;#039;:\t$c_outfile1\nBES with more than 80 &amp;#039;N&amp;#039;s:\t$c_outfile2\nBES with less than 81 &amp;#039;N&amp;#039;s:\t$c_outfile3\n&amp;quot;;&lt;br /&gt;
	open (F, &amp;quot;&amp;gt;$stat&amp;quot;);&lt;br /&gt;
	print F $stat_content;&lt;br /&gt;
	close F;		&lt;br /&gt;
&lt;br /&gt;
# END&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Raj</name></author>
	</entry>
</feed>