Learn PERL Basic with Me : NCBI BLAST parser III
|
I have already shared different parser to analyse the NCBI blast results. You can extract the best hits from your blast result file but this script is special to me because it is written by me. As I have told that I am trying to teach PERL to myself. Actually I am trying to learn the regular expression these days. This PERL script will extract all the BLAST hits along with query and save the result file in another file a 'resul.txt'. I have tested this script with the result of online NCBI blast so I am not sure whether it will work for standalone or offline version. You can use this BLAST result file just for example
#!/usr/bin/perl # This line will ask for the file name print "your BLAST file name \n"; # This line will save the file name into $file my $file = <>; # This line will open the input file open (FILE, "$file"); # This line will open the output file open (OUT, ">result.txt"); # This line will create the loop to search the substring while ($file = <FILE>){ # This line will search the substring "Query=" if ($file =~ /Query=/) { # This line will print the all lines containg the substring "Query=" print (OUT "$file\n"); } # This line will search the substring ">" if ($file =~ /^>/) { # This line will print the all lines containg the substring "Score" print (OUT "$file"); } # This line will search the substring "Score" if ($file =~ /\sScore/) { # This line will print the all lines containg the substring "Score" print (OUT "$file"); } }
Related Posts Learn PERL,
Perl Script
|
Was This Post Useful? Add This To Del.icio.us Share on Facebook StumbleUpon This Add to Technorati Share on Twitter |
Labels:
Learn PERL,
Perl Script
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Have Problem ?? Drop a comments here!