Skip to content
Permalink
main
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
import sys
import subprocess
from os import listdir
import os
from paths import PDB_FILES
base_script = """
load coo pdb <infile>
set sscutoff 1.8
set omegac 40.0
check
dele bad
find close
dele bad close
dele bad bond
write coo pdb <outfile>
"""
if len(sys.argv) < 2:
print("python3 pdbstat_deepclean.py <file_prefix>")
raise
pdb_prefix = sys.argv[1]
input_pdb_files = [ f'{PDB_FILES}{f}' for f in listdir(f'{PDB_FILES}') if f.endswith('pdb') and f.find(pdb_prefix) != -1 and f.find('clean') == -1]
print(input_pdb_files)
output_file = '{PDB_FILES}'+pdb_prefix+'_clean.pdb'
base_script_file = './pdbstat_deepclean_script_base.txt'
s = ""
with open(base_script_file, 'r') as script:
for line in script:
if line.endswith('<infile>\n'):
for file in input_pdb_files:
s+= line.replace('<infile>', file)
s += 'all\n'
elif line.endswith('<outfile>\n'):
s+= line.replace('<outfile>', output_file)
else:
s+= line
s += '\n'
print(s)
temp_script_file = './pdbstat_deepclean_script_'+pdb_prefix+'.txt'
with open(temp_script_file, 'w') as script:
script.write(s)
command = ['pdbstat', '-s', '<', temp_script_file]
os.system('pdbstat -s < ' + temp_script_file)
os.system('rm ' + temp_script_file)