Commit 62343301 authored by Moritz Pflanzer's avatar Moritz Pflanzer
Browse files

Added fasta support

parent 30640d09
......@@ -69,6 +69,42 @@ string loadFromRaw(string path)
return s;
}
string loadFromFastq(string path)
{
ifstream fastqFile(path.c_str());
stringstream buffer;
string line;
while(std::getline(fastqFile, line))
{
if(line.size() == 0)
{
continue;
}
// Skip header (FASTQ and FASTQ)
if(line[0] == '@' || line[0] == '>')
{
continue;
}
// Skip repeated header and qualities (FASTQ)
else if(line[0] == '+')
{
std::getline(fastqFile, line);
}
// Add base calls to buffer
else
{
buffer << line;
}
}
fastqFile.close();
return buffer.str();
}
void writeToRaw(string data, string path)
{
ofstream ofs(path.c_str());
......
......@@ -77,7 +77,7 @@ public:
long filesize=SystemTools::getFileSize(referencePath);
string reference=loadFromRaw(referencePath);
string reference=loadFromFastq(referencePath);
reflength=reference.length();
......
......@@ -12,22 +12,7 @@ public:
void load(string path)
{
ifstream fastqFile(path.c_str());
stringstream buffer;
string line;
for(int i = 0; std::getline(fastqFile, line); ++i)
{
if(i % 4 == 1)
{
buffer << line;
}
}
fastqFile.close();
data = buffer.str();
data = loadFromFastq(path);
long dl=data.length();
cdata=new char[dl+16];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment