Spaces:
Sleeping
Sleeping
Download alignment/word_method.py from bano1/gene_aligner_app: direct link, hf CLI and curl.
- Browser
- Download file 544 Bytes
-
https://huggingface.co/spaces/bano1/gene_aligner_app/resolve/main/alignment/word_method.py
- Command line
-
hf download hf://spaces/bano1/gene_aligner_app/alignment/word_method.py
-
curl -L -o word_method.py https://huggingface.co/spaces/bano1/gene_aligner_app/resolve/main/alignment/word_method.py
544 Bytes
| import streamlit as st | |
| def word_alignment(seq1, seq2, word_size=3): | |
| matches = [] | |
| for i in range(len(seq1) - word_size + 1): | |
| word = seq1[i:i+word_size] | |
| for j in range(len(seq2) - word_size + 1): | |
| if word == seq2[j:j+word_size]: | |
| matches.append((i, j, word)) | |
| if matches: | |
| st.write(f"Found {len(matches)} matching words:") | |
| for match in matches: | |
| st.write(f"SeqA[{match[0]}] = SeqB[{match[1]}] → {match[2]}") | |
| else: | |
| st.write("No matching words found.") | |