BES-NR blast.pl

From RAJ INFO
Revision as of 11:30, 16 July 2010 by Raj (talk | contribs) (Created page with 'Category: Bioinformatics <source=lang=perl> #! /usr/bin/perl -w # ************************************************************* # This Programme does the following in sequenc…')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

<source=lang=perl>

  1. ! /usr/bin/perl -w
  2. *************************************************************
  3. This Programme does the following in sequence
  4. -> Parses a multi fasta
  5. -> Removes the sequence if they have <50bp and of 'N'
  6. -> Capured as individual files.
  7. Author : Rajkumar (itc@rajkumar.in)
  8. Release: JUL 2009
  9. *************************************************************
  1. Libraries

use strict; use Bio::Perl; use Bio::SeqIO;

  1. Variables

my $path = "/home/raj/bio"; my $path1 = "$path/user/raja"; my $path2 = "$path1/blast/BES-NR"; my $multifasta = "$path2/BES.fa"; my $resdir = "$path2/multifasta";

  1. Getting the Grip of folders

if (-e $resdir) {`rm -fr $resdir`;} if (! -e $resdir) {`mkdir $resdir`;}


  1. making several Fasta files of GDNA

my $in = Bio::SeqIO->new(-file => "$multifasta", -format => 'Fasta'); my $identifier; my $sequence;

while ( my $seq = $in->next_seq() ) { $identifier = $seq->id;

 		$sequence = $seq->seq;
 		
 		#Trim the identifier
 		$identifier =~ s/_Size:[0-9]+bp//g; 

my ($fasta) = $_; $fasta = ">$identifier\n$sequence\n";

my $count_seq = length($sequence); my $count_N = ($sequence =~ tr/N//);

 		my $math = $count_seq * 0.2;
 		

$sequence =~ s/-/N/; if ($count_seq < 50){ next; } if ($count_N > $math){ next; }

open (FASTA, ">".$resdir."/".$identifier.".fa"); print FASTA $fasta; close FASTA;

# print "$identifier\t$count_seq\n";

}

  1. END

</source>