Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #loop through results of blast
- while (<DAT>){
- chomp $_;
- # store tab delimited values into an array
- # btab file is from clean_expand btab.
- my @result = split(/\t/, $_);
- # seq are rRNA positive only if (b.qry_end - b.qry_start) >= 150)
- # AND ((b.qry_start<=20) OR (b.qry_end >= (b.query_length-20)))
- if ( $result[6]-$result[5] >= 150 && ( $result[5] <= 20 || ($result[6] >= ($result[1]-20)) ) ){
- #get rRNA identified sequence.
- push @ident, $result[0];
- $rRNA_positive .= $_ ."\n";
- }
- }
- close DAT;
- # loop through input fasta file
- while(<FSA>){
- if ($_ =~ /^>/){
- $flag = 0;
- # loop through all identified seqs and find it in fasta file
- for (my $i=0; $i<$#ident; $i++){
- if ($_ =~ /$ident[$i]/i){
- $idx = $i;
- $flag = 1;
- }
- }
- # once sequence if found remove it from array (reduces subsequent loops)
- if ($flag){
- @ident = @ident[0..$idx-1,$idx+1..$#ident];
- }
- }
- # output to appropriate streams
- if ($flag){
- print rPOS $_;
- } else {
- print rNEG $_;
- }
- }
- close FSA;
- close rPOS;
- close rNEG;
- # open btab_blast_result to overwrite it with rRNA positive results.
- open(OUT, ">", $btab_blast_result) || die $logger->logdie("Could not open file $btab_blast_result");
- print OUT $rRNA_positive;
- close OUT;
Add Comment
Please, Sign In to add comment