skovaka / uncalled4

MIT License
43 stars 3 forks source link

Specify two bam files for refstats ks test #32

Open kayleewatson opened 1 month ago

kayleewatson commented 1 month ago

Hi,

I'm using the latest 4.1.0 version and refstats works perfectly for a single bam input, but how does the --bam-in flag work for multiple bam files? I'm wanting to compute ks stat. I tried just listing both bam files after --bam-in, but I got the error below:

  File "/usr/local/packages/miniconda3/envs/uncalled4/bin/uncalled4", line 8, in <module>
    sys.exit(main())
  File "/usr/local/packages/miniconda3/envs/uncalled4/lib/python3.9/site-packages/uncalled4/__main__.py", line 358, in main
    ret = fn(conf=conf)
  File "/usr/local/packages/miniconda3/envs/uncalled4/lib/python3.9/site-packages/uncalled4/stats/refstats.py", line 59, in refstats
    for chunk in tracks.iter_refs():
  File "/usr/local/packages/miniconda3/envs/uncalled4/lib/python3.9/site-packages/uncalled4/tracks.py", line 1359, in iter_refs
    chunks[i] = next(layer_iters[i], (None, None))
  File "/usr/local/packages/miniconda3/envs/uncalled4/lib/python3.9/site-packages/uncalled4/io/bam.py", line 559, in iter_refs
    new_alns = pd.DataFrame(new_alns, columns=new_alns[0]._fields).set_index("id")
IndexError: list index out of range
skovaka commented 3 weeks ago

Sorry for the delayed response! Listing both files after the flag should work: --bam-in file1.bam file2.bam. Just make sure both BAM files were output by uncalled4 align or convert, and maybe try putting the --bam-in ... flag at the end of your command.

You could also try computing other statistics in addition to KS stats: --layers dtw.current --stats ks mean, or let me know if it works with two BAM files and no KS stats (--stats mean). I'm wondering if the bug is when computing KS stats, or just when parsing two BAM files at once.

kayleewatson commented 3 weeks ago

Thank you for your response, I just tried with some other files and it looks like one of my bam files is the problem (I'm doing some filtering so I probably just screwed up the format somewhere along the way). It's working by just listing the bam files after the flag like you mentioned. I appreciate the clarification on the command, and this tool has been extremely helpful!