On Mar 13, 2025, at 7:58 AM, mishra.ananya.163--- via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:
Thank you so much for your help!
We tried running the following code:
# Function to calculate the properties for each PDB file
def calculate_properties(pdb_file):
try:
# Open the PDB file in ChimeraX
run(session, f"open {pdb_file}")
# Calculate SASA (Solvent Accessible Surface Area)
run(session, "surface")
sasa_value = run(session, "measure sasa")
# Calculate Mean MLP (Mean Molecular Lipophilicity Potential)
mlp_value = run(session, "mlp")
# Calculate Mean Electrostatic Potential
electrostatic_value = run(session, "coulombic")
# Close the model to free memory
run("close all")
return sasa_value, mlp_value, electrostatic_value
except Exception as e:
print(f"Error processing {pdb_file}: {e}")
return None, None, None
# Function to save results to a CSV file
def save_results_to_csv(results, output_file):
with open(output_file, mode='w', newline='') as file:
writer = csv.writer(file)
writer.writerow(["PDB File", "SASA", "MLP", "Electrostatic Potential"])
for result in results:
writer.writerow(result)
# List of PDB files (replace with your actual file paths)
pdb_files = [
r'/Users/nikhita/Downloads/WT_EGFR.pdb',
r'/Users/nikhita/Downloads/WT_MTOR.pdb'
]
# List to store the results
results = []
# Loop through the PDB files and calculate the properties
for pdb_file in pdb_files:
print(f"Processing {pdb_file}...")
sasa_value, mlp_value, electrostatic_value = calculate_properties(pdb_file)
# If values were successfully calculated, add to the results list
if sasa_value is not None:
results.append([pdb_file, sasa_value, mlp_value, electrostatic_value])
else:
results.append([pdb_file, "Error", "Error", "Error"])
# Define the output CSV file name
output_csv = "protein_properties.csv"
# Save the results to CSV
save_results_to_csv(results, output_csv)
print(f"Results saved to {output_csv}")
We ran this code in ChimeraX and it managed to run without any error message. However, when we opened the saved csv file, the file had the following printed: '[path to PDB file] Error, Error, Error.' However, we can't seem to find what went wrong with the code to result in this output. In addition, when we run the code in ChimeraX, the protein structures seem to become superimposed on each other and we were wondering if there was a way to overcome this? Any help and advice is greatly appreciated! Thank you for your time!
_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/