[Bioperl-l] multi ID indexing Bio::DB::Fasta

Lincoln Stein lstein at cshl.edu
Thu Oct 23 13:38:15 UTC 2008


I don't see a problem with this, provided all IDs are unique.

Lincoln

On Wed, Oct 22, 2008 at 4:20 PM, Jason Stajich <jason at bioperl.org> wrote:

> Any reason I should avoid making this change which allows a custom makeid
> to return a list of IDs that can be indexed per sequence?  There is the
> issue that they need to be unique but that is always the case.  DBFasta
> tests pass fine after the change.
>
> This would allow indexing by GI and Accession and LOCUS all from the same
> file.  This is the behavior for Bio::Index::Fasta and other Bio::Index not
> sure if there was any reason to not support it in Bio::DB::Fasta.
>
> Basically it is as follows.  I did some code indenting so there are
> actually less changes than showing when I do a diff.
>
> -                 if ($id) {
> -                         my $seqlength    = $pos - $offset - length($_);
> -                         $seqlength      -= $termination_length *
> $seq_lines;
> -                         $offsets->{$id}  =
> &{$self->{packmeth}}($offset,$seqlength,
> -
>
> $linelength,$firstline,
> -
>                                                             $type,$base);
> -                 }
> -                 $id = ref($self->{makeid}) eq 'CODE' ?
> $self->{makeid}->($_) : $1;
>
>
> +      if (@id) {
> +       my $seqlength    = $pos - $offset - length($_);
> +       $seqlength      -= $termination_length * $seq_lines;
> +       my $ppos = &{$self->{packmeth}}($offset,$seqlength,
> +                                      $linelength,$firstline,
> +                                      $type,$base);
> +       for my $id (@id) { $offsets->{$id}  = $ppos }
> +      }
> +      @id = ref($self->{makeid}) eq 'CODE' ? $self->{makeid}->($_) : $1;
>
>
>
> -jason
> --
> Jason Stajich
> jason at bioperl.org
>
>
>
>


-- 
Lincoln D. Stein

Ontario Institute for Cancer Research
101 College St., Suite 800
Toronto, ON, Canada M5G0A3
416 673-8514
Assistant: Stacey Quinn <Stacey.Quinn at oicr.on.ca>

Cold Spring Harbor Laboratory
1 Bungtown Road
Cold Spring Harbor, NY 11724 USA
(516) 367-8380
Assistant: Sandra Michelsen <michelse at cshl.edu>



More information about the Bioperl-l mailing list