Accelernate commited on
Commit
8d7db0b
·
verified ·
1 Parent(s): 3db1220

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -2
app.py CHANGED
@@ -1,6 +1,6 @@
1
  import streamlit as st
2
  import numpy as np
3
- from Bio.SeqUtils import GC
4
  from hmmlearn import hmm
5
 
6
  # Function to encode DNA sequence
@@ -8,6 +8,12 @@ def encode_sequence(seq):
8
  encoding = {'A': 0, 'C': 1, 'G': 2, 'T': 3}
9
  return np.array([encoding[base] for base in seq if base in encoding])
10
 
 
 
 
 
 
 
11
  # Simple HMM model (this is a placeholder and would need proper training)
12
  model = hmm.MultinomialHMM(n_components=2, random_state=42)
13
  model.startprob_ = np.array([0.5, 0.5])
@@ -21,7 +27,7 @@ def analyze_dark_matter(sequence):
21
 
22
  # Basic statistics
23
  length = len(seq)
24
- gc_content = GC(seq)
25
 
26
  # Look for common regulatory motifs
27
  tata_box = seq.count("TATAAA")
 
1
  import streamlit as st
2
  import numpy as np
3
+ from Bio.Seq import Seq
4
  from hmmlearn import hmm
5
 
6
  # Function to encode DNA sequence
 
8
  encoding = {'A': 0, 'C': 1, 'G': 2, 'T': 3}
9
  return np.array([encoding[base] for base in seq if base in encoding])
10
 
11
+ # Function to calculate GC content
12
+ def calculate_gc_content(seq):
13
+ gc_count = seq.count('G') + seq.count('C')
14
+ total_count = len(seq)
15
+ return (gc_count / total_count) * 100 if total_count > 0 else 0
16
+
17
  # Simple HMM model (this is a placeholder and would need proper training)
18
  model = hmm.MultinomialHMM(n_components=2, random_state=42)
19
  model.startprob_ = np.array([0.5, 0.5])
 
27
 
28
  # Basic statistics
29
  length = len(seq)
30
+ gc_content = calculate_gc_content(seq)
31
 
32
  # Look for common regulatory motifs
33
  tata_box = seq.count("TATAAA")