PEATSA/Core/Programs.py
def scan(self, mutantCollection, verbose=False, printList=True):
	
		'''Performs a scan for each mutation specified in data
		
		Parameters: 
			mutantCollection - MutantCollection containing the mutants to be scanned
			verbose - True if more verbose output is required. False by default.
			printList - Outputs a list of all the mutations being scanned if True.	
				
		Returns:
			Nothing.
			
			To access the scan results use the scanResults method
			
		Exceptions:
			AttributeError is raised if no pdb or ionisable residues have been provided.
			Exceptions.MissingPKADataError is raised if the working directory is missing required data.
			Exceptions.ScanError is raised if the scan can't be performed for any other reason.'''
	
		if len(mutantCollection.mutations()) == 0:
			raise Exceptions.ArgumentError, "No mutations supplied"
		
		self.environment.output('[SCAN] Ionisable residues - %s' % " ".join(self.ionisableResidues))
		self.mutantCollection = mutantCollection
		data = self.mutantCollection.mutations()
		if verbose is True:
			self.environment.output('[SCAN] Scanning the following mutations - ')	
			for element in data:
				self.environment.output('%s' % (element.__str__()))
				
		#Setup the workding directory
		#This will check to see if the necessary files are present
		#and subsequently set up the directory so the scan process uses the files in the mutantCollection.
		#This method will raise an Exceptions.MissingPKADataError if the first requirement is not satisfied.
		#First make sure we are in the working directory
		os.chdir(self.workingDirectory.path())
		self.workingDirectory.setupScan(pdbName=self.pdbName, mutantCollection=self.mutantCollection)
		
		#Redirect to scan output to file
		self.scanLogFile = os.path.join(self.outputDirectory, '%s_Scan%d.log' % (os.path.splitext(self.pdbName)[0], self.environment.rank()))
		self.environment.output('\n[SCAN] Scan output redirected to file Scan.log ...')
		self.environment.output('[SCAN] Reading necessary scan information')
						
		standardOut = sys.stdout
		scanLogStream = open(self.scanLogFile, 'w')
		sys.stdout = scanLogStream
		
		#Each element of data is a (ResidueCode, MutationList) pair.
		#Make each mutation in mutationList and scan the effect of the mutation on each ionisable residue
		results = []

		#Split the tasks across the nodes
		taskArray = self.environment.splitArray(data)
		codes = [el.codeString(self.pdb) for el in data]
		info = (self.environment.rank(), self.environment.processorName(), " ".join(codes))
		self.environment.log(
			'\n[SCAN] (%d on %s) Mutations %s\n' % info)

		while len(taskArray) != 0:
			#Process the tasks - If the loadSkew exceeds the threshold this 
			#method will return an array of the uncompleted tasks
			taskArray = self._processTasks(taskArray, results, standardOut, scanLogStream, verbose, checkInterval=5, skewThreshold=1.0)
			self.environment.output('[SCAN] (%d) Rebalancing load ...' % self.environment.rank())
			#Re-distributed the remaining tasks across the nodes - this should be asynchronous somehow
			#taskArray = self.environment.balanceArrays(taskArray)
			self.environment.output('[SCAN] (%d) Continuing with %d tasks'% (self.environment.rank(), len(taskArray)))

		#This is required in order to catch if any the processes exited the 
		#above loop due to an exception	
		self.environment.wait()	
		results = self.environment.combineArray(results)
	
		#Store the results in a matrix
		headers = ['Mutations']
		headers.extend(self.ionisableResidues)
		self.resultsMatrix = Matrix.Matrix(rows=results, 
					headers=headers)
		
		#Redirect log back to stdout
		scanLogStream.close()
		sys.stdout = standardOut
		sys.stdout.flush()
		
		self.workingDirectory.cleanUpScan()
		self.environment.output('\n[SCAN] Scan completed.')
Performs a scan for each mutation specified in data
		
		Parameters: 
			mutantCollection - MutantCollection containing the mutants to be scanned
			verbose - True if more verbose output is required. False by default.
			printList - Outputs a list of all the mutations being scanned if True.	
				
		Returns:
			Nothing.
			
			To access the scan results use the scanResults method
			
		Exceptions:
			AttributeError is raised if no pdb or ionisable residues have been provided.
			Exceptions.MissingPKADataError is raised if the working directory is missing required data.
			Exceptions.ScanError is raised if the scan can't be performed for any other reason.
Performs a scan for each mutation specified in data
Parameters:
mutantCollection - MutantCollection containing the mutants to be scanned
verbose - True if more verbose output is required. False by default.
printList - Outputs a list of all the mutations being scanned if True.

Nothing.

To access the scan results use the scanResults method

AttributeError is raised if no pdb or ionisable residues have been provided.
Exceptions.MissingPKADataError is raised if the working directory is missing required data.
Exceptions.ScanError is raised if the scan can't be performed for any other reason.
Performs a scan for each mutation specified in data Parameters : mutantCollection - MutantCollection containing the mutants to be scanned verbose - True if more verbose output is required . False by default . printList - Outputs a list of all the mutations being scanned if True . Nothing . To access the scan results use the scanResults method AttributeError is raised if no pdb or ionisable residues have been provided . Exceptions . MissingPKADataError is raised if the working directory is missing required data . Exceptions . ScanError is raised if the scan can ' t be performed for any other reason .
def scan(self, mutantCollection, verbose=False, printList=True):
		if len(mutantCollection.mutations()) == 0:
			raise Exceptions.ArgumentError, "No mutations supplied"
		self.environment.output('[SCAN] Ionisable residues - %s' % " ".join(self.ionisableResidues))
		self.mutantCollection = mutantCollection
		data = self.mutantCollection.mutations()
		if verbose is True:
			self.environment.output('[SCAN] Scanning the following mutations - ')	
			for element in data:
				self.environment.output('%s' % (element.__str__()))
		os.chdir(self.workingDirectory.path())
		self.workingDirectory.setupScan(pdbName=self.pdbName, mutantCollection=self.mutantCollection)
		self.scanLogFile = os.path.join(self.outputDirectory, '%s_Scan%d.log' % (os.path.splitext(self.pdbName)[0], self.environment.rank()))
		self.environment.output('\n[SCAN] Scan output redirected to file Scan.log ...')
		self.environment.output('[SCAN] Reading necessary scan information')
		standardOut = sys.stdout
		scanLogStream = open(self.scanLogFile, 'w')
		sys.stdout = scanLogStream
		results = []
		taskArray = self.environment.splitArray(data)
		codes = [el.codeString(self.pdb) for el in data]
		info = (self.environment.rank(), self.environment.processorName(), " ".join(codes))
		self.environment.log(
			'\n[SCAN] (%d on %s) Mutations %s\n' % info)
		while len(taskArray) != 0:
			taskArray = self._processTasks(taskArray, results, standardOut, scanLogStream, verbose, checkInterval=5, skewThreshold=1.0)
			self.environment.output('[SCAN] (%d) Rebalancing load ...' % self.environment.rank())
			self.environment.output('[SCAN] (%d) Continuing with %d tasks'% (self.environment.rank(), len(taskArray)))
		self.environment.wait()	
		results = self.environment.combineArray(results)
		headers = ['Mutations']
		headers.extend(self.ionisableResidues)
		self.resultsMatrix = Matrix.Matrix(rows=results, 
					headers=headers)
		scanLogStream.close()
		sys.stdout = standardOut
		sys.stdout.flush()
		self.workingDirectory.cleanUpScan()
		self.environment.output('\n[SCAN] Scan completed.')
