Spaces:
Running
Running
Commit
·
4c168c7
1
Parent(s):
ffebe51
Update code/pdb_featureVector.py
Browse files- code/pdb_featureVector.py +23 -17
code/pdb_featureVector.py
CHANGED
@@ -240,6 +240,13 @@ def pdb(input_set, mode, impute):
|
|
240 |
pdb_file_content = StringIO(pdb_data)
|
241 |
structure = pdb_parser.get_structure(search, pdb_file_content)
|
242 |
ppb = PPBuilder()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
243 |
for model in structure:
|
244 |
for pp in ppb.build_peptides(model):
|
245 |
sequence = pp.get_sequence()
|
@@ -251,24 +258,23 @@ def pdb(input_set, mode, impute):
|
|
251 |
# Get the resolution from the PDB header
|
252 |
header = structure.header
|
253 |
resolution = header.get('resolution', 'N/A')
|
|
|
254 |
# Print UniProt IDs, chain ID, and resolution for the current model
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
pdb_info.at[index, 'resolution'] = resolution
|
271 |
-
index += 1
|
272 |
|
273 |
print()
|
274 |
st.write()
|
|
|
240 |
pdb_file_content = StringIO(pdb_data)
|
241 |
structure = pdb_parser.get_structure(search, pdb_file_content)
|
242 |
ppb = PPBuilder()
|
243 |
+
pdb_data_list = pdb_data.split('\n')
|
244 |
+
pdb_data_list = [i for i in pdb_data_list if i.startswith('DBREF')]
|
245 |
+
pdb_data_list = [[list(filter(None,i.split(' '))) for j in i.split(' ') if j == 'UNP'] for i in pdb_data_list]
|
246 |
+
pdb_data_list = [i for i in pdb_data_list if i != []]
|
247 |
+
#pdb_data_list = [[list(filter(None,j)) for j in i] for i in pdb_data_list]
|
248 |
+
pdb_data_list = [[j[2] for j in i] for i in pdb_data_list]
|
249 |
+
pdb_data_list = [i[0] for i in pdb_data_list]
|
250 |
for model in structure:
|
251 |
for pp in ppb.build_peptides(model):
|
252 |
sequence = pp.get_sequence()
|
|
|
258 |
# Get the resolution from the PDB header
|
259 |
header = structure.header
|
260 |
resolution = header.get('resolution', 'N/A')
|
261 |
+
if chain_id in pdb_data_list:
|
262 |
# Print UniProt IDs, chain ID, and resolution for the current model
|
263 |
+
chain_id = chain.get_id()
|
264 |
+
st.write(f"---- Information for Chain {chain_id} in Model {i} ----")
|
265 |
+
st.write(f"UniProt IDs: {', '.join(uniprot_ids)}")
|
266 |
+
st.write(f"Chain ID: {chain_id}")
|
267 |
+
st.write(f"PDB ID: {search.upper()}")
|
268 |
+
st.write(f"Resolution: {resolution}")
|
269 |
+
st.write(f"Sequence: {sequence}")
|
270 |
+
pdb_fasta.at[index, 'pdbID'] = search
|
271 |
+
pdb_fasta.at[index, 'chain'] = chain_id
|
272 |
+
pdb_fasta.at[index, 'pdbSequence'] = str(sequence)
|
273 |
+
pdb_info.at[index, 'uniprotID'] = ', '.join(uniprot_ids)
|
274 |
+
pdb_info.at[index, 'pdbID'] = search
|
275 |
+
pdb_info.at[index, 'chain'] = chain_id
|
276 |
+
pdb_info.at[index, 'resolution'] = resolution
|
277 |
+
index += 1
|
|
|
|
|
278 |
|
279 |
print()
|
280 |
st.write()
|