daily pastebin goal
76%
SHARE
TWEET

Untitled

a guest Jan 12th, 2018 45 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #loop through results of blast
  2. while (<DAT>){
  3.     chomp $_;
  4.    
  5.     # store tab delimited values into an array
  6.     # btab file is from clean_expand btab.
  7.     my @result = split(/\t/, $_);
  8.    
  9.     # seq are rRNA positive only if (b.qry_end - b.qry_start) >= 150)
  10.     # AND ((b.qry_start<=20) OR (b.qry_end >= (b.query_length-20)))
  11.     if ( $result[6]-$result[5] >= 150 && ( $result[5] <= 20 || ($result[6] >= ($result[1]-20)) ) ){
  12.      
  13.       #get rRNA identified sequence.
  14.       push @ident, $result[0];
  15.      
  16.       $rRNA_positive .= $_ ."\n";
  17.     }
  18. }
  19. close DAT;
  20.  
  21. # loop through input fasta file
  22. while(<FSA>){
  23.   if ($_ =~ /^>/){
  24.     $flag = 0;
  25.     # loop through all identified seqs and find it in fasta file
  26.     for (my $i=0; $i<$#ident; $i++){
  27.       if ($_ =~ /$ident[$i]/i){
  28.     $idx = $i;
  29.     $flag = 1;
  30.       }
  31.     }
  32.    
  33.     # once sequence if found remove it from array (reduces subsequent loops)
  34.     if ($flag){
  35.       @ident = @ident[0..$idx-1,$idx+1..$#ident];
  36.     }
  37.   }
  38.  
  39.   # output to appropriate streams
  40.   if ($flag){
  41.     print rPOS $_;
  42.   } else {
  43.     print rNEG $_;
  44.   }
  45. }
  46.  
  47. close FSA;
  48. close rPOS;
  49. close rNEG;
  50.  
  51. # open btab_blast_result to overwrite it with rRNA positive results.
  52. open(OUT, ">", $btab_blast_result) || die $logger->logdie("Could not open file $btab_blast_result");
  53. print OUT $rRNA_positive;
  54. close OUT;
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top