brentp / hts-nim

nim wrapper for htslib for parsing genomics data files

Home Page:https://brentp.github.io/hts-nim/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Undocumented and possibly broken functions

sodic opened this issue · comments

Hello,

I've been working with hts-nim at GIS with @andreas-wilm.

I believe the documentation needs an update. I've encountered a couple of undocumented (but implemented) functions (e.g. base_at from the bam.nim module and the [] operator in the fai.nim module). The dynamic functionalities of the doc pages (search, group by...) are broken as well because the HTML relies on a missing a JavaScript file. However, this seems to be a problem with Nim's docgen package rather than with hts-nim. I've opened an issue aiming to get this fixed and it is probably a good idea to update the docs when they to :).

One more thing regarding the [] operator for Fai objects. It produces some strange results. Let's say we have a file called sample.fa with the following content:

>ref
ACGGTCGA

The following two programs execute normally:

import hts

var fai: Fai
discard open(fai, "sample.fa")
echo fai[0] # ouputs 'ref'
import hts

var fai: Fai
discard open(fai, "sample.fa")
echo fai.get("ref", 0, 2) # outputs 'ACG'

Hovewer, the following program fails with an error as if the [] call has consumed the reference somehow:

import hts

var fai: Fai
discard open(fai, "sample.fa")
echo fai[0]
echo fai.get("ref", 0, 2)

Similar strange behavior can be observed like this:

echo fai[0] # outputs 'ref'
echo fai[0] # outputs an empty string
echo fai[0] # outputs some junk, subsequent calls eventually detect a segmentation fault

Thanks,
Filip

thanks for reporting. I just pushed a fix for the issue with Fai. I will update the docs today.

please continue to let me know as you find problems like this. there are likely easily fixed bugs like this in areas of the API that I use less.

edit: docs updated. and I've subscribed to your issue.