File: fastqdataset.cpp

package info (click to toggle)
mothur 1.48.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 13,684 kB
  • sloc: cpp: 161,854; makefile: 122; sh: 31
file content (73 lines) | stat: -rw-r--r-- 2,427 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
//
//  fastqdataset.cpp
//  Mothur
//
//  Created by Sarah Westcott on 3/31/16.
//  Copyright (c) 2016 Schloss Lab. All rights reserved.
//

#include "fastqdataset.h"

/***********************************************************************/
TestFastqDataSet::TestFastqDataSet() {  m = MothurOut::getInstance();  }
/***********************************************************************/
vector<string> TestFastqDataSet::getSubsetFRFastq(int numSeqs) {
    
    fillForwardFastq();
    fillReverseFastq();
    ofstream out, out2;
    util.openOutputFile("tempForward.txt", out); util.openOutputFile("tempReverse.txt", out2);
    for (int i = 0; i < numSeqs; i++) {
        ffastqReads[i].printFastq(out);
        rfastqReads[i].printFastq(out2);
    }
    
    vector<string> filenames; filenames.push_back("tempForward.txt"); filenames.push_back("tempReverse.txt");
    
    return filenames;
}
/***********************************************************************/
void TestFastqDataSet::fillForwardFastq() {
    ffastqReads.clear();
    
    //read info from stable file
    string testfile = "/Users/sarahwestcott/Desktop/mothur/TestMothur/TestFiles/F8D0_S345_L001_R1_001.fastq";
    
    ifstream in;
    util.openInputFile(testfile, in);
    
    int count = 0; bool ignore = false; string format = "illumina1.8+";
    while (!in.eof()) {
        if (m->getControl_pressed()) { break; }
        
        if (count < 2000) {
            FastqRead read(in, ignore, format); util.gobble(in);
            if (!ignore) { ffastqReads.push_back(read);  count++; }
        }else { break; }
        
    }
    in.close();
}
/***********************************************************************/
void TestFastqDataSet::fillReverseFastq() {
    rfastqReads.clear();
    
    //read info from stable file
    string testfile = "/Users/sarahwestcott/Desktop/mothur/TestMothur/TestFiles/F8D0_S345_L001_R2_001.fastq";
    
    ifstream in;
    util.openInputFile(testfile, in);
    
    int count = 0; bool ignore = false; string format = "illumina1.8+";
    while (!in.eof()) {
        if (m->getControl_pressed()) { break; }
        
        if (count < 2000) {
            FastqRead read(in, ignore, format); util.gobble(in);
            if (!ignore) { rfastqReads.push_back(read);  count++; }
        }else { break; }
        
    }
    in.close();
}
/***********************************************************************/