Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import pandas as pd
|
|
| 4 |
from Bio import SeqIO
|
| 5 |
from Bio.SeqUtils.ProtParam import ProteinAnalysis
|
| 6 |
from Bio.Graphics import GenomeDiagram
|
| 7 |
-
from reportlab.lib import
|
| 8 |
from reportlab.lib.units import cm
|
| 9 |
from io import StringIO
|
| 10 |
from collections import Counter
|
|
@@ -80,14 +80,12 @@ def create_genome_diagram(genbank_content, output_file_path):
|
|
| 80 |
for feature in record.features:
|
| 81 |
if feature.type not in ["gene", "CDS"]:
|
| 82 |
continue
|
| 83 |
-
if len(gd_feature_set) % 2 == 0
|
| 84 |
-
color = colors.blue
|
| 85 |
-
else:
|
| 86 |
-
color = colors.lightblue
|
| 87 |
gd_feature_set.add_feature(feature, color=color, label=True, label_size=10, label_angle=0)
|
| 88 |
|
|
|
|
| 89 |
gd_diagram.draw(format="circular", circular=True, pagesize=(20*cm, 20*cm), start=0, end=len(record), circle_core=0.7)
|
| 90 |
-
gd_diagram.write(output_file_path, "
|
| 91 |
|
| 92 |
# Streamlit UI setup
|
| 93 |
st.set_page_config(page_title="Genomic Data Dashboard", page_icon="🧬", layout="wide")
|
|
@@ -133,9 +131,9 @@ if uploaded_file is not None:
|
|
| 133 |
st.bar_chart(pd.DataFrame.from_dict(kmers, orient='index', columns=['Frequency']).sort_values('Frequency', ascending=False).head(20))
|
| 134 |
|
| 135 |
# Generate and display genome diagram
|
| 136 |
-
|
| 137 |
-
create_genome_diagram(uploaded_file.getvalue().decode("utf-8"),
|
| 138 |
-
st.image(
|
| 139 |
|
| 140 |
# Additional Information
|
| 141 |
with st.expander("View All Genes"):
|
|
|
|
| 4 |
from Bio import SeqIO
|
| 5 |
from Bio.SeqUtils.ProtParam import ProteinAnalysis
|
| 6 |
from Bio.Graphics import GenomeDiagram
|
| 7 |
+
from reportlab.lib.colors import Color, lightblue, blue
|
| 8 |
from reportlab.lib.units import cm
|
| 9 |
from io import StringIO
|
| 10 |
from collections import Counter
|
|
|
|
| 80 |
for feature in record.features:
|
| 81 |
if feature.type not in ["gene", "CDS"]:
|
| 82 |
continue
|
| 83 |
+
color = lightblue if len(gd_feature_set) % 2 == 0 else blue
|
|
|
|
|
|
|
|
|
|
| 84 |
gd_feature_set.add_feature(feature, color=color, label=True, label_size=10, label_angle=0)
|
| 85 |
|
| 86 |
+
# Change the output format to SVG
|
| 87 |
gd_diagram.draw(format="circular", circular=True, pagesize=(20*cm, 20*cm), start=0, end=len(record), circle_core=0.7)
|
| 88 |
+
gd_diagram.write(output_file_path, "SVG")
|
| 89 |
|
| 90 |
# Streamlit UI setup
|
| 91 |
st.set_page_config(page_title="Genomic Data Dashboard", page_icon="🧬", layout="wide")
|
|
|
|
| 131 |
st.bar_chart(pd.DataFrame.from_dict(kmers, orient='index', columns=['Frequency']).sort_values('Frequency', ascending=False).head(20))
|
| 132 |
|
| 133 |
# Generate and display genome diagram
|
| 134 |
+
output_file_path_svg = os.path.join(temp_dir, "genome_diagram.svg")
|
| 135 |
+
create_genome_diagram(uploaded_file.getvalue().decode("utf-8"), output_file_path_svg)
|
| 136 |
+
st.image(output_file_path_svg, caption='Genome Diagram', format='SVG')
|
| 137 |
|
| 138 |
# Additional Information
|
| 139 |
with st.expander("View All Genes"):
|