cbib / MICADo

Looking for mutations in PacBio cancer data: an alignment-free method
Other
8 stars 2 forks source link

Division by zero #22

Closed ghost closed 5 years ago

ghost commented 8 years ago

MICADo will divide by zero (and crash) if, for a given experiment exp1, the data/fastq/exp1 directory exist but is empty.

For the minimal exemple shown in README.md, the output is the following:

2016-06-22 10:19:36,181 - MICADo - INFO - Will import
2016-06-22 10:19:37,425 - MICADo - INFO - Import finished
/home/marespiaut/cbib/MICADo/src/seq_lib.py:66: SyntaxWarning: name 'read_library' is assigned to before global declaration
  global read_library
2016-06-22 10:19:37,447 - SEQLIB - INFO - Setting up SEQLIB
2016-06-22 10:19:37,448 - SEQLIB - INFO - Force rebuilding
2016-06-22 10:19:37,448 - SEQLIB - INFO - will rebuild library
2016-06-22 10:19:37,449 - SEQLIB - INFO - Found 0 fastq file to process
2016-06-22 10:19:37,450 - SEQLIB - INFO - Iterated all 0 items
2016-06-22 10:19:37,450 - SEQLIB - INFO - Will save 0 items
2016-06-22 10:19:37,451 - SEQLIB - INFO - Packed to 1 chars
2016-06-22 10:19:37,452 - SEQLIB - INFO - Serialized to file data/seq/TP53_1466583577_0.packb
2016-06-22 10:19:37,454 - SEQLIB - INFO - will unpack read library
2016-06-22 10:19:37,454 - SEQLIB - INFO - De-Serialized 0 read lib
2016-06-22 10:19:37,455 - MICADo - INFO - Will build reference graph with k==20 and fasta=data/reference/reference_TP53.fasta & snp=data/reference/snp_TP53.tab
2016-06-22 10:19:58,840 - MICADo - INFO - Will build patient graph for ../PACBIOP53/fastqv3pool_0_trimmed0.1/C_158_1.fastq with k==20 and minimum support = 3pct
2016-06-22 10:19:58,840 - Patient graph - INFO - Considering file ../PACBIOP53/fastqv3pool_0_trimmed0.1/C_158_1.fastq for fastq C_158_1
2016-06-22 10:20:02,884 - MICADo - INFO - Before cleaning: 7984 nodes
2016-06-22 10:20:08,159 - MICADo - INFO - After cleaning: 536 nodes
2016-06-22 10:20:14,718 - Patient graph - INFO - Will apply [('delete', 20, 20)]
2016-06-22 10:20:14,719 - Patient graph - INFO - Adding atomic alteration for ref AGAATCTCCGCAAGAAAGGGGAGCCTCACCACGAGCTG vs alt AGAATCTCCGCAAGAAAGGGAGCCTCACCACGAGCTG
2016-06-22 10:20:14,727 - Patient graph - INFO - Will apply [('delete', 20, 20)]
2016-06-22 10:20:14,727 - Patient graph - INFO - Adding atomic alteration for ref TTCACCCTTCAGATCCGTGGGCGTGAGCGCTTCGAGATG vs alt TTCACCCTTCAGATCCGTGGCGTGAGCGCTTCGAGATG
2016-06-22 10:20:14,733 - Patient graph - INFO - Will apply [('insert', 20, 20)]
2016-06-22 10:20:14,734 - Patient graph - INFO - Adding atomic alteration for ref CCTCACCACGAGCTGCCCCCAGGGAGCACTAAGCG vs alt CCTCACCACGAGCTGCCCCCCAGGGAGCACTAAGCG
2016-06-22 10:20:14,739 - Patient graph - INFO - Will apply [('delete', 20, 20)]
2016-06-22 10:20:14,740 - Patient graph - INFO - Adding atomic alteration for ref GCCTCACCACGAGCTGCCCCCAGGGAGCACTAAGCGA vs alt GCCTCACCACGAGCTGCCCCAGGGAGCACTAAGCGA
2016-06-22 10:20:14,747 - Patient graph - INFO - Will apply [('delete', 20, 20)]
2016-06-22 10:20:14,748 - Patient graph - INFO - Adding atomic alteration for ref AGCACTAAGCGAGCACTGCCCAACAACACCAGCTCCTCT vs alt AGCACTAAGCGAGCACTGCCAACAACACCAGCTCCTCT
2016-06-22 10:20:14,751 - MICADo - INFO - Will create random graphs
Traceback (most recent call last):
  File "src/principal.py", line 192, in <module>
    disable_cycle_breaking=args.disable_cycle_breaking
  File "src/principal.py", line 85, in process_sample
    g_random = RRG(g_patient.coverage, kmer_length, restrict_to=all_possible_kmers, seq_lib_module=seq_lib_module)
  File "/home/marespiaut/cbib/MICADo/src/randomreadsgraph.py", line 29, in __init__
    read_list = seq_lib_module.sampling(self.coverage_dict)
  File "/home/marespiaut/cbib/MICADo/src/seq_lib.py", line 73, in sampling
    read_number_by_sample = coverage / len(read_library)
ZeroDivisionError: integer division or modulo by zero
JRudewicz commented 5 years ago

Yes, please do not provide an empty file.