Questions tagged [c++]
The c++ tag has no usage guidance.
20
questions
0
votes
0
answers
21
views
Use Htslib to create auxilary tags in bam file C++
I am creating a threaded c++ file where i generate in silico bam files, using header, DNA sequence and read information.
First i use bam_init1() to create the bam1_t structure just named "b"....
1
vote
2
answers
129
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 ...
2
votes
1
answer
50
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 ...
2
votes
3
answers
99
views
Unable to open .bam file in C++ using SeqAn due to 'seqan::UnknownExtensionError'
I am trying to open .bam files in C++ to extract reads occurring at specific scaffolds and loci. I essentially want to call "samtools view sample.bam -o sample.sam scaffold:pos-pos" from C++....
2
votes
2
answers
226
views
Construct the Overlap Graph of a Collection of k-mers
I am doing a course on graph algorithms in genome sequencing and the current assignment involves building an overlap graph from a bunch of k-mers. Formally the problem is as follows:
Input: A ...
3
votes
1
answer
156
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 ...
1
vote
1
answer
70
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 ...
0
votes
1
answer
161
views
Reading fasta sequence regions with faidx
Im coding in c++ and reading in different reference genomes to examine regions across the chromosomes a few hundred basepairs at a time.
To do it in c++ i use the library htslib and the command ...
1
vote
0
answers
83
views
How do I Read a Sam File into a String Using ifstream in C++?
I am trying to read a .sam file into a single string in C++. My end goal is to read this string into a vector, where tabs indicate separations between elements of the vector. After making a vector ...
0
votes
1
answer
498
views
c++ program to find length string an char* [closed]
I write under code but I can't run it when I run by g++ . erro is about strlen.
errors:
...
1
vote
1
answer
105
views
Non-random access on a fastq file
There was a nice question on random access on a fastq file, however I have the opposite problem. I want to programatically access non-random fastq entries quickly (using C++).
Say I have several ...
2
votes
1
answer
155
views
How is consensus alignment for OLC assembly usually implemented?
Background
In C++ I want to implement a simple class that performs overlap layout consensus assembly but I can not figure out the most logical data structure to use for the consensus alignment step.
...
7
votes
1
answer
701
views
Multithread fastq processing with kseq.h in C++11?
Background
I am using the wonderful kseq.h as my fastq/fasta parser for a C++ project. My actual implementation uses something like this, where I am counting kmers ...
13
votes
1
answer
726
views
What is the most compact data structure for canonical k-mers with the fastest lookup time?
edit: Results are current as of Dec 4, 2018 13:00 PST.
Background
K-mers have many uses in bioinformatics, and for this reason it would be useful to know the most RAM-efficient and fastest way to ...
0
votes
1
answer
147
views
While opening a Bam file with the SeqAn library I get 'seqan::FileOpenError' [closed]
When I try to open a simple bam file with the SeqAn library using the following code:
...
3
votes
1
answer
601
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 ...
9
votes
3
answers
578
views
How to calculate the memory usage of storing kmers in RAM
I want to write a program in C++ that stores kmers in a hash or in a trie. How can I calculate how much RAM I would need for each type of data structure? For this application my kmers are strand-...
7
votes
2
answers
730
views
How to write a hash function for canonical kmers?
This question is a follow up from How do kmer counters determine which kmer is 'canonical'?.
In that question we learned that kmer counting programs use a 2-bit hash function to internally represent ...
5
votes
3
answers
623
views
Read sorted and indexed BAM files faster in C++?
I have some sorted and indexed alignment large BAM files. I'd like to read all the reads, and apply custom operation on each of them. The orders aren't important. I'm using ...
6
votes
1
answer
599
views
How to build a BAM header file with htslib in C++?
I'd like to use C++ to generate a new BAM file programmatically. This is an example how to use htslib to generate a new BCF file on the fly.
https://github.com/samtools/htslib/blob/develop/test/...