Re: [Tutor] green brackets?

2007-07-11 Thread Paulo Nuin
Hi

f.write(n\) should be

f.write(\n)

Paulo

elis aeris wrote:
 def mousemove(x,y):
 f.write(n\)
 f.write(command +  = +  mousemove\n)
 f.write(parameter_1 =  + str(x) + \n)
 f.write(parameter_2 =  + str(y) + \n)
 f.write(n\)





 for some reason that last bracket of the 2nd and last line line in 
 IDLE  are green.\
 why is that?
 

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Finding all locations of a sequence

2007-06-14 Thread Paulo Nuin
Hi Lauren

I use the find string method to search DNA motifs. Here is an example

while sp  len(fasta[j].sequence):
pos = string.find(fasta[j].sequence, 
motif[i], sp)
if pos != -1 and pos  0:
plist.append(int(size) - pos)
mlist.append(toprint)
sp = pos
else:
sp = len(fasta[j].sequence)-1
sp+=1
pos = 0
sp = 0

You might even be able to trim a bit this code, but it is a start.

HTH

Paulo



Lauren wrote:
 Ok, what I have is a RNA sequence (about 5 million nucleotides
 [characters] long) and have (4100) subsequences (from another
 sequence) and the sub-sequences are 6 characters long, that I want to
 find in it.
 The problem is the exceptional bond of U:G, which results in U bonding
 to A (as per normal) and G (the abnormal bond) and G to bond with C
 (as per normal) and U. Normally I'd go to search software already
 available, however what I need done isn't covered b y anything out
 there so far. That and I believe that they do not deal with the
 exceptional bond. In any event, I want to know where the subsequences
 can bind in the larger RNA sequence (ie, the location of binding in
 the larger sequence) so I'm not (just) for where they would bind
 normally, but also where the abnormal bonds would figure in.
 Unfortunately my first attempt at this was unbearably slow, so I'm
 hoping there is a faster way.

 So an example with this would be:

 Subseq  AU can bind to UA (which is normal) and UG (not so
 normal) and I want to know where UA, and UG are in the large
 RNA sequence, and the locations to show up as one...thing.

 I don't know if that is more helpful or not than the chicken example...

 Thanks again for the help


 On 14/06/07, Teresa Stanton [EMAIL PROTECTED] wrote:
   
 OK, I'm going to take a shot at this.  If what I'm understanding is correct,
 a dictionary might help.  But that would depend on the format of the
 original sequence.  If you have a list:

 Lst1 = ['cow', 'pig', 'chicken', 'poultry', 'beef', 'pork']

 Then you could:

 Lst1.index('chicken')

 And get 2, because the list starts with 0,  not 1, as the first index.

 Or this:

 
 for i in Lst1:
   
 if i == 'chicken':
 print Lst1.index(i)
 if i == 'poultry':
 print Lst1.index(i)


 2
 3

 Now, Kent or Alan and perhaps others will have a much more sophisticated way
 of doing this same problem.  I'm still not exactly sure what it is you are
 looking for, because there isn't enough information for me to really get a
 grasp on your problem. My response is a simple list structure that has
 simple operations.

 Hope it helps :)

 T

 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
 Of Lauren
 Sent: Thursday, June 14, 2007 11:35 AM
 To: tutor@python.org
 Subject: [Tutor] Finding all locations of a sequence

 Ok, please bear with me, I'm very new to programming and python. And
 my question is rather...convoluted.

 I have a bunch of sequences (about 4100 or so), and want to know where
 they are in a very, very large string of letters. But wait, there's
 more. Some of these sequences match to more than 'word' (for
 example...to be consistent with later, chicken could match to poultry
 or chicken).

 example of what I want to do (on a much smaller scale):

 Say I have chicken and I want to know where it occurs in a string of
 words, but I want it to match to both chicken and poultry and have the
 output of:

 chicken  (locations of chicken and poultry in the string)

 or something like that.

 The string I'm dealing with is really large, so whatever will get
 through it the fastest is ideal for me.

 I hope this all makes sense...

 If it's possible to have pseudocode that would be helpful.
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor




 


   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Multi-line comments?

2007-06-06 Thread Paulo Nuin
Hi Brad

Use something like this

'''your
comments
here'''

Three single quotes will do it.

HTH

Paulo

Brad Tompkins wrote:
 Hello everyone,

 This may seem like a pretty basic question but it's driving me crazy.

 Is there a way to make use of multi-line comments when programming 
 using python?  Having to stick a # in front of every line gets pretty 
 tedious when I want to make a comment more detailed than I normally 
 would.

 If there isn't a way, can someone recommend a text editor (I know 
 emacs and probably vi can do this, but they seem difficult to use) 
 that will comment out blocks of text automatically for me?

 Thanks,

 Brad
 

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] i++

2007-06-05 Thread Paulo Nuin
Hi

You can use

i += 1
or
i -=1

HTH

Paulo


scott wrote:
 Hi,

   is there any way in Python to simply add or subtract one from a 
 variable like i++ or i--?  I don't mind doing a i = i + 1, but would 
 prefer something more simple and faster.

   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] (no subject)

2007-05-18 Thread Paulo Nuin
Hi Richard

Have you try running it with Python in front of the script name? Such as:

python my_script.py

Usually on Windows command prompt, if Python is not on your path you 
have to enter the whole path to it, something like C:\Python25\python.

HTH

Paulo

Richard Henderson wrote:
 Hello,
 I am a rank beginner, as I'm sure my question will show. After I enter 
 and save  a script using Notepad, it is not recognized by DOS and will 
 not run. What might I be doing wrong. I am using PythonWin  and 
 Windows XP.
 Thanks,
 Richard

 
 Moody friends. Drama queens. Your life? Nope! - their life, your story.
 Play Sims Stories at Yahoo! Games. 
 http://us.rd.yahoo.com/evt=48224/*http://sims.yahoo.com/
 

 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
   

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Queueing

2007-05-10 Thread Paulo Nuin
Hi

Thanks a lot Alan and Kent for the replies.

Cheers

Paulo

Kent Johnson wrote:
 Paulo Nuin wrote:
 Hi Everyone

 I need to a write a script that would do a queuing job on a cluster 
 running openMosix Linux. I have checked the Queue module and that 
 part I can say it is covered. My problem regards on thecode to check 
 if the process has ended. As some most of the jobs would be run in 
 different nodes I am having difficulties getting some example code to 
 accomplish that.

 I don't think the Queue module will help you with multi-processing, it 
 is useful for inter-thread communication within a single process.

 There are several Python packages that help with multi-processing; one 
 is here:
 http://www.parallelpython.com/

 and others are referenced in the Links section of the above site. Also
 http://www.python.org/pypi?%3Aaction=searchterm=parallelsubmit=search

 HTH
 Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Queueing

2007-05-09 Thread Paulo Nuin
Hi Everyone

I need to a write a script that would do a queuing job on a cluster 
running openMosix Linux. I have checked the Queue module and that part I 
can say it is covered. My problem regards on thecode to check if the 
process has ended. As some most of the jobs would be run in different 
nodes I am having difficulties getting some example code to accomplish that.

Thanks a lot for any helpful advice.

Cheers

Paulo
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor