PEATSA/Core/Data.py
def _createDirectories(self, pdbFile, ligandFiles):
	
		'''Does all the necessary directory creation for the instance'''
		
		#Check if the output directory already exits
		#If it does and self.overwrite is True delete it
		if os.path.isdir(self.location):
			if self.overwrite is True and self.environment.isRoot():
				self.environment.output('[MUTATE] Warning - Removing previously existing directory at %s' % self.location)
				shutil.rmtree(self.path(), ignore_errors=1, onerror=self._removeErrorHandler)
			else:
				raise  Exceptions.MutantCollectionError, 'Unable to create output directory for mutant collection - Directory already exists'
		
		#Create the collection directory and sub-directories
		try:
			os.mkdir(self.location)
			os.mkdir(os.path.join(self.location, 'Mutants'))
			os.mkdir(os.path.join(self.location, 'Ligands'))
		except BaseException, data:
			self.isTemporary = True
			raise  Exceptions.MutantCollectionError, 'Unable to create output directory for mutant collection\nReason - %s' % data
				
		#Copy original file to the collection directory
		try:
			basename = os.path.basename(pdbFile)
			destination = os.path.join(self.location, basename)
			shutil.copyfile(pdbFile, destination)
		except BaseException, data:
			#Make self temporary so on dealloc the directory will be deleted
			self.isTemporary = True
			raise Exceptions.MutantCollectionError, 'Unable to copy pdb file to collection location'
		
		if ligandFiles is not None:
			for file in ligandFiles:
				try:
					basename = os.path.basename(file)
					destination = os.path.join(self.location, 'Ligands')
					destination = os.path.join(destination, basename)
					shutil.copyfile(file, destination)
				except BaseException, data:
					self.isTemporary = True
					string = 'Unable to copy ligand file at %s to collection location' % file
					raise Exceptions.MutantCollectionError, string
Does all the necessary directory creation for the instance
Does all the necessary directory creation for the instance
Does all the necessary directory creation for the instance
def _createDirectories(self, pdbFile, ligandFiles):
		if os.path.isdir(self.location):
			if self.overwrite is True and self.environment.isRoot():
				self.environment.output('[MUTATE] Warning - Removing previously existing directory at %s' % self.location)
				shutil.rmtree(self.path(), ignore_errors=1, onerror=self._removeErrorHandler)
			else:
				raise  Exceptions.MutantCollectionError, 'Unable to create output directory for mutant collection - Directory already exists'
		try:
			os.mkdir(self.location)
			os.mkdir(os.path.join(self.location, 'Mutants'))
			os.mkdir(os.path.join(self.location, 'Ligands'))
		except BaseException, data:
			self.isTemporary = True
			raise  Exceptions.MutantCollectionError, 'Unable to create output directory for mutant collection\nReason - %s' % data
		try:
			basename = os.path.basename(pdbFile)
			destination = os.path.join(self.location, basename)
			shutil.copyfile(pdbFile, destination)
		except BaseException, data:
			self.isTemporary = True
			raise Exceptions.MutantCollectionError, 'Unable to copy pdb file to collection location'
		if ligandFiles is not None:
			for file in ligandFiles:
				try:
					basename = os.path.basename(file)
					destination = os.path.join(self.location, 'Ligands')
					destination = os.path.join(destination, basename)
					shutil.copyfile(file, destination)
				except BaseException, data:
					self.isTemporary = True
					string = 'Unable to copy ligand file at %s to collection location' % file
					raise Exceptions.MutantCollectionError, string
def _createDirectories ( self , pdbFile , ligandFiles ) : if os . path . isdir ( self . location ) : if self . overwrite is True and self . environment . isRoot ( ) : self . environment . output ( '[MUTATE] Warning - Removing previously existing directory at %s' % self . location ) shutil . rmtree ( self . path ( ) , ignore_errors = 1 , onerror = self . _removeErrorHandler ) else : raise Exceptions . MutantCollectionError , 'Unable to create output directory for mutant collection - Directory already exists' try : os . mkdir ( self . location ) os . mkdir ( os . path . join ( self . location , 'Mutants' ) ) os . mkdir ( os . path . join ( self . location , 'Ligands' ) ) except BaseException , data : self . isTemporary = True raise Exceptions . MutantCollectionError , 'Unable to create output directory for mutant collection\nReason - %s' % data try : basename = os . path . basename ( pdbFile ) destination = os . path . join ( self . location , basename ) shutil . copyfile ( pdbFile , destination ) except BaseException , data : self . isTemporary = True raise Exceptions . MutantCollectionError , 'Unable to copy pdb file to collection location' if ligandFiles is not None : for file in ligandFiles : try : basename = os . path . basename ( file ) destination = os . path . join ( self . location , 'Ligands' ) destination = os . path . join ( destination , basename ) shutil . copyfile ( file , destination ) except BaseException , data : self . isTemporary = True string = 'Unable to copy ligand file at %s to collection location' % file raise Exceptions . MutantCollectionError , string
Does all the necessary directory creation for the instance
Does all the necessary directory creation for the instance
'''Does all the necessary directory creation for the instance''' #Check if the output directory already exits #If it does and self.overwrite is True delete it #Create the collection directory and sub-directories #Copy original file to the collection directory #Make self temporary so on dealloc the directory will be deleted
self
pdbFile
ligandFiles