def scan ( self , mutantCollection , verbose = False , printList = True ) : if len ( mutantCollection . mutations ( ) ) == 0 : raise Exceptions . ArgumentError , "No mutations supplied" self . environment . output ( '[SCAN] Ionisable residues - %s' % " " . join ( self . ionisableResidues ) ) self . mutantCollection = mutantCollection data = self . mutantCollection . mutations ( ) if verbose is True : self . environment . output ( '[SCAN] Scanning the following mutations - ' ) for element in data : self . environment . output ( '%s' % ( element . __str__ ( ) ) ) os . chdir ( self . workingDirectory . path ( ) ) self . workingDirectory . setupScan ( pdbName = self . pdbName , mutantCollection = self . mutantCollection ) self . scanLogFile = os . path . join ( self . outputDirectory , '%s_Scan%d.log' % ( os . path . splitext ( self . pdbName ) [ 0 ] , self . environment . rank ( ) ) ) self . environment . output ( '\n[SCAN] Scan output redirected to file Scan.log ...' ) self . environment . output ( '[SCAN] Reading necessary scan information' ) standardOut = sys . stdout scanLogStream = open ( self . scanLogFile , 'w' ) sys . stdout = scanLogStream results = [ ] taskArray = self . environment . splitArray ( data ) codes = [ el . codeString ( self . pdb ) for el in data ] info = ( self . environment . rank ( ) , self . environment . processorName ( ) , " " . join ( codes ) ) self . environment . log ( '\n[SCAN] (%d on %s) Mutations %s\n' % info ) while len ( taskArray ) != 0 : taskArray = self . _processTasks ( taskArray , results , standardOut , scanLogStream , verbose , checkInterval = 5 , skewThreshold = 1.0 ) self . environment . output ( '[SCAN] (%d) Rebalancing load ...' % self . environment . rank ( ) ) self . environment . output ( '[SCAN] (%d) Continuing with %d tasks' % ( self . environment . rank ( ) , len ( taskArray ) ) ) self . environment . wait ( ) results = self . environment . combineArray ( results ) headers = [ 'Mutations' ] headers . extend ( self . ionisableResidues ) self . resultsMatrix = Matrix . Matrix ( rows = results , headers = headers ) scanLogStream . close ( ) sys . stdout = standardOut sys . stdout . flush ( ) self . workingDirectory . cleanUpScan ( ) self . environment . output ( '\n[SCAN] Scan completed.' )
Performs a scan for each mutation specified in data
Parameters:
mutantCollection - MutantCollection containing the mutants to be scanned
verbose - True if more verbose output is required.
Performs a scan for each mutation specified in data Parameters : mutantCollection - MutantCollection containing the mutants to be scanned verbose - True if more verbose output is required .
'''Performs a scan for each mutation specified in data
		
		Parameters: 
			mutantCollection - MutantCollection containing the mutants to be scanned
			verbose - True if more verbose output is required. False by default.
			printList - Outputs a list of all the mutations being scanned if True.	
				
		Returns:
			Nothing.
			
			To access the scan results use the scanResults method
			
		Exceptions:
			AttributeError is raised if no pdb or ionisable residues have been provided.
			Exceptions.MissingPKADataError is raised if the working directory is missing required data.
			Exceptions.ScanError is raised if the scan can't be performed for any other reason.''' #Setup the workding directory #This will check to see if the necessary files are present #and subsequently set up the directory so the scan process uses the files in the mutantCollection. #This method will raise an Exceptions.MissingPKADataError if the first requirement is not satisfied. #First make sure we are in the working directory #Redirect to scan output to file #Each element of data is a (ResidueCode, MutationList) pair. #Make each mutation in mutationList and scan the effect of the mutation on each ionisable residue #Split the tasks across the nodes #Process the tasks - If the loadSkew exceeds the threshold this  #method will return an array of the uncompleted tasks #Re-distributed the remaining tasks across the nodes - this should be asynchronous somehow #taskArray = self.environment.balanceArrays(taskArray) #This is required in order to catch if any the processes exited the  #above loop due to an exception	 #Store the results in a matrix #Redirect log back to stdout
self
mutantCollection
verbose
printList