Update app.py
Browse files
app.py
CHANGED
@@ -54,27 +54,6 @@ def process_csv(file):
|
|
54 |
|
55 |
return homorepeats, sequence_data
|
56 |
|
57 |
-
import pandas as pd
|
58 |
-
import streamlit as st
|
59 |
-
from io import BytesIO
|
60 |
-
import xlsxwriter
|
61 |
-
|
62 |
-
# Function to process the Excel file
|
63 |
-
def process_excel(excel_data):
|
64 |
-
# Custom logic to process each sheet within the Excel file
|
65 |
-
homorepeats = set()
|
66 |
-
sequence_data = []
|
67 |
-
|
68 |
-
for sheet_name in excel_data.sheet_names:
|
69 |
-
df = excel_data.parse(sheet_name)
|
70 |
-
for index, row in df.iterrows():
|
71 |
-
entry_id = row['Entry ID']
|
72 |
-
protein_name = row['Protein Name']
|
73 |
-
freq = {repeat: row[repeat] for repeat in df.columns[2:]} # Assuming repeats start from 3rd column
|
74 |
-
sequence_data.append((entry_id, protein_name, freq))
|
75 |
-
homorepeats.update(freq.keys())
|
76 |
-
|
77 |
-
return homorepeats, sequence_data
|
78 |
|
79 |
# Function to generate and download Excel workbook with separate sheets for each input file
|
80 |
def create_excel(sequences_data, homorepeats, filenames):
|
@@ -109,6 +88,23 @@ def create_excel(sequences_data, homorepeats, filenames):
|
|
109 |
output.seek(0)
|
110 |
return output
|
111 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
# Streamlit UI components
|
113 |
st.title("Protein Homorepeat Analysis")
|
114 |
|
|
|
54 |
|
55 |
return homorepeats, sequence_data
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
|
58 |
# Function to generate and download Excel workbook with separate sheets for each input file
|
59 |
def create_excel(sequences_data, homorepeats, filenames):
|
|
|
88 |
output.seek(0)
|
89 |
return output
|
90 |
|
91 |
+
# Function to process the Excel file
|
92 |
+
def process_excel(excel_data):
|
93 |
+
# Custom logic to process each sheet within the Excel file
|
94 |
+
homorepeats = set()
|
95 |
+
sequence_data = []
|
96 |
+
|
97 |
+
for sheet_name in excel_data.sheet_names:
|
98 |
+
df = excel_data.parse(sheet_name)
|
99 |
+
for index, row in df.iterrows():
|
100 |
+
entry_id = row['Entry ID']
|
101 |
+
protein_name = row['Protein Name']
|
102 |
+
freq = {repeat: row[repeat] for repeat in df.columns[2:]} # Assuming repeats start from 3rd column
|
103 |
+
sequence_data.append((entry_id, protein_name, freq))
|
104 |
+
homorepeats.update(freq.keys())
|
105 |
+
|
106 |
+
return homorepeats, sequence_data
|
107 |
+
|
108 |
# Streamlit UI components
|
109 |
st.title("Protein Homorepeat Analysis")
|
110 |
|