Accelernate commited on
Commit
a89a730
·
verified ·
1 Parent(s): c3027e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -11
app.py CHANGED
@@ -36,11 +36,11 @@ def render_mol(pdb):
36
 
37
  def perform_blast_analysis(sequence):
38
  st.subheader('Protein Analysis')
39
- with st.spinner("Analyzing generated protein... This may take a several minutes. Stay tuned!"):
40
  progress_bar = st.progress(0)
41
  for i in range(100):
42
  progress_bar.progress(i + 1)
43
- time.sleep(0.1) # Simulate analysis time
44
 
45
  try:
46
  record = SeqRecord(Seq(sequence), id='random_protein')
@@ -58,23 +58,18 @@ def perform_blast_analysis(sequence):
58
  organism = title_parts[-2].split('OS=')[-1].split('OX=')[0].strip()
59
 
60
  # Calculate identity percentage
61
- identity_percentage = (hsp.identities / alignment.length) * 100
62
 
63
  st.write(f"**Top Match:** {protein_name}")
64
- st.write(f"**Organism Code:** {organism}")
65
  st.write(f"**Sequence Identity Match:** {identity_percentage:.2f}%")
66
-
67
 
68
  # Fetch protein function (if available)
69
  if hasattr(alignment, 'description') and alignment.description:
70
  st.write(f"**Potential Function:** {alignment.description}")
71
-
72
- if hasattr(alignment, 'description') and alignment.description:
73
-
74
- st.write(f"**Potential Function:** {alignment.description}")
75
  else:
76
- st.write("No significant matches found in the database. This might be a unique protein sequence!")
77
-
78
  def update(sequence, word1, word2, word3, sequence_length):
79
  headers = {
80
  'Content-Type': 'application/x-www-form-urlencoded',
 
36
 
37
  def perform_blast_analysis(sequence):
38
  st.subheader('Protein Analysis')
39
+ with st.spinner("Analyzing generated protein... This may take several minutes. Stay tuned!"):
40
  progress_bar = st.progress(0)
41
  for i in range(100):
42
  progress_bar.progress(i + 1)
43
+ time.sleep(0.4) # Analysis time
44
 
45
  try:
46
  record = SeqRecord(Seq(sequence), id='random_protein')
 
58
  organism = title_parts[-2].split('OS=')[-1].split('OX=')[0].strip()
59
 
60
  # Calculate identity percentage
61
+ identity_percentage = (hsp.identities / hsp.align_length) * 100
62
 
63
  st.write(f"**Top Match:** {protein_name}")
64
+ st.write(f"**Organism:** {organism}")
65
  st.write(f"**Sequence Identity Match:** {identity_percentage:.2f}%")
 
66
 
67
  # Fetch protein function (if available)
68
  if hasattr(alignment, 'description') and alignment.description:
69
  st.write(f"**Potential Function:** {alignment.description}")
 
 
 
 
70
  else:
71
+ st.write("No significant matches found in the database. This might be a unique protein sequence!")
72
+
73
  def update(sequence, word1, word2, word3, sequence_length):
74
  headers = {
75
  'Content-Type': 'application/x-www-form-urlencoded',