PrarthiKothari commited on
Commit
5df31b7
·
verified ·
1 Parent(s): f6dc93a

Upload 3 files

Browse files
Files changed (3) hide show
  1. app.py +51 -0
  2. download_fastqc.py +7 -0
  3. send_files_to_fastqc.py +6 -0
app.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+
3
+ # Simulated functions for testing purposes
4
+ def download_fastq_files(sra_id):
5
+ fastq_files = ["fastq_sample_1.fastq", "fastq_sample_2.fastq"]
6
+ for file in fastq_files:
7
+ print(f"Downloaded {file}")
8
+ return f"Downloaded FASTQ files for {sra_id}", fastq_files
9
+
10
+ def send_files_to_fastqc(fastq_files):
11
+ for file in fastq_files:
12
+ print(f"Sent {file} to FASTQC")
13
+ return f"Sent {fastq_files} to FASTQC"
14
+
15
+ def run_fastqc_analysis(fastq_files):
16
+ file1, file2 = fastq_files
17
+ return f"FASTQC analysis completed for {fastq_files}", file1, file2
18
+
19
+ def openURLinnewtab(url):
20
+ url ['C:/Users/raanna/Desktop/NGS/2.html', 'C:/Users/raanna/Desktop/NGS/1.html']
21
+ for file in url:
22
+ print(f"Opening {file} in new tab")
23
+ import webbrowser
24
+ webbrowser.open_new_tab(url)
25
+
26
+
27
+ with gr.Blocks(title="NGS - Precision Medicine Toolkit") as app:
28
+ gr.Markdown(value="# Step 1: Download FASTQ Files")
29
+ with gr.Row():
30
+ with gr.Column():
31
+ sra_id = gr.Textbox(label="Enter SRA ID to download FASTQ Files", placeholder="e.g. SRR123456")
32
+ with gr.Column():
33
+ fastq_files = gr.Textbox(label="Downloaded FASTQ Files", interactive=False)
34
+ download_fastq = gr.Button(value="Download FASTQ and Proceed to FASTQC")
35
+ download_fastq.click(fn=download_fastq_files, inputs=[sra_id], outputs=[fastq_files])
36
+ gr.Markdown(value="# Step 2: Perform FASTQC Analysis")
37
+ with gr.Row():
38
+ with gr.Column():
39
+ fastq_analysis_files = gr.Textbox(label="FASTQ Files for Analysis", interactive=False)
40
+ with gr.Column():
41
+ fastqc_results = gr.Textbox(label="FASTQC Analysis Results", interactive=False)
42
+ with gr.Row():
43
+ run_fastqc = gr.Button(value="Run FASTQC and get Results")
44
+ open_url = gr.Button(value="Open FASTQC Results in Browser")
45
+ run_fastqc.click(fn=run_fastqc_analysis, inputs=[fastq_analysis_files], outputs=[fastqc_results])
46
+ fastq_files.change(fn=lambda x: x, inputs=[fastq_files], outputs=[fastq_analysis_files])
47
+
48
+ gr.Markdown(value="# Step 3: Perform FASTP Trimming and Analysis")
49
+
50
+
51
+ app.queue().launch(debug=True)
download_fastqc.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ def download_fastq_files(sra_id):
2
+ file = "fastq_files.txt"
3
+ with open(file, "w") as f:
4
+ f.write("FASTQ files for SRA ID: " + sra_id)
5
+ f.write("file1.fastq")
6
+ f.write("file2.fastq")
7
+ return "FASTQ files downloaded successfully!", file
send_files_to_fastqc.py ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ def send_files_to_fastqc(fastq_files):
2
+ return fastq_files
3
+
4
+ def run_fastqc_analysis(fastq_files):
5
+ [file1, file2] = fastq_files*2
6
+ return file1, file2