Re: Python Help!!!
Elfine Peterson Tjio wrote: > I'm trying to make a program that reads Fasta file and print it out. I used > the SeqIO module and the results is: > > 'ATGGTCATSingleAlphabet()' > > For this purpose, should I use SeqIO or Fasta? > > for example: > > from Bio import SeqIO > > or > > from Bio import Fasta > > I want it to print every letter. Can anyone point me to the right direction. > The newest biopython tutorial or book recommendation will be appreciated, > too. Dear Elfine: The correct place for such a question is the BioPython discussion list at [EMAIL PROTECTED] You can subscribe to it here: http://lists.open-bio.org/mailman/listinfo/biopython/ The newest BioPython tutorial (last updated 16 March 2007) can be found at http://biopython.org/DIST/docs/tutorial/Tutorial.pdf SeqIO and Fasta should both work fine. You could also try >>> help(SeqIO) >>> help(Fasta) after your import for some further information. Cheers, Christof -- http://mail.python.org/mailman/listinfo/python-list
Re: Method much slower than function?
Gabriel Genellina wrote: [...] > py> import timeit > py> > py> def f1(): > ... a="" > ... for i in xrange(10): > ... a+=str(i)*20 > ... > py> def f2(): > ... a=[] > ... for i in xrange(10): > ... a.append(str(i)*20) > ... a="".join(a) > ... > py> print timeit.Timer("f2()", "from __main__ import f2").repeat(number=1) > [0.42673663831576358, 0.42807591467630662, 0.44401481193838876] > py> print timeit.Timer("f1()", "from __main__ import f1").repeat(number=1) > > ...after a few minutes I aborted the process... > Using Python 2.4.4 (#2, Jan 13 2007, 17:50:26) [GCC 4.1.2 20061115 (prerelease) (Debian 4.1.1-21)] on linux2 f1() and f2() also virtually take the same amount of time, although I must admit that this is quite different from what I expected. Cheers, Christof -- http://mail.python.org/mailman/listinfo/python-list
Re: Want to learn Python
Amol wrote: > Hi, I want to learn Python in less than a month which resources should > I use. I prefer to read books . Please give me a list of *recognized* > resources. Thank You all This is an excellent resource: http://rgruet.free.fr/PQR24/PQR2.4.html Although it's quite different from a book, I must admit. Cheers, Christof -- http://mail.python.org/mailman/listinfo/python-list
Re: How to optimise this code?
David N Montgomery wrote: > class testCase: > def __init__(self, tc): > if tc == 1:self.testCase1() > if tc == 2:self.testCase2() > if tc == 3:self.testCase3() > if tc == 4:self.testCase4() > if tc == 5:self.testCase5() > if tc == 6:self.testCase6() > > def testCase1(self): > print "tc1" > > def testCase2(self): > print "tc2" > > def testCase3(self): > print "tc3" > > def testCase4(self): > print "tc4" > > def testCase5(self): > print "tc5" > > def testCase6(self): > print "tc6" > > > def testCaseX(self): > print "tcX" > > totalNumberOfTestCases = 6 > x = 0 > while x <= totalNumberOfTestCases: > x += 1 > testCase(x) > > > This template code is working, but I envisage having 100+ test cases and > am concerned about my useage of if statements. I would be grateful for > any pointers as to how I can run all tests cases, regardless of how > many, in a more efficient manner. > > Thank you in advance. To get rid of the if statements, replace __init__ function with: def __init__(self, tc): functionToCall = eval("self.testCase%s" % tc) functionToCall() HTH, Chris -- http://mail.python.org/mailman/listinfo/python-list
Re: 2 python questions!
[EMAIL PROTECTED] wrote: [...] > Now the second question has to do with images retrieval and > manipulation. Which libraries do you propose to work with to > retrieve and resize images from the web? urllib.urlretrieve() and Python Imaging Library (PIL) -- http://mail.python.org/mailman/listinfo/python-list
Re: list (range) syntax
Ryan Ginstrom wrote: >> On Behalf Of Steven D'Aprano >> Because in common English, counting starts at 1 and ranges >> normally include both end points (that is, it is a "closed" >> interval). If you say "I'll be away from the 4th to the 7th" >> and then turn up on the 7th, nearly everyone will wonder why >> you're back a day early. > > Actually, I think this illustrates the point about confusion, because in the > United States at least, "the 4th to the 7th" will not necessarily include > the 7th. That's why it's common to use circumlocutions like "the 4th through > the 7th" and "the 4th to the 7th, inclusive" when one wants to be sure. [slightly OT] A better example would be "10 to 12 people", which translates to "10, 11, or 12 people" and hardly ever "10 or 11 people". -- http://mail.python.org/mailman/listinfo/python-list
SOAPpy WSDL problem: namespace of schema and import match error
I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl"; intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) The resulting error message is posted below. If I understand it right, XMLSchema.py complains about the imported XSD namespace being the same as the existing targetNamespace. Perl and Java have no problems with the WSDL document (see sample code at http://www.ebi.ac.uk/~intact/devsite/remote/binarysearch_ws.html) My question: - Is there a problem with the WSDL file being not valid? - Is there a problem with the Python SOAP/WSDL implementation? Any suggestions? Christof Traceback (most recent call last): File "testEBIIntactWebservice.py", line 3, in intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) File "/var/lib/python-support/python2.5/SOAPpy/WSDL.py", line 62, in __init__ self.wsdl = reader.loadFromStream(stream, wsdlsource) File "/var/lib/python-support/python2.5/SOAPpy/wstools/WSDLTools.py", line 34, in loadFromStream wsdl.load(document) File "/var/lib/python-support/python2.5/SOAPpy/wstools/WSDLTools.py", line 260, in load schema = reader.loadFromNode(WSDLToolsAdapter(self), item) File "/var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py", line 80, in loadFromNode schema.load(reader) File "/var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py", line 1076, in load tp.fromDom(node) File "/var/lib/python-support/python2.5/SOAPpy/wstools/XMLSchema.py", line 1177, in fromDom raise SchemaError, 'namespace of schema and import match' SOAPpy.wstools.XMLSchema.SchemaError: namespace of schema and import match -- http://mail.python.org/mailman/listinfo/python-list
Re: SOAPpy WSDL problem: namespace of schema and import match error
Christof Winter wrote, On 28.07.2008 12:32: I am trying to use a webservice with SOAPpy: import SOAPpy intact_wsdl = "http://www.ebi.ac.uk/intact/binary-search-ws/binarysearch?wsdl"; intact_serv = SOAPpy.WSDL.Proxy(intact_wsdl) [...] My question: - Is there a problem with the WSDL file being not valid? I just figured out that this could indeed be true. The WSDL document contains an XML Schema import that probably should be an XML Schema include: "The import element is used to add multiple schemas with different target namespace to a document." http://www.w3schools.com/schema/el_import.asp "The include element is used to add multiple schemas with the same target namespace to a document." http://www.w3schools.com/schema/el_include.asp Maybe I should post this to comp.text.xml Christof -- http://mail.python.org/mailman/listinfo/python-list