bede / kindel

Indel-aware consensus from aligned BAMs
GNU General Public License v3.0
20 stars 2 forks source link

ValueError: min() arg is an empty sequence #16

Closed joelnitta closed 4 years ago

joelnitta commented 4 years ago

Hi, thanks for making this software available!

I am running into an error with kindel consensus:

kindel consensus align.sam > test.fasta
...
building consensus: 100%|████████████████████████████████████████████████████████████| 90/90 [00:00<00:00, 140853.49it/s]
Traceback (most recent call last):
  File "/env/kindel/bin/kindel", line 8, in <module>
    sys.exit(main())
  File "/env/kindel/lib/python3.6/site-packages/kindel/cli.py", line 83, in main
    parser.dispatch()
  File "/env/kindel/lib/python3.6/site-packages/argh/helpers.py", line 55, in dispatch
    return dispatch(self, *args, **kwargs)
  File "/env/kindel/lib/python3.6/site-packages/argh/dispatching.py", line 174, in dispatch
    for line in lines:
  File "/env/kindel/lib/python3.6/site-packages/argh/dispatching.py", line 277, in _execute_command
    for line in result:
  File "/env/kindel/lib/python3.6/site-packages/argh/dispatching.py", line 260, in _call
    result = function(*positional, **keywords)
  File "/env/kindel/lib/python3.6/site-packages/kindel/cli.py", line 28, in consensus
    uppercase)
  File "/env/kindel/lib/python3.6/site-packages/kindel/kindel.py", line 417, in bam_to_consensus
    uppercase)
  File "/env/kindel/lib/python3.6/site-packages/kindel/kindel.py", line 385, in build_report
    report += '- min, max observed depth[50:-50]: {}, {}\n'.format(min(aligned_depth[50:-50]),
ValueError: min() arg is an empty sequence

I suspect the problem must be in the data somewhere because I am running kindel consensus over a list of files, and it only errors out on some of them. If it would help with troubleshooting I can send the sam file.

environment.yml ``` name: kindel channels: - bioconda - defaults dependencies: - _libgcc_mutex=0.1=main - ca-certificates=2020.10.14=0 - certifi=2020.6.20=py36_0 - ld_impl_linux-64=2.33.1=h53a641e_7 - libedit=3.1.20191231=h14c3975_1 - libffi=3.3=he6710b0_2 - libgcc-ng=9.1.0=hdf63c60_0 - libstdcxx-ng=9.1.0=hdf63c60_0 - ncurses=6.2=he6710b0_1 - openssl=1.1.1h=h7b6447c_0 - pip=20.2.3=py36_0 - python=3.6.12=hcff3b4d_2 - readline=8.0=h7b6447c_0 - setuptools=50.3.0=py36hb0f4dca_1 - sqlite=3.33.0=h62c20be_0 - tk=8.6.10=hbc83047_0 - wheel=0.35.1=py_0 - xz=5.2.5=h7b6447c_0 - zlib=1.2.11=h7b6447c_3 - pip: - argh==0.26.2 - biopython==1.78 - kindel==0.4.2 - numpy==1.19.2 - ordereddict==1.1 - pandas==1.1.3 - python-dateutil==2.8.1 - pytz==2020.1 - scipy==1.5.2 - simplesam==0.1.3.1 - six==1.15.0 - tqdm==4.50.2 ```
bede commented 4 years ago

Hi Joel, Thanks! I've sent you an email – if you can share the sam/bam I can look into it : )

joelnitta commented 4 years ago

Thanks so much for the prompt reply! I sent the file.

bede commented 4 years ago

Thanks for making this easy to troubleshoot @joelnitta. The issue was the <100nt reference contigs in your SAM file. I've removed this assumption and revised the report format slightly, as well as fixing an unrelated bug in SAM 1.4 X record parsing. These changes are in 0.4.3 which is up on PyPI. Please let me know if you run into more issues, and please cite the JOSS article if this tool is useful in your research.

joelnitta commented 4 years ago

Thanks so much for quickly fixing the problem! That certainly solved it, now all of my samples work. I will be sure to cite the paper if I end up using kindel.