Spaces:
Sleeping
Sleeping
Commit
·
d21dacf
1
Parent(s):
e943410
Update code/add_3Dalignment.py
Browse files- code/add_3Dalignment.py +0 -39
code/add_3Dalignment.py
CHANGED
|
@@ -213,7 +213,6 @@ def get_coords(annot, alignments, coords, resnums_for_sasa, mode):
|
|
| 213 |
|
| 214 |
|
| 215 |
def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chain, pdbID, mode, path_3D_alignment,file_format = 'gzip'):
|
| 216 |
-
st.write('HERE')
|
| 217 |
pdbSequence = convert_non_standard_amino_acids(pdbSequence)
|
| 218 |
if mode == 1:
|
| 219 |
if source == 'PDB':
|
|
@@ -272,41 +271,3 @@ def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chai
|
|
| 272 |
alignments = (list(alignments))
|
| 273 |
|
| 274 |
return alignments, coords, resnums_for_sasa
|
| 275 |
-
elif mode==2:
|
| 276 |
-
|
| 277 |
-
atomSequence = ''
|
| 278 |
-
coords = []
|
| 279 |
-
resnums_for_sasa = []
|
| 280 |
-
if file_format == 'txt':
|
| 281 |
-
with open(name, encoding="utf8") as f:
|
| 282 |
-
for line in f.readlines():
|
| 283 |
-
if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA':
|
| 284 |
-
atomSequence += threeToOne(line[17:20].strip())
|
| 285 |
-
coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
|
| 286 |
-
resnums_for_sasa.append(line[22:26].strip())
|
| 287 |
-
elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
|
| 288 |
-
atomSequence += threeToOne(line[17:20].strip())
|
| 289 |
-
coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
|
| 290 |
-
resnums_for_sasa.append(line[22:26].strip())
|
| 291 |
-
elif file_format == 'gzip':
|
| 292 |
-
with gzip.open(pdb_path, mode='rb') as f:
|
| 293 |
-
for line in f:
|
| 294 |
-
line = line.decode()
|
| 295 |
-
if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA':
|
| 296 |
-
atomSequence += threeToOne(line[17:20].strip())
|
| 297 |
-
coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
|
| 298 |
-
resnums_for_sasa.append(line[22:26].strip())
|
| 299 |
-
elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
|
| 300 |
-
atomSequence += threeToOne(line[17:20].strip())
|
| 301 |
-
coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
|
| 302 |
-
resnums_for_sasa.append(line[22:26].strip())
|
| 303 |
-
#f = open(Path(path_3D_alignment / f'{identifier}_{str(model_num)}_3Dalignment.txt'),"w")
|
| 304 |
-
aligner.mode = 'local'
|
| 305 |
-
aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
|
| 306 |
-
aligner.open_gap_score = -11
|
| 307 |
-
aligner.extend_gap_score = -1
|
| 308 |
-
atomSequence = convert_non_standard_amino_acids(atomSequence)
|
| 309 |
-
alignments = aligner.align(pdbSequence, atomSequence)
|
| 310 |
-
alignments = (list(alignments))
|
| 311 |
-
|
| 312 |
-
return alignments, coords, resnums_for_sasa
|
|
|
|
| 213 |
|
| 214 |
|
| 215 |
def get_alignments_3D(identifier, model_num, pdb_path, pdbSequence, source, chain, pdbID, mode, path_3D_alignment,file_format = 'gzip'):
|
|
|
|
| 216 |
pdbSequence = convert_non_standard_amino_acids(pdbSequence)
|
| 217 |
if mode == 1:
|
| 218 |
if source == 'PDB':
|
|
|
|
| 271 |
alignments = (list(alignments))
|
| 272 |
|
| 273 |
return alignments, coords, resnums_for_sasa
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|