Spaces:
Sleeping
Sleeping
Commit
·
a253668
1
Parent(s):
1744db1
Update code/add_sasa.py
Browse files- code/add_sasa.py +0 -5
code/add_sasa.py
CHANGED
|
@@ -12,12 +12,10 @@ import streamlit as st
|
|
| 12 |
|
| 13 |
|
| 14 |
def run_freesasa(infile, outfile, include_hetatms=True, outdir=None, force_rerun=False, file_type = 'gzip'):
|
| 15 |
-
st.write('Here')
|
| 16 |
if not outdir:
|
| 17 |
outdir = ''
|
| 18 |
outfile = op.join(outdir, outfile)
|
| 19 |
if file_type == 'pdb':
|
| 20 |
-
st.write('pdb')
|
| 21 |
if ssbio.utils.force_rerun(flag=force_rerun, outfile=outfile):
|
| 22 |
if include_hetatms:
|
| 23 |
shell_command = 'freesasa --format=rsa --hetatm {} -o {}'.format(infile, outfile)
|
|
@@ -29,7 +27,6 @@ def run_freesasa(infile, outfile, include_hetatms=True, outdir=None, force_rerun
|
|
| 29 |
shell=True)
|
| 30 |
out, err = command.communicate()
|
| 31 |
elif file_type == 'gzip':
|
| 32 |
-
st.write('gzip')
|
| 33 |
with gzip.open(infile, 'rb') as f_in:
|
| 34 |
with open('file_temp.pdb', 'wb') as f_out:
|
| 35 |
shutil.copyfileobj(f_in, f_out)
|
|
@@ -49,7 +46,6 @@ def run_freesasa(infile, outfile, include_hetatms=True, outdir=None, force_rerun
|
|
| 49 |
return outfile
|
| 50 |
|
| 51 |
def calculate_freesasa(ID, model_num, existing_free_sasa, path_to_input,path_to_output_files, file_type = 'gzip'):
|
| 52 |
-
st.write('Calculating s area')
|
| 53 |
print('Calculating surface area...\n')
|
| 54 |
file_base = str(Path(path_to_input / '*'))
|
| 55 |
file_str = glob.glob(file_base)[0].split('-')[-1].split('.')[0]
|
|
@@ -67,7 +63,6 @@ def calculate_freesasa(ID, model_num, existing_free_sasa, path_to_input,path_to_
|
|
| 67 |
outdir=None, force_rerun=False)
|
| 68 |
|
| 69 |
def sasa(source, pdbID, uniprotID, sasa_pos, wt, mode, path_to_output_files,file_type = 'gzip'):
|
| 70 |
-
st.write('sasa')
|
| 71 |
if mode == 1:
|
| 72 |
sasa = 'nan'
|
| 73 |
for filename in list(Path(path_to_output_files / 'freesasa_files').glob("*")):
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def run_freesasa(infile, outfile, include_hetatms=True, outdir=None, force_rerun=False, file_type = 'gzip'):
|
|
|
|
| 15 |
if not outdir:
|
| 16 |
outdir = ''
|
| 17 |
outfile = op.join(outdir, outfile)
|
| 18 |
if file_type == 'pdb':
|
|
|
|
| 19 |
if ssbio.utils.force_rerun(flag=force_rerun, outfile=outfile):
|
| 20 |
if include_hetatms:
|
| 21 |
shell_command = 'freesasa --format=rsa --hetatm {} -o {}'.format(infile, outfile)
|
|
|
|
| 27 |
shell=True)
|
| 28 |
out, err = command.communicate()
|
| 29 |
elif file_type == 'gzip':
|
|
|
|
| 30 |
with gzip.open(infile, 'rb') as f_in:
|
| 31 |
with open('file_temp.pdb', 'wb') as f_out:
|
| 32 |
shutil.copyfileobj(f_in, f_out)
|
|
|
|
| 46 |
return outfile
|
| 47 |
|
| 48 |
def calculate_freesasa(ID, model_num, existing_free_sasa, path_to_input,path_to_output_files, file_type = 'gzip'):
|
|
|
|
| 49 |
print('Calculating surface area...\n')
|
| 50 |
file_base = str(Path(path_to_input / '*'))
|
| 51 |
file_str = glob.glob(file_base)[0].split('-')[-1].split('.')[0]
|
|
|
|
| 63 |
outdir=None, force_rerun=False)
|
| 64 |
|
| 65 |
def sasa(source, pdbID, uniprotID, sasa_pos, wt, mode, path_to_output_files,file_type = 'gzip'):
|
|
|
|
| 66 |
if mode == 1:
|
| 67 |
sasa = 'nan'
|
| 68 |
for filename in list(Path(path_to_output_files / 'freesasa_files').glob("*")):
|