Exemple #1
0
 def calc_arvo_geo_measures(self, radius):
   """
   Calculates geometrical measures: volume, area
   
   """
   
   _temp_file = Utilities.get_random_name()
   _temp_file = "temp"
   
   # TODO: Need a way set the surface radius for a each atom. Probably add it as 
   #       as a new column in the atoms.in file.
   
   # prepare a temporary file
   self._writeATS(_temp_file, radius)
   
   command = "%s protein=%s" % ("/Users/Tomas/git/Analysis-Toolkit/thirdparty/arvo_c/arvo_c", _temp_file)
   output, stderr, status = Utilities.run_sub_process(command)
       
   # if the execution of the was successful:
   if not status:
     
     output_array = output.split()
     
     self.arvo_calc = True
     self.arvo_volume = np.float64(output_array[1])
     self.arvo_area = np.float64(output_array[3])
     self.arvo_spheres = np.int16(output_array[6])
 
   os.unlink(_temp_file)
 def getSymmetry(self, clusterO):
   """
   Evaluates the symmetry (point group) of a cluster.
   
   """
   
   success = True
   error = ""
   symmetry = ""
   
   if not self._globJVMOn:
     success = False
     error = "JVM is has not been initialized"
     
     return success, error, symmetry
   
   # Saves a cluster in to an xyz file.
   cwd = os.getcwd()
   tempClusterFile = "%s/%s.xyz" % (cwd, Utilities.get_random_name(10))
   
   success, error = IO.writeXYZ(clusterO, tempClusterFile, scfDone=False)
   
   if not success:
     return success, error, symmetry
   
   # Runs the symmetrizer to get the point group
   try:
     self._globJVMSymm.main(["-v", _verbose, "-t", _tolerance, tempClusterFile])
     
   except:
     #TODO: catch the Symmetrizer error
     success = False
     error = "error while running Symmetrizer"
      
     return success, error, symmetry
   
   IO.removeFile(tempClusterFile)
   
   #TODO: In future this should be done via streams
   success, error, symmetry = _getSymmetryFromFile(self._globJVMOutPath, self._globJVMErrPath)
   
   self._clearJVMOutputFiles()
   
   return  success, error, symmetry   
 def __init__(self, options=None, args=None, standAlone=True):
   """
   Constructor
   """
   
   self.cwd = os.getcwd()
   
   self._globJVMOn = False
   self._globJVMSymm = None
   
   randomName = Utilities.get_random_name(8)
   
   self._globJVMOutPath =  os.path.join(self.cwd, "jvm%s.out" % (randomName))
   self._globJVMErrPath =  os.path.join(self.cwd, "jvm%s.err" % (randomName))
   
   self._options = options
   self._args = args
   
   self._input = None
   
   self.__startJVM()