|
import streamlit as st |
|
from isotopomacLib import Isotope, calculate_isotopomers, sum_mass_numbers, remove_duplicates_and_count |
|
|
|
def main(): |
|
st.title("Isotopomer Calculator") |
|
|
|
st.sidebar.header("Input Isotopes") |
|
elements = get_input_elements() |
|
|
|
isotopomers = calculate_isotopomers(elements) |
|
st.write("Isotopomers:", isotopomers) |
|
|
|
unique_lists_count = remove_duplicates_and_count(isotopomers) |
|
st.write("Number of unique lists after removing duplicates:", unique_lists_count) |
|
|
|
def get_input_elements(): |
|
elements = [] |
|
while True: |
|
symbol = st.sidebar.text_input("Enter element symbol (e.g., H, O):") |
|
if not symbol: |
|
break |
|
isotopes = st.sidebar.text_input("Enter isotopes for {} (comma-separated):".format(symbol)) |
|
isotopes = [iso.strip() for iso in isotopes.split(",")] |
|
isotope_objects = [Isotope(symbol, int(iso)) for iso in isotopes] |
|
elements.append(isotope_objects) |
|
return elements |
|
|
|
if __name__ == "__main__": |
|
main() |
|
|