rrwick / Porechop

adapter trimmer for Oxford Nanopore reads
GNU General Public License v3.0
323 stars 124 forks source link

Report progress while porechop is doing its thing #15

Closed gringer closed 7 years ago

gringer commented 7 years ago

When I run porechop, even in verbose mode 2, it reports nothing to the screen until the run has finished. This means that I can't tell the difference between a frozen program and a program that is working properly. Runtime output in verbose mode would be also useful because it allows me to work out fairly promptly if all the adapters are being detected, or if something needs to be changed.

Demonstration of this situation, testing with 10 sequences (breaks as soon as 10 lines have been seen):

$ time porechop -v 2 -i porechop_test_10.fastq -o out.fastq | head -n 10

Looking for known adapter sets
                                        Best               
                                        read       Best    
                                        start      read end
  Set                                   %ID        %ID     
  SQK-NSK007                                86.2       72.7
  Rapid                                     57.9        0.0
  SQK-MAP006                                83.3       95.5
  SQK-MAP006 Short                          65.4       44.8
Traceback (most recent call last):
  File "/usr/local/bin/porechop", line 11, in <module>
    load_entry_point('porechop==0.2.1', 'console_scripts', 'porechop')()
  File "/usr/local/lib/python3.5/dist-packages/porechop/porechop.py", line 43, in main
    display_adapter_set_results(matching_sets, args.verbosity, args.print_dest)
  File "/usr/local/lib/python3.5/dist-packages/porechop/porechop.py", line 285, in display_adapter_set_results
    fixed_col_widths=[35, 8, 8])
  File "/usr/local/lib/python3.5/dist-packages/porechop/misc.py", line 270, in print_table
    print(indenter + row_str, flush=True, file=print_dest)
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

real    0m1.757s
user    0m0.928s
sys 0m0.028s

Same operation, but with 100 sequences (breaks as soon as 10 lines have been seen). Note that the run time (shown at the end) is substantially greater:

$ time porechop -v 2 -i porechop_test_100.fastq -o out.fastq | head -n 10

Looking for known adapter sets
                                        Best               
                                        read       Best    
                                        start      read end
  Set                                   %ID        %ID     
  SQK-NSK007                                96.4       80.0
  Rapid                                     60.7        0.0
  SQK-MAP006                                86.2       95.5
  SQK-MAP006 Short                          72.0       68.0
Traceback (most recent call last):
  File "/usr/local/bin/porechop", line 11, in <module>
    load_entry_point('porechop==0.2.1', 'console_scripts', 'porechop')()
  File "/usr/local/lib/python3.5/dist-packages/porechop/porechop.py", line 43, in main
    display_adapter_set_results(matching_sets, args.verbosity, args.print_dest)
  File "/usr/local/lib/python3.5/dist-packages/porechop/porechop.py", line 285, in display_adapter_set_results
    fixed_col_widths=[35, 8, 8])
  File "/usr/local/lib/python3.5/dist-packages/porechop/misc.py", line 270, in print_table
    print(indenter + row_str, flush=True, file=print_dest)
BrokenPipeError: [Errno 32] Broken pipe
Exception ignored in: <_io.TextIOWrapper name='<stdout>' mode='w' encoding='UTF-8'>
BrokenPipeError: [Errno 32] Broken pipe

real    0m13.819s
user    0m4.540s
sys 0m0.068s
rrwick commented 7 years ago

Yes, this was definitely one of Porechop's more annoying warts - it's frustrated me too. I've just released version 0.2.2 which now includes some simple progress updates for the time-consuming steps, so you can be sure it's not frozen.

Thanks!