Questions tagged [htslib]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
40 views

Reading same BAM file twice with htslib

I would like to read iteratively the same BAM file twice using htslib. My option is to use hts_open, ...
unamourdeswann's user avatar
1 vote
2 answers
345 views

Can HTSlib extract bam reads occurring in a specific region without iterating through the whole file?

I am using htslib/sam.h to write a C++ program. As part of this program, I must extract reads occurring on specific scaffolds in specific regions from a bam file. Essentially, I want to perform the ...
annabelperry's user avatar
2 votes
1 answer
151 views

How do I access sequence and MAPQ from bam using HTSlib in C++?

I am using the "htslib/sam.h" header in C++. I need to access the SEQ field of bam reads and store each sequence in a vector of strings. I also need to access the MAPQ field of each read to ...
annabelperry's user avatar
3 votes
1 answer
230 views

Use Htslib to extract specific region of vcf file

I am working in c++ using the htslib library to parse different vcf files as well as fasta files. My goal is to read in a specific region from a fastafile and then extract all the VCF sites within ...
RAHenriksen's user avatar
0 votes
1 answer
890 views

extract chimeric and multimap reads from bam file

I am trying to extract all chimeric and multi-map reads from either SAM/BAM file. Is there any simple command to do that? Can I use htslib for parsing sam/bam files ...
SBDK8219's user avatar
  • 195
1 vote
1 answer
131 views

How to print alternative allele from VCF with htslib c++

I would like to print the alternative allele from a vcf file which i load in with htslib. The description of some functions: https://github.com/samtools/htslib/blob/develop/htslib/vcf.h I have used ...
RAHenriksen's user avatar
1 vote
0 answers
313 views

How to troubleshoot access to tabix file via http or https?

I have some BED files that I have compressed with bgzip and indexed with tabix. I am using version ...
Alex Reynolds's user avatar
2 votes
1 answer
144 views

SAM format: Does the BAM "Integer or numeric array" field no longer exist? Why?

The SAM file format specification makes clear that optional fields must follow the format TAG:TYPE:VALUE ...
EB2127's user avatar
  • 1,403
7 votes
2 answers
645 views

How does htslib/samtools access optional BAM fields?

I am confused regarding how various software libraries deal with optional fields in a BAM: Based upon the BAM specification, there are 11 mandatory fields to a BAM: ...
EB2127's user avatar
  • 1,403
3 votes
1 answer
769 views

How to use C++ htslib to read VCF contig name and size?

A typical VCF file has: ##contig=<ID=chr1,length=248956422> ##contig=<ID=chr2,length=242193529> I would like to use ...
SmallChess's user avatar
  • 2,739
5 votes
2 answers
2k views

bcftools output vs. bgzip

I've got what seems like it should be a simple question, but I can't seem to figure it out from google. bcftools has 4 output options: ...
heathobrien's user avatar
  • 1,816
13 votes
1 answer
4k views

What's the difference between VCF spec versions 4.1 and 4.2?

What are the key differences between VCF versions 4.1 and 4.2? It looks like v4.3 contains a changelog (specs available here) but earlier specifications do not. This biostar post points out one ...
blmoore's user avatar
  • 366