Esempio n. 1
0
    def testOverides(self):
        '''Explicit test that information in a configuration file overides default ones'''

        #Create a default instance that doesn't read the configuration file
        newConfiguration = Environment.Configuration(
            searchDefaultLocations=False, writeFile=False)
        self.assertNotEqual(newConfiguration, self.configuration)
Esempio n. 2
0
def main():
	
	'''Main function for the TDCycle program.
	
	Parses the command line and starts the jobs requested'''
	
	environment = Environment.Environment()
	
	#Read arguments
	parser = Utilities.CommandLineParser()
	parser.parseCommandLine()
	
	if parser.helpRequested() is True:
		print __doc__
		sys.exit(0)

	if parser.createConfigurationRequested() is True:				
		print 'Creating default configuration file, proteinDesignTool.conf, in the current directory'
		print 'See the programs README file for information on the options'
		Environment.Configuration(searchDefaultLocations=False, writeFile=True)
		sys.exit(0)
	
	#Create the ProteinDesignTool instance
	tool = ProteinDesignTool(parser.configurationFile(), 
			workingDirectory=parser.workingDirectory(),
			pdbFile=parser.pdbFile(), 
			outputDirectory=parser.outputDirectory())
Esempio n. 3
0
    def testCompare(self):
        '''Checks comparing configurations'''

        newConfiguration = Environment.Configuration()
        self.assertEqual(newConfiguration, self.configuration)

        #Compare to some other object

        self.assertNotEqual(None, self.configuration)
Esempio n. 4
0
    def __init__(self,
                 configurationFile,
                 workingDirectory,
                 pdbFile,
                 outputDirectory,
                 removeHeterogens=True,
                 dataName=None):
        '''Creates a new PDT instance for running calculations on pdbName.
		
		Parameters
			configurationFile - File specifying information on the type of calculations to run.
			
			workingDirectory - Where to run the jobs. If you want to use the output of previous 
			pKa calculation as the input for a scan, the workingDirectory must contain it
			
			pdbFile - The file to run the jobs on.
			
			outputDirectory - Where to output information on the calculations and the results
			
			removeHeterogens - If true any hetatoms will be removed from the PDB file
			
		The results of any calculation are accesible through the returned objects
		dataDirectory attribute which is an instance of the Data.DataSet class.'''

        self.outputDirectory = outputDirectory
        self.pdbFile = pdbFile
        self.environment = Environment.Environment()

        self.environment.output("[PEAT-SA] Beginning - %s" %
                                datetime.datetime.now().strftime('%H:%M:%S'))
        #Readin the configuration file if specified
        #Otherwise search for one in the default locations (user home & current directory)
        self.configuration = Environment.Configuration(configurationFile,
                                                       writeFile=False)

        #Create the working directory object
        self.workingDirectory = Environment.WorkingDirectory(
            location=workingDirectory, configuration=self.configuration)

        #Create a name for the data directory if none was provided.
        if dataName is None:
            dataName = os.path.split(self.pdbFile)[1]
            dataName = os.path.splitext(dataName)[0]

        #Set the pdb - This copies the pdb to the working directory and cleans it.
        #If also created the dataDirectory if requested.
        self.setPDB(pdbFile=pdbFile,
                    dataDirectoryName=dataName,
                    removeLigand=removeHeterogens)

        #These will be created when they're needed.
        #If some calculations are run on self.pdbFile before these are used
        #the file may change. Instantiating them with the unmodified file and using them
        #later may cause problems.
        self.scanner = None
        self.uffbaps = None
Esempio n. 5
0
    def testWriteToFile(self):
        '''Tests writing and reading'''

        self.configuration.writeToFile('temp')
        newConfiguration = Environment.Configuration(filename='temp')
        self.assertEqual(newConfiguration, self.configuration)
Esempio n. 6
0
    def setUp(self):
        '''Create a configuration that by default reads the test configuration file'''

        #This will read the configuration in the Test directory
        self.configuration = Environment.Configuration()
Esempio n. 7
0
    def testCompare(self):
        '''Checks comparing configurations'''

        newConfiguration = Environment.Configuration(
            searchDefaultLocations=False, writeFile=False)
        self.assertEqual(newConfiguration, self.configuration)
Esempio n. 8
0
    def setUp(self):
        '''Create a configuration that by default reads the test configuration file'''

        #This will create a configuratio WITHOUT reading the default file
        self.configuration = Environment.Configuration(
            searchDefaultLocations=False, writeFile=False)
