Questions tagged [c++]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
2
votes
2answers
55 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
1answer
76 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
1answer
45 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
1answer
74 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
0answers
43 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
1answer
363 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
1answer
97 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
1answer
125 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
1answer
562 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 ...
11
votes
1answer
593 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
1answer
132 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
1answer
470 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
3answers
523 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
2answers
612 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
3answers
537 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
1answer
536 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/...