top-level loops

Stefan savall at cpcinc.ca
Wed Oct 8 17:07:25 EDT 2003


I am writing a program (code included) and I would like to comment out
the two top-level loops and run the code that is under it regularly,
however, because the following code is not indented properly the
interpreter chokes. Is there a way around this?


#!/usr/bin/env python

import string, sys, os

#for i in range(0,3):
#    for j in range(0,3):

#        filePrefix = '%d_%d' % (i,j)
#        filePrefix = sys.argv[1]
        print 'Run getQ'
        os.system('~/Programs/KineticEnsemble/GetQMod/getq.exe
/home/reza/Proteins/2ci2/2CI2.contacts ' + filePrefix + '/md\crd 1 100
1.2 ' + filePrefix + '/q.out')

        print 'Analyze getQ results'
        file=open(filePrefix + '/q.out','r')

        fold=0.
        ufold=0.
        isOpen=1
        #numRuns=0

        for line in file.readlines():
            if line != '#NEWFILE\n':
                #       if open:
                #            numRuns += 1
                if string.atof(line[:-1]) < 0.15 and isOpen:
                    isOpen = 0
                    ufold+=1.
                elif string.atof(line[:-1]) > 0.85 and isOpen:
                    isOpen = 0
                    fold+=1.
            else:
                #        print numRuns
                #        numRuns = 0
                isOpen = 1

        file.close()

        print filePrefix
        print '\tpFold: %f' % ( fold/(ufold+fold))
        print '\tfold: %d ufold: %d' % (fold,ufold)




More information about the Python-list mailing list