hiyata commited on
Commit
1d54b05
·
verified ·
1 Parent(s): 80a9f71

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -3
app.py CHANGED
@@ -565,11 +565,24 @@ def create_interface():
565
  - GC content is calculated using a sliding window
566
  """)
567
 
568
- # Connect components
569
  sequence_state = gr.State()
570
 
 
 
 
 
 
 
 
 
 
 
 
 
 
571
  analyze_btn.click(
572
- process_sequence,
573
  inputs=[
574
  file_input,
575
  text_input,
@@ -578,7 +591,9 @@ def create_interface():
578
  ],
579
  outputs=[
580
  results_text,
581
- [genome_plot, kmer_plot, dist_plot],
 
 
582
  sequence_state
583
  ]
584
  )
 
565
  - GC content is calculated using a sliding window
566
  """)
567
 
568
+ # Connect components
569
  sequence_state = gr.State()
570
 
571
+ def process_and_update(file_obj, fasta_text, window_size, top_kmers):
572
+ """Wrapper to handle plot outputs correctly"""
573
+ results, plots, analysis = process_sequence(file_obj, fasta_text, window_size, top_kmers)
574
+ if plots:
575
+ return [
576
+ results,
577
+ plots[0], # genome plot
578
+ plots[1], # kmer plot
579
+ plots[2], # distribution plot
580
+ analysis
581
+ ]
582
+ return [results, None, None, None, None]
583
+
584
  analyze_btn.click(
585
+ process_and_update,
586
  inputs=[
587
  file_input,
588
  text_input,
 
591
  ],
592
  outputs=[
593
  results_text,
594
+ genome_plot,
595
+ kmer_plot,
596
+ dist_plot,
597
  sequence_state
598
  ]
599
  )