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