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

Jason Stajich jason at bioperl.org
Thu Oct 23 01:04:08 EDT 2008


doesn't matter, it is all in list context so single-item returned is  
just fine.
-jason
On Oct 22, 2008, at 8:58 PM, Hilmar Lapp wrote:

> 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 :
> ===========================================================
>
>
>

Jason Stajich
jason at bioperl.org





More information about the Bioperl-l mailing list