[BioPython] More string methods for the Seq object
Leighton Pritchard
lpritc at scri.ac.uk
Mon Sep 29 12:15:11 UTC 2008
+1 for following the Python default.
A less straightforward implementation might use a knowledge of the Alphabet
for the Seq to strip out non-Alphabet characters, such as gaps, but I think
that this, along with (a) and (c), would be overkill. I like the principle
of least surprise in this case.
On 29/09/2008 12:50, "Peter" <biopython at maubp.freeserve.co.uk> wrote:
>>> No one has objected to adding strip and split (plus lstrip and rstrip)
>>> so if we take that as a consensus, the only point we should still
>>> debate is their default arguments. Other alternatives to what I have
>>> already put forward include following the python string and defaulting
>>> to white space (which would never normally be present in a sequence),
>>> or making the arguments non optional.
>
> Listing out those explicitly, for the poposed Seq object methods:
> (a) strip, lstrip and rstrip default to the gap character. split
> argument is mandatory.
> (b) strip, lstrip, rstrip and split all default to white space
> (following string default)
> (c) strip, lstrip, rstrip and split all have a mandatory argument
> (explicit better than implicit)
>
>> I do agree especially in terms of attempting to keep the standard
>> Python defaults and behavior.
>
> I assume you are agreeing with what I have now called (b), follow the
> string defaults of white space for stipping or splitting (for
> consistency, even though this won't typically be useful for
> sequences). On balance this would probably be best from a principle
> of consistency and least surprise for the user - I'll update the
> patches.
>
> Peter
--
Dr Leighton Pritchard MRSC
D131, Plant Pathology Programme, SCRI
Errol Road, Invergowrie, Perth and Kinross, Scotland, DD2 5DA
e:lpritc at scri.ac.uk w:http://www.scri.ac.uk/staff/leightonpritchard
gpg/pgp: 0xFEFC205C tel:+44(0)1382 562731 x2405
______________________________________________________________________
SCRI, Invergowrie, Dundee, DD2 5DA.
The Scottish Crop Research Institute is a charitable company limited by
guarantee.
Registered in Scotland No: SC 29367.
Recognised by the Inland Revenue as a Scottish Charity No: SC 006662.
DISCLAIMER:
This email is from the Scottish Crop Research Institute, but the views
expressed by the sender are not necessarily the views of SCRI and its
subsidiaries. This email and any files transmitted with it are
confidential
to the intended recipient at the e-mail address to which it has been
addressed. It may not be disclosed or used by any other than that
addressee.
If you are not the intended recipient you are requested to preserve this
confidentiality and you must not use, disclose, copy, print or rely on
this
e-mail in any way. Please notify postmaster at scri.ac.uk quoting the
name of the sender and delete the email from your system.
Although SCRI has taken reasonable precautions to ensure no viruses are
present in this email, neither the Institute nor the sender accepts any
responsibility for any viruses, and it is your responsibility to scan
the email and the attachments (if any).
______________________________________________________________________
More information about the Biopython
mailing list