import gradio as gr # Simulated functions for testing purposes def download_fastq_files(sra_id): fastq_files = ["fastq_sample_1.fastq", "fastq_sample_2.fastq"] for file in fastq_files: print(f"Downloaded {file}") return f"Downloaded FASTQ files for {sra_id}", fastq_files def send_files_to_fastqc(fastq_files): for file in fastq_files: print(f"Sent {file} to FASTQC") return f"Sent {fastq_files} to FASTQC" def run_fastqc_analysis(fastq_files): file1, file2 = fastq_files return f"FASTQC analysis completed for {fastq_files}", file1, file2 def openURLinnewtab(url): url ['C:/Users/raanna/Desktop/NGS/2.html', 'C:/Users/raanna/Desktop/NGS/1.html'] for file in url: print(f"Opening {file} in new tab") import webbrowser webbrowser.open_new_tab(url) with gr.Blocks(title="NGS - Precision Medicine Toolkit") as app: gr.Markdown(value="# Step 1: Download FASTQ Files") with gr.Row(): with gr.Column(): sra_id = gr.Textbox(label="Enter SRA ID to download FASTQ Files", placeholder="e.g. SRR123456") with gr.Column(): fastq_files = gr.Textbox(label="Downloaded FASTQ Files", interactive=False) download_fastq = gr.Button(value="Download FASTQ and Proceed to FASTQC") download_fastq.click(fn=download_fastq_files, inputs=[sra_id], outputs=[fastq_files]) gr.Markdown(value="# Step 2: Perform FASTQC Analysis") with gr.Row(): with gr.Column(): fastq_analysis_files = gr.Textbox(label="FASTQ Files for Analysis", interactive=False) with gr.Column(): fastqc_results = gr.Textbox(label="FASTQC Analysis Results", interactive=False) with gr.Row(): run_fastqc = gr.Button(value="Run FASTQC and get Results") open_url = gr.Button(value="Open FASTQC Results in Browser") run_fastqc.click(fn=run_fastqc_analysis, inputs=[fastq_analysis_files], outputs=[fastqc_results]) fastq_files.change(fn=lambda x: x, inputs=[fastq_files], outputs=[fastq_analysis_files]) gr.Markdown(value="# Step 3: Perform FASTP Trimming and Analysis") app.queue().launch(debug=True)