Spaces:
Sleeping
Sleeping
Update app.py
Browse files894 unmodified lines8958968978988999009019029039049059069079089099109119129139149151912 unmodified lines2828282928302816281728312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871404 unmodified lines32763277327832283279328032813282894 unmodified lines return df.to_csv(index=False).encode("utf-8")
def st_show_image(data, caption: Optional[str] = None) -> None: """Display an image full width across Streamlit versions.
st.image only accepted use_container_width from a fairly recent Streamlit release; older builds (still common in pinned conda environments) raise a TypeError for it and expect use_column_width instead. Try the current argument first, then fall back, so the app runs the same way regardless of which Streamlit build is deployed. """ try: st.image(data, caption=caption, use_container_width=True) except TypeError: st.image(data, caption=caption, use_column_width=True)
def human_bp(n): n = int(n) if n >= 1_000_000:1912 unmodified lines st.info("No VFDB BLAST database was found, so virulence screening will use the built-in NCBI AMRFinderPlus --plus detector. Upload VFDB FASTA or install a VFDB BLAST database only if you specifically want VFDB based screening.") if run_amr and amr_prefix is None and use_amrfinderplus: st.info("No AMR BLAST database was found, so AMR screening will use the built-in NCBI AMRFinderPlus detector.") if (run_vfdb or run_amr) and not use_amrfinderplus and vfdb_prefix is None and amr_prefix is None: st.error("No AMR or virulence detector is available. The Docker image must install ncbi-amrfinderplus, or you must upload VFDB and AMR FASTA databases.")
# Report missing detectors per module, rather than one combined # message, so the guidance only names the module(s) that were # actually requested and are genuinely unavailable. missing_amr = run_amr and amr_prefix is None and not use_amrfinderplus missing_vfdb = run_vfdb and vfdb_prefix is None and not use_amrfinderplus if missing_amr or missing_vfdb: missing_labels = [] if missing_amr: missing_labels.append("AMR") if missing_vfdb: missing_labels.append("virulence") joined = " or ".join(missing_labels) st.error( f"No {joined} detector is available. The Docker image must install " "ncbi-amrfinderplus, or you must upload VFDB and AMR FASTA databases. " f"{'AMR' if missing_amr else 'Virulence'} screening will be skipped for this run " "until one of the options below is in place." ) with st.expander("How to fix this", expanded=False): st.markdown( "**Option 1: install NCBI AMRFinderPlus in the Docker image (covers both AMR and virulence).**\n" "```\nmicromamba install -n genomics -c bioconda -c conda-forge ncbi-amrfinderplus\namrfinder -u\n```\n" "The `amrfinder -u` step downloads the reference database and must run during " "the image build, before deployment, since this app does not have outbound " "internet access to fetch it at request time.\n\n" "**Option 2: install ncbi-blast+ and mount preinstalled BLAST databases.**\n" "Build nucleotide BLAST databases with `makeblastdb -dbtype nucl` and place them " f"at the paths configured by the `VFDB_DB_PREFIX` (currently `{DEFAULT_VFDB_DB_PREFIX}`) " f"and `AMR_DB_PREFIX` (currently `{DEFAULT_AMR_DB_PREFIX}`) environment variables.\n\n" "**Option 3: upload a reference FASTA directly in this session.**\n" "Use the 'Database options' section in the sidebar to upload a VFDB and/or AMR " "nucleotide FASTA file. The app will build a temporary BLAST database from it " "for this run only.\n\n" "If you do not need this module, you can also simply turn off " f"'{'Detect AMR genes' if missing_amr else 'Detect virulence genes'}' " "in the sidebar to stop seeing this message." )
cai_weights = load_cai_weights(cai_upload) if run_codon else {}
404 unmodified lines st.info("No figures were generated.") else: for name, png in st.session_state.figures_png.items(): st.image(png, caption=name, use_container_width=True) st_show_image(png, caption=name)
with tab6: st.markdown("### Download complete report")app.py+54-3