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

Q: best practices to read vcf from stdin or string

andreas-wilm opened this issue · comments

Hey Brent,

it might be something obvious that I'm overlooking, but what would be considered best practice to parse a vcf from stdin or a string (generated from within Nim). Will I have to convert it to a temp file first to be able to use vcf.open?

Thanks,
Andreas

Hi Andreas, you can use "/dev/stdin" or just "-" to open a VCF from stdin.
Let me know any other questions.

Oh. I thought I had tried. Thanks.

The currently more important feature would be to be able to parse from a string (that an internal function generated). Possible?

yes. see: https://brentp.github.io/hts-nim/hts/vcf.html#from_string,Variant,Header,string

you'll still need a valid header, but it can parse directly from string.

God, I'm blind. Sorry. Thanks so much!

no problem. as you can see from the descriptions, there are problems with the docs. should be fixed next nim release.