|
import streamlit as st |
|
import pandas as pd |
|
|
|
|
|
st.title("mastervariantfilextreme Filtering App for Genomic Data") |
|
st.write("Upload a genomic data file, filter it by specified criteria, and download the filtered data.") |
|
|
|
|
|
uploaded_file = st.file_uploader("Upload your text file", type="txt") |
|
if uploaded_file is not None: |
|
|
|
dfd = pd.read_csv(uploaded_file, sep='\t') |
|
|
|
|
|
columns_to_keep = [0, 0, 0, 11, 15, 1, 2, 2, 3, 4, 5, 8, 24] |
|
|
|
|
|
dfd = dfd.iloc[:, columns_to_keep] |
|
|
|
|
|
dfd.columns = ['Project', 'Sample', 'ID', 'Genome', 'mut_type', 'chrom', 'pos_start', 'pos_end', 'REF', 'ALT', 'DEPTH', 'AF', 'FILTER'] |
|
|
|
|
|
dfd_filtered = dfd[(dfd['DEPTH'] > 200) & (dfd['FILTER'] == 'PASS') & (dfd['AF'] > 2)] |
|
dfd_filtered.drop_duplicates(inplace=True) |
|
|
|
st.write("Filtered Data:") |
|
st.dataframe(dfd_filtered) |
|
|
|
|
|
st.download_button( |
|
label="Download filtered data as CSV", |
|
data=dfd_filtered.to_csv(sep='\t', index=False), |
|
file_name="txtformatted_for_sigprofile_filtered.txt", |
|
mime="text/csv" |
|
) |
|
else: |
|
st.write("Please upload a file to proceed.") |
|
|