import io
import os
import pandas as pd
import streamlit as st
ifile=st.file_uploader(‘sample.vcf’,type=‘vcf’)
if ifile:
def read_vcf(path):
with open(ifile, 'r') as f:
lines = [l for l in f if not l.startswith('##')]
return pd.read_csv(
io.StringIO(''.join(lines)),
dtype={'#CHROM': str, 'POS': int, 'ID': str, 'REF': str, 'ALT': str,
'QUAL': str, 'FILTER': str, 'INFO': str},
sep='\t'
).rename(columns={'#CHROM': 'CHROM'})
st.write(read_vcf(ifile))