fatmacankara commited on
Commit
146b805
·
1 Parent(s): 2b7168f

Update code/alphafold_featureVector.py

Browse files
Files changed (1) hide show
  1. code/alphafold_featureVector.py +16 -28
code/alphafold_featureVector.py CHANGED
@@ -587,9 +587,9 @@ def alphafold(input_set, mode, impute):
587
  pdb_path = hf_hub_download(repo_id="HuBioDataLab/AlphafoldStructures", filename=f"AF-{uniprotID}-F{mod}-model_v4.pdb.gz",repo_type = 'dataset')
588
 
589
 
590
- with gzip.open(pdb_path, mode="rt") as f:
591
- file_content = f.read()
592
- st.write(file_content)
593
 
594
  st.write('Download complete.')
595
 
@@ -611,31 +611,19 @@ def alphafold(input_set, mode, impute):
611
  atomSequence = ''
612
  coords = []
613
  resnums_for_sasa = []
614
- if file_format == 'txt':
615
- st.write('Hello I am in 3Dalignment TXT')
616
- with open(name, encoding="utf8") as f:
617
- for line in f.readlines():
618
- if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA':
619
- atomSequence += threeToOne(line[17:20].strip())
620
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
621
- resnums_for_sasa.append(line[22:26].strip())
622
- elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
623
- atomSequence += threeToOne(line[17:20].strip())
624
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
625
- resnums_for_sasa.append(line[22:26].strip())
626
- elif file_format == 'gzip':
627
- st.write('Hello I am in 3Dalignment GZIP')
628
- with gzip.open(pdb_path, mode='rb') as f:
629
- for line in f:
630
- line = line.decode()
631
- if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA':
632
- atomSequence += threeToOne(line[17:20].strip())
633
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
634
- resnums_for_sasa.append(line[22:26].strip())
635
- elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
636
- atomSequence += threeToOne(line[17:20].strip())
637
- coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
638
- resnums_for_sasa.append(line[22:26].strip())
639
  #f = open(Path(path_3D_alignment / f'{identifier}_{str(model_num)}_3Dalignment.txt'),"w")
640
  aligner.mode = 'local'
641
  aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")
 
587
  pdb_path = hf_hub_download(repo_id="HuBioDataLab/AlphafoldStructures", filename=f"AF-{uniprotID}-F{mod}-model_v4.pdb.gz",repo_type = 'dataset')
588
 
589
 
590
+ #with gzip.open(pdb_path, mode="rt") as f:
591
+ # file_content = f.read()
592
+ # st.write(file_content)
593
 
594
  st.write('Download complete.')
595
 
 
611
  atomSequence = ''
612
  coords = []
613
  resnums_for_sasa = []
614
+ st.write('Hello I am in 3Dalignment GZIP')
615
+ with gzip.open(pdb_path, mode='rb') as f:
616
+ for line in f:
617
+ line = line.decode()
618
+ if line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA':
619
+ atomSequence += threeToOne(line[17:20].strip())
620
+ coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
621
+ resnums_for_sasa.append(line[22:26].strip())
622
+ elif line[0:4].strip() == 'ATOM' and line[13:15].strip() == 'CA' and line[21] == ' ':
623
+ atomSequence += threeToOne(line[17:20].strip())
624
+ coords.append([line[31:38].strip(), line[39:46].strip(), line[47:54].strip()])
625
+ resnums_for_sasa.append(line[22:26].strip())
626
+ st.write('o-complee')
 
 
 
 
 
 
 
 
 
 
 
 
627
  #f = open(Path(path_3D_alignment / f'{identifier}_{str(model_num)}_3Dalignment.txt'),"w")
628
  aligner.mode = 'local'
629
  aligner.substitution_matrix = substitution_matrices.load("BLOSUM62")