Esempio n. 9
0
def main():
    '''Main function for the ProteinDesignTool program.
	
	Parses the command line and starts the jobs requested'''

    environment = Environment.Environment()

    #Read arguments
    parser = Utilities.CommandLineParser()
    parser.parseCommandLine()

    if parser.helpRequested() is True:
        print __doc__
        sys.exit(0)

    if parser.createConfigurationRequested() is True:
        print 'Creating default configuration file, proteinDesignTool.conf, in the current directory'
        print 'See the programs README file for information on the options'
        Environment.Configuration(searchDefaultLocations=False, writeFile=True)
        sys.exit(0)

    #Create the ProteinDesignTool instance
    tool = ProteinDesignTool(parser.configurationFile(),
                             workingDirectory=parser.workingDirectory(),
                             pdbFile=parser.pdbFile(),
                             outputDirectory=parser.outputDirectory(),
                             dataName=parser.outputName(),
                             removeHeterogens=parser.removeHeterogens())

    #Check if an initial pKa run requested
    if parser.pKa() is True:
        tool.runPKACalculation()

    #Check if a previously created MutantCollection was specified
    mutantCollection = parser.mutants()
    if mutantCollection is None:
        environment.output(
            '[PEAT-SA] No mutants available from previous run.\n')
        #Note we use the ProteinDesignTool instances pdbFile attribute.
        #This points to the cleaned pdbFile the tool operates on.
        #Therefore we must use this to generate the mutants.
        mutantCollection = CreateMutants(tool.pdbFile, tool.configuration,
                                         parser, environment)

    #Scan
    if parser.scan() is True:
        tool.runScan(mutantCollection=mutantCollection,
                     ionisableGroups=parser.ionisableGroups(),
                     verbose=parser.verbose())

    #Stability
    if parser.stability() is True:
        tool.runStabilityCalculation(
            mutantFiles=mutantCollection.mutantFiles(),
            verbose=parser.verbose())

    #Binding
    if parser.binding() is True:
        tool.runBindingCalculation(mutantFiles=mutantCollection.mutantFiles(),
                                   ligandFile=parser.ligandFile(),
                                   verbose=parser.verbose())

    if parser.modes():
        doCalculation = True
        if parser.mutationListFile() is not None:
            object = Data.MutationListFile(parser.mutationListFile())
            doCalculation = object.isSinglePointMutationFormat()

        if doCalculation:
            mutations = mutantCollection.mutations()
            residueIndexes = []
            for mutation in mutations:
                index = Utilities.ParseResidueCode(
                    mutation.residueCodes()[0])[1]
                residueIndexes.append(index)

            residueIndexes.sort()
            import Goodvibes.Main
            environment.output(
                '[MODES] Calculating the effect of %d mutations on modes.\n',
                len(residueIndexes))
            modeCalculator = Goodvibes.Main.vibration()
            results = modeCalculator.main('PEAT-SA',
                                          tool.pdbFile,
                                          residueIndexes=residueIndexes)
            print residueIndexes
        else:
            environment.output(
                '[MODES] Can only perform mode calcualtion for SPMs.\n')

    if parser.transitionPath():
        print '[PATH] Transition path calculation not implemented yet - skipping'

    tool.cleanUp()
Esempio n. 10
0
	
	pbsString = "## Autogenerated script for submitting PEAT_SA to the PBS queue\n\n" 
	pbsString = pbsString + "#PBS -l nodes=%s:ppn=%s\n" % (numberOfNodes, processorsPerNode)
	pbsString = pbsString + "#PBS -j oe\n"
	pbsString = pbsString + "#PBS -q %s\n" % queue
	pbsString = pbsString + "#PBS -d %s\n" % os.path.abspath(runDirectory)
	pbsString = pbsString + "#PBS -o %s\n" % os.path.abspath(logDirectory)
	if keep is True:
		pbsString = pbsString + "#PBS -k oe\n"
	
	pbsString = pbsString + "\nmpirun -np %d python %s\n" % (int(numberOfNodes)*int(processorsPerNode), runString)

	return pbsString

if __name__ == "__main__":

	parser = Utilities.CommandLineParser()
	parser.parseCommandLine()

	configuration = Environment.Configuration(filename=parser.configurationFile())
	pbsScript = PBSScriptFromConfiguration(configuration, sys.argv[1:])
			
	stream = open('PEATSA.pbs', 'w+')
	stream.write(pbsScript)
	stream.close()

	#Run process		
	os.system("qsub PEATSA.pbs")
	print 'Submitted job-script PEATSA.pbs'