def sim_input_filename(self, part): #write the pdb for the part that is in the NE-1 window now and set the #filename to that pdb pdbId, chunk = self.getPDBIDFromChunk(part) if pdbId is None: return None fileName = pdbId + '.pdb' dir = os.path.dirname(self.tmp_file_prefix) fileLocation = os.path.join(dir, fileName) writepdb(part, str(fileLocation)) return fileName
def sim_input_filename(self, args): """ write the pdb for the part that is in the NE-1 window now and set the filename to that pdb @param part: NE-1 part @type part: L{Part} @param args: name of the protein for which simulation should be run @type args: str @return: name of the pdb file which is going to be the starting structure for the current rosetta simulation """ # if we run rosetta from within build protein mode, then we can run # rosetta for the current protein which is args #if we are outside this mode, we can run rosetta for a selected protein #chunk, if there's one if args != "": pdbId = args for mol in self.win.assy.molecules: if mol.name == args: chunk = mol break else: #run it for the first available protein in chunklist pdbId, chunk = self.getPDBIDFromChunk() if pdbId is None: return None #input filename fileName = pdbId + '.pdb' dir = os.path.dirname(self.tmp_file_prefix) fileLocation = os.path.join(dir, fileName) #since the starting structure could be in arbitrary location in users #hard disk, we write a pdb file for the imported/inserted/fetched protein #chunk in RosettaDesignFiles directory under Nanorex writepdb(self.part, str(fileLocation), singleChunk = chunk) return fileName
def write_qutemol_pdb_file(part, filename, excludeFlags): """ Writes an NE1-QuteMolX PDB file of I{part} to I{filename}. @param part: the NE1 part. @type part: L{assembly} @param filename: the PDB filename to write @type filename: string @param excludeFlags: used to exclude certain atoms from being written to the QuteMolX PDB file. @type excludeFlags: int @see L{writepdb()} for more information about I{excludeFlags}. """ f = open(filename, "w") skyBlue = env.prefs[ backgroundGradient_prefs_key ] bgcolor = env.prefs[ backgroundColor_prefs_key ] r = int (bgcolor[0] * 255 + 0.5) g = int (bgcolor[1] * 255 + 0.5) b = int (bgcolor[2] * 255 + 0.5) TubBond1Radius = TubeRadius BASBond1Radius = \ diBALL_SigmaBondRadius * \ env.prefs[diBALL_BondCylinderRadius_prefs_key] writePDB_Header(f) # Writes our generic PDB header # Write the QuteMolX REMARKS "header". # See the following wiki page for more information about # the format of all NE1-QuteMolX REMARK records: # http://www.nanoengineer-1.net/mediawiki/index.php?title=NE1_PDB_REMARK_Records_Display_Data_Format # f.write("""\ REMARK 6 - The ";" character is used to denote non-data (explanatory) records REMARK 6 in the REMARK 7 and REMARK 8 blocks. REMARK 6 REMARK 7 REMARK 7 ;Display Data (format version 0.1.0) nanoengineer-1.com/PDB_REMARK_7 REMARK 7\n""") f.write("REMARK 7 ORIENTATION: %1.6f %1.6f %1.6f %1.6f\n" % (part.o.quat.w, part.o.quat.x, part.o.quat.y, part.o.quat.z)) f.write("REMARK 7 SCALE: %4.6f\n" % part.o.scale) f.write("REMARK 7 POINT_OF_VIEW: %6.6f %6.6f %6.6f\n" % (part.o.pov[0], part.o.pov[1], part.o.pov[2])) f.write("REMARK 7 ZOOM=%6.6f\n" % part.o.zoomFactor) if skyBlue: f.write("REMARK 7 BACKGROUND_COLOR: SkyBlue\n") else: f.write("REMARK 7 BACKGROUND_COLOR: %3d %3d %3d\n" % (r, g, b)) f.write("REMARK 7 DISPLAY_STYLE: %s\n" % properDisplayNames[part.o.displayMode]) f.write("REMARK 7 TUBES_BOND_RADIUS: %1.3f\n" % TubBond1Radius) f.write("REMARK 7 BALL_AND_STICK_BOND_RADIUS: %1.3f\n" % BASBond1Radius) # Now write the REMARK records for each chunk (chain) in the part. molNum = 1 for mol in part.molecules: if mol.hidden: # Skip hidden chunks. See docstring in writepdb() for details. # Mark 2008-02-13. continue f.write("REMARK 7 CHAIN: %s " % (molNum)) f.write(" DISPLAY_STYLE: %s " % properDisplayNames[mol.display]) if mol.color: r = int (mol.color[0] * 255 + 0.5) g = int (mol.color[1] * 255 + 0.5) b = int (mol.color[2] * 255 + 0.5) f.write(" COLOR: %3d %3d %3d " % (r, g, b)) f.write(" NAME: \"%s\"\n" % mol.name) molNum+=1 f.write("REMARK 7\n") write_art_data(f) f.close() # Write the "body" of PDB file (appending it to what we just wrote). writepdb(part, filename, mode = 'a', excludeFlags = excludeFlags)
def write_qutemol_pdb_file(part, filename, excludeFlags): """ Writes an NE1-QuteMolX PDB file of I{part} to I{filename}. @param part: the NE1 part. @type part: L{assembly} @param filename: the PDB filename to write @type filename: string @param excludeFlags: used to exclude certain atoms from being written to the QuteMolX PDB file. @type excludeFlags: int @see L{writepdb()} for more information about I{excludeFlags}. """ f = open(filename, "w") skyBlue = env.prefs[backgroundGradient_prefs_key] bgcolor = env.prefs[backgroundColor_prefs_key] r = int(bgcolor[0] * 255 + 0.5) g = int(bgcolor[1] * 255 + 0.5) b = int(bgcolor[2] * 255 + 0.5) TubBond1Radius = TubeRadius BASBond1Radius = \ diBALL_SigmaBondRadius * \ env.prefs[diBALL_BondCylinderRadius_prefs_key] writePDB_Header(f) # Writes our generic PDB header # Write the QuteMolX REMARKS "header". # See the following wiki page for more information about # the format of all NE1-QuteMolX REMARK records: # http://www.nanoengineer-1.net/mediawiki/index.php?title=NE1_PDB_REMARK_Records_Display_Data_Format # f.write("""\ REMARK 6 - The ";" character is used to denote non-data (explanatory) records REMARK 6 in the REMARK 7 and REMARK 8 blocks. REMARK 6 REMARK 7 REMARK 7 ;Display Data (format version 0.1.0) nanoengineer-1.com/PDB_REMARK_7 REMARK 7\n""") f.write("REMARK 7 ORIENTATION: %1.6f %1.6f %1.6f %1.6f\n" % (part.o.quat.w, part.o.quat.x, part.o.quat.y, part.o.quat.z)) f.write("REMARK 7 SCALE: %4.6f\n" % part.o.scale) f.write("REMARK 7 POINT_OF_VIEW: %6.6f %6.6f %6.6f\n" % (part.o.pov[0], part.o.pov[1], part.o.pov[2])) f.write("REMARK 7 ZOOM=%6.6f\n" % part.o.zoomFactor) if skyBlue: f.write("REMARK 7 BACKGROUND_COLOR: SkyBlue\n") else: f.write("REMARK 7 BACKGROUND_COLOR: %3d %3d %3d\n" % (r, g, b)) f.write("REMARK 7 DISPLAY_STYLE: %s\n" % properDisplayNames[part.o.displayMode]) f.write("REMARK 7 TUBES_BOND_RADIUS: %1.3f\n" % TubBond1Radius) f.write("REMARK 7 BALL_AND_STICK_BOND_RADIUS: %1.3f\n" % BASBond1Radius) # Now write the REMARK records for each chunk (chain) in the part. molNum = 1 for mol in part.molecules: if mol.hidden: # Skip hidden chunks. See docstring in writepdb() for details. # Mark 2008-02-13. continue f.write("REMARK 7 CHAIN: %s " % (molNum)) f.write(" DISPLAY_STYLE: %s " % properDisplayNames[mol.display]) if mol.color: r = int(mol.color[0] * 255 + 0.5) g = int(mol.color[1] * 255 + 0.5) b = int(mol.color[2] * 255 + 0.5) f.write(" COLOR: %3d %3d %3d " % (r, g, b)) f.write(" NAME: \"%s\"\n" % mol.name) molNum += 1 f.write("REMARK 7\n") write_art_data(f) f.close() # Write the "body" of PDB file (appending it to what we just wrote). writepdb(part, filename, mode='a', excludeFlags=excludeFlags)