Python - To find region between start.start and end.start

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vivek srinivas
    New Member
    • Dec 2011
    • 1

    Python - To find region between start.start and end.start

    for my code

    Code:
    for orf in [mydna[start.start():end.start()+3] for start in re.finditer('(?=ATG)',mydna
               for end in re.finditer('(?=TAA|TAG|TGA)',mydna if end.start()>start.start() and (end.end()-start.start())%3 == 0]:
            #print orf
    How to make the program stop at the first end regions .
  • Glenton
    Recognized Expert Contributor
    • Nov 2008
    • 391

    #2
    Hard to engage with this level of detail, but let me try. You probably want to add in a line like this:
    Code:
    if orf==ConditionMeaningFirstEndRegion:
        break
    The key word I suppose you're looking for is "break" which takes you out of the loop.

    Comment

    Working...