modified: src1/worker.c
[GalaxyCodeBases.git] / c_cpp / etc / mVicuna / src / ReadBioFile.cpp
blob8b8ca4ef4e4c804083b3f3f5bbbb7ee4397f5bf1
1 //========================================================================
2 // Project : M-Vicuna
3 // Name : ReadBioFile.cpp
4 // Author : Xiao Yang
5 // Created on : Jun 4, 2013
6 // Version : 1.0
7 // Copyright : The Broad Institute
8 // SOFTWARE COPYRIGHT NOTICE AGREEMENT
9 // This software and its documentation are copyright (2013)
10 // by the Broad Institute. All rights are reserved.
12 // This software is supplied without any warranty or
13 // guaranteed support whatsoever. The Broad Institute cannot
14 // be responsible for its use, misuse, or functionality.
15 // Description :
16 //========================================================================
18 #include "ReadBioFile.h"
20 /** Retrieve num records (header, read, qual) from fastq file pointed by
21 * iter
23 void add_fq_reads (std::vector<fqtuple_t>& seq, int num,
24 bio::fastq_input_iterator<>& iter, bio::fastq_input_iterator<> end){
25 int cnt = 0;
26 for (; iter != end; ++ iter) {
27 seq.push_back (*iter);
28 ++ cnt;
29 if (cnt >= num) {
30 ++ iter;
31 return;
34 } // add_fq_reads
36 void add_fq_reads_only (strvec_t& seq, int num,
37 bio::fastq_input_iterator<>& iter, bio::fastq_input_iterator<> end){
38 int cnt = 0;
39 for (; iter != end; ++ iter) {
40 seq.push_back (std::get<1>(*iter));
41 ++ cnt;
42 if (cnt >= num) {
43 ++ iter;
44 return;
49 void add_fa_reads (std::vector<strpair_t>& seq, int num,
50 bio::fasta_input_iterator<>& iter, bio::fasta_input_iterator<> end){
51 int cnt = 0;
52 for (; iter != end; ++ iter) {
53 seq.push_back (*iter);
54 ++ cnt;
55 if (cnt >= num) {
56 ++ iter;
57 return;
60 } //add_fa_reads
62 void add_fa_reads_only (strvec_t& seq, int num,
63 bio::fasta_input_iterator<>& iter, bio::fasta_input_iterator<> end){
64 int cnt = 0;
65 for (; iter != end; ++ iter) {
66 seq.push_back (iter->second);
67 ++ cnt;
68 if (cnt >= num) {
69 ++ iter;
70 return;
73 } //add_fa_reads