cbg-ethz / shorah

Repo for the software suite ShoRAH (Short Reads Assembly into Haplotypes)
GNU General Public License v3.0
39 stars 14 forks source link

IndexError exception raised due to reads.fas being empty #38

Closed terrycojones closed 6 years ago

terrycojones commented 6 years ago

I run shorah.py as follows:

$ shorah.py -b alignment.bam.sorted -f data.fasta

and get an error:

Traceback (most recent call last):
  File "/opt/shorah/bin/shorah.py", line 139, in <module>
    alpha=args.a, keep_files=args.k, seed=args.S)
  File "/opt/shorah/lib/python3.5/site-packages/shorah_dec.py", line 403, in main
    r = list(aligned_reads.keys())[0]
IndexError: list index out of range

The code is assuming that reads.fas contains reads, but in my case that file is empty.

It's not immediately clear to me where reads.fas is created. In shorah.log I see

$ cat shorah.log
INFO 2017-12-03 18:42:07,585 <module>                          130 /opt/shorah/bin/shorah.py -b alignment.bam.sorted -f data.fasta
DEBUG 2017-12-03 18:42:07,585 <module>                          136 running dec.py

Ah, now I see it:

$ strings /opt/shorah/bin/b2w | grep reads\\.fas
reads.fas
w-%s-%d-%d.reads.fas

Any suggestions?

Thanks!

ozagordi commented 6 years ago

Hi! I would first rename your bam file to something like alignment_sorted.bam. Then, are reads correctly aligned with a good coverage? You can inspect the alignment with samtools tview alignment_sorted.bam data.fasta. Before proceeding, though, I must warn you that global reconstruction is a difficult problem. Low diversity of the sample, short reads, and conserved regions, al contribute to low reliability of the results. Maybe enough to just run a local reconstruction?

Let us know.

yorickdevries commented 6 years ago

Have you tried to change the size of your window ("-w") to a smaller size? I solved this error by changing the window size to somewhat smaller than my average read size as suggested on http://cbg-ethz.github.io/shorah/local.html

terrycojones commented 6 years ago

Hi. Thanks for the replies! I'm a bit busy on a couple of other things right now, but will get back to this soon I hope.