---
name: "Bio::Tools::BPlite::Iteration"
section: "3pm"
platform: "linux"
package: "bioperl"
version: "1.5.2.102-3"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/Bio::Tools::BPlite::Iteration"
---

# Bio::Tools::BPlite::Iteration(3pm)

Bio::Tools::BPlite::Iteration - object for parsing single iteration of a PSIBLAST report

```
   use Bio::Tools::BPpsilite;
```

```
   open my $FH, "t/psiblastreport.out";
   $report = Bio::Tools::BPpsilite->new(-fh=>\*FH);
```

```
   # determine number of iterations executed by psiblast
   $total_iterations = $report->number_of_iterations;
   $last_iteration = $report->round($total_iterations);
```

```
   # Process only hits found in last iteration ...
   $oldhitarray_ref = $last_iteration->oldhits;
   HIT: while($sbjct = $last_iteration->nextSbjct) {
       $id = $sbjct->name;
       $is_old =  grep  /\Q$id\E/, @$oldhitarray_ref;
       if ($is_old ){next HIT;}
   #  do something with new hit...
   }
```

**ALIGNMENTS**

```
  # This assumed that you have $db pointing to a database, $out to an output file
  # $slxdir to a directory and $psiout
  # note the alignments can only be obtained if the flag "-m 6" is run.
  # It might also be necessary to use the flag -v to get all alignments
  #
    my @psiparams = ('database' => $db , 'output' => $out, 'j' => 3, 'm' => 6,
                     'h' => 1.e-3 , 'F' => 'T' , 'Q' => $psiout );
    my $factory = Bio::Tools::Run::StandAloneBlast->new(@psiparams);
    my $report = $factory->blastpgp($seq);
    my $total_iterations = $report->number_of_iterations();
    my $last_iteration = $report->round($total_iterations);
    my $align=$last_iteration->Align;
    my $slxfile=$slxdir.$id.".slx";
    my $slx = Bio::AlignIO->new('-format' => 'selex','-file' => ">".$slxfile );
    $slx->write_aln($align);
```

See the documentation for BPpsilite.pm for a description of the Iteration.pm module. Email: schattner@alum.mit.edu Jason Stajich, jason@cgt.mc.duke.edu Based on work of: Ian Korf (ikorf@sapiens.wustl.edu, http://sapiens.wustl.edu/~ikorf),  Lorenz Pollak (lorenz@ist.org, bioperl port) BPlite.pm is copyright (C) 1999 by Ian Korf.  This software is provided "as is" without warranty of any kind.\
 **query**

```
 Title    : query
 Usage    : $query = $obj->query();
 Function : returns the query object
 Example  :
 Returns  : query object
 Args     :
```

**qlength**

```
 Title    : qlength
 Usage    : $len = $obj->qlength();
 Returns  : length of query
 Args     : none
```

**newhits**

```
 Title    :  newhits
 Usage    : $newhits = $obj->newhits();
 Returns  : reference to an array listing all the hits
            from the current iteration which were not identified
            in the previous iteration
 Args     : none
```

**oldhits**

```
 Title    :  oldhits
 Usage    : $oldhits = $obj->oldhits();
 Returns  : reference to an array listing all the hits from
            the current iteration which were identified and
            above threshold in the previous iteration
 Args     : none
```

**nextSbjct**

```
 Title    : nextSbjct
 Usage    : $sbjct = $obj->nextSbjct();
 Function : Method of iterating through all the Sbjct retrieved
            from parsing the report
#Example  : while ( my $sbjct = $obj->nextSbjct ) {}
 Returns  : next Sbjct object or undef if finished
 Args     :
```

**Align**

```
 Title    : Align
 Usage    : $SimpleAlign = $obj->Align();
 Function : Method to obtain a simpleAlign object from psiblast
 Example  : $SimpleAlign = $obj->Align();
 Returns  : SimpleAlign object or undef if not found.
 BUG      : Only works if psiblast has been run with m 6 flag
 Args     :
```

**\_readline**

```
 Title   : _readline
 Usage   : $obj->_readline
 Function: Reads a line of input.
```

```
           Note that this method implicitely uses the value of $/ that is
           in effect when called.
```

```
           Note also that the current implementation does not handle pushed
           back input correctly unless the pushed back input ends with the
           value of $/.
 Example :
 Returns :
```

**\_pushback**

```
 Title   : _pushback
 Usage   : $obj->_pushback($newvalue)
 Function: puts a line previously read with _readline back into a buffer
 Example :
 Returns :
 Args    : newvalue
```
