-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathidentify_pal.py
37 lines (27 loc) · 870 Bytes
/
identify_pal.py
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
import streamlit as st
def is_palindrome(s):
return s == s[::-1]
def find_palindromes(input_string):
palindromes = []
# Iterate through all possible substrings
for i in range(len(input_string)):
for j in range(i + 40, len(input_string) + 40, 40):
substring = input_string[i:j]
# Check if the substring is a palindrome
if is_palindrome(substring):
palindromes.append(substring)
return palindromes
# Streamlit application
# Page title
st.markdown(
"""
# Identify palindromic sequences
"""
)
with st.form("ml-form"):
file = st.file_uploader(
"FILE UPLOADER: Input the FASTA file of the DNA of your target", type=".fasta"
)
st.markdown("**OR**")
seq = st.text_area("Input your target DNA sequence")
submitted = st.form_submit_button("Submit!")