[BioPython] [Biopython-dev] Bio.SeqIO function to read a single record

Martin MOKREJŠ mmokrejs at ribosome.natur.cuni.cz
Mon Dec 10 17:11:18 UTC 2007


Peter,
  so how about parse_one()? Or having a pair parse_file() and parse_entry()?
M.

Peter Cock wrote:
> Michiel de Hoon wrote:
>>> I'd suggested a Bio.SeqIO function, with a name like parse1() or
>>> parse_sole() etc which would return a single SeqRecord - and raise
>>> an error if the handle didn't contain one and only one record.  We
>>> could call this function read() if you prefer.
>>>
>> I'd prefer read() instead of parse1(), parse_sole() etc. for the
>> following reasons:
>>
>> 1) Having two names that are clearly different emphasizes the fact that
>> they return different things (parse() returns an iterator, read() a record).
>>
>> 2) Some modules deal with data that always consist of one record (for
>> example, gene expression data in case of Bio.Cluster). Such modules can
>> have a read() function but not a parse(). It would feel strange if a
>> module has a parse1() function but not a parse().
> 
> OK. I've filed an enhancement bug, which I'll mention on the main mailing list,
> http://bugzilla.open-bio.org/show_bug.cgi?id=2417
> Unless there is some negative feedback,  I'll add that functionality shortly.



More information about the Biopython mailing list