|
Re: [BioPython] regular expression and filtering dna strings: msg#00014python.bio.general
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi Enrico, If your DNA strings never contain anything other than ACGT, then a result other than 'None' for re.search('[^ACGT]', your_string) will be diagnostic for non-DNA sequences. A None result will not, however, be diagnostic for DNA... Python 2.3.2 (#1, Dec 12 2003, 11:27:04) [GCC 3.3.2 20031022 (Red Hat Linux 3.3.2-1)] on linux2 Type "help", "copyright", "credits" or "license" for more information. |>> import re |>> a = 'ACGTGTACGT' |>> b = 'ACAGFTAGAT' |>> re.search('[^ACGT]', a) |>> print re.search('[^ACGT]', a) None |>> print re.search('[^ACGT]', b) <_sre.SRE_Match object at 0xbf511368> HTH, enrico curiotto wrote: | Hello everybody, | I have the following problem: | A have a series of strings, some of them are DNA strings (so they | contain only ACGT), other not. | How can I filter out not DNA strings? | Maybe this can be properly done quickly with regular expression | in python, without using biopython. | Does anyone know how to do that with regular expression ? | Thank you very much, | Enrico. | | | | | | _______________________________ | Do you Yahoo!? | Declare Yourself - Register online to vote today! | http://vote.yahoo.com | _______________________________________________ | BioPython mailing list - BioPython@xxxxxxxxxxxxx | http://biopython.org/mailman/listinfo/biopython | | - -- Dr Leighton Pritchard AMRSC D104, PPI, Scottish Crop Research Institute Invergowrie, Dundee, DD2 5DA, Scotland, UK E: lpritc@xxxxxxxxxxxxxxx W: http://bioinf.scri.sari.ac.uk/lp/index.shtml T: +44 (0)1382 562731 ext.2405 F: +44 (0)1382 568578 PGP key FEFC205C: GPG key E58BA41B: http://www.keyserver.net -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBa8bhL1gZ+OWLpBsRAneTAJ9TFvjonzps8zDaCxZxbQe+iyNFygCfcjzO PxYU8Q+zAFZkVl62lakWd24= =5tI1 -----END PGP SIGNATURE----- _______________________________________________ BioPython mailing list - BioPython@xxxxxxxxxxxxx http://biopython.org/mailman/listinfo/biopython |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | [BioPython] regular expression and filtering dna strings: 00014, enrico curiotto |
|---|---|
| Next by Date: | [BioPython] Software for Search-Engine, Mail, DNS, and more: 00014, guo198010 |
| Previous by Thread: | [BioPython] regular expression and filtering dna stringsi: 00014, enrico curiotto |
| Next by Thread: | [BioPython] Software for Search-Engine, Mail, DNS, and more: 00014, guo198010 |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |