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

Hilmar Lapp hlapp at gmx.net
Thu Oct 23 00:58:47 UTC 2008


Sounds great to me. I understand that this wouldn't *require* makeid  
to return a list, right?

	-hilmar

On Oct 23, 2008, at 4:20 AM, Jason Stajich 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
>
>
>
> _______________________________________________
> Bioperl-l mailing list
> Bioperl-l at lists.open-bio.org
> http://lists.open-bio.org/mailman/listinfo/bioperl-l

-- 
===========================================================
: Hilmar Lapp  -:-  Durham, NC  -:-  hlapp at gmx dot net :
===========================================================






More information about the Bioperl-l mailing list