bhagwandas commited on
Commit
2b375cd
Β·
verified Β·
1 Parent(s): 9c0562f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +61 -0
app.py CHANGED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ from Bio import pairwise2
4
+ from Bio.pairwise2 import format_alignment
5
+
6
+ # Page Configuration
7
+ st.set_page_config(
8
+ page_title="🧬 DNA Sequence Matcher",
9
+ page_icon="🧬",
10
+ layout="centered"
11
+ )
12
+
13
+ # Header
14
+ st.markdown(
15
+ "<h1 style='text-align: center; color: #4CAF50;'>🧬 DNA Sequence Matcher</h1>",
16
+ unsafe_allow_html=True
17
+ )
18
+ st.markdown(
19
+ "<p style='text-align: center; color: #555;'>Align and compare two DNA sequences using Biopython</p>",
20
+ unsafe_allow_html=True
21
+ )
22
+
23
+ # User Input for DNA Sequences
24
+ st.subheader("πŸ”¬ Input DNA Sequences")
25
+ seq1 = st.text_area("Enter DNA Sequence 1:", placeholder="e.g., ATCGTACGTA")
26
+ seq2 = st.text_area("Enter DNA Sequence 2:", placeholder="e.g., ATCGTAGCTA")
27
+
28
+ # Alignment Parameters
29
+ st.subheader("βš™οΈ Alignment Parameters")
30
+ match_score = st.slider("Match Score", min_value=1, max_value=5, value=2)
31
+ mismatch_penalty = st.slider("Mismatch Penalty", min_value=-5, max_value=0, value=-1)
32
+ gap_open_penalty = st.slider("Gap Open Penalty", min_value=-5, max_value=0, value=-2)
33
+ gap_extend_penalty = st.slider("Gap Extend Penalty", min_value=-5, max_value=0, value=-0.5)
34
+
35
+ # Perform Alignment
36
+ if st.button("πŸ§ͺ Align Sequences"):
37
+ if not seq1 or not seq2:
38
+ st.warning("⚠️ Please enter both DNA sequences.")
39
+ else:
40
+ alignments = pairwise2.align.globalms(
41
+ seq1,
42
+ seq2,
43
+ match_score,
44
+ mismatch_penalty,
45
+ gap_open_penalty,
46
+ gap_extend_penalty
47
+ )
48
+
49
+ # Display Results
50
+ st.subheader("πŸ” Alignment Results")
51
+ if alignments:
52
+ for alignment in alignments[:1]: # Show only the top alignment
53
+ st.code(format_alignment(*alignment))
54
+ else:
55
+ st.error("❌ No alignment could be found.")
56
+
57
+ # Footer
58
+ st.markdown(
59
+ "<hr><p style='text-align: center;'>πŸ’» <b>Developed by ChatGPT</b></p>",
60
+ unsafe_allow_html=True
61
+ )