Skip to content

Instantly share code, notes, and snippets.

@chadbrewbaker
Created February 5, 2012 20:18
Show Gist options
  • Save chadbrewbaker/1747759 to your computer and use it in GitHub Desktop.
Save chadbrewbaker/1747759 to your computer and use it in GitHub Desktop.
FASTAQ sequence extractor
//Simple fastaq sequence extractor
//Usage: fqextract.out FILEIN > FILEOUT
#include <iostream>
#include <string>
#include <fstream>
#include <cstdlib>
using namespace std;
int main(int argc,char **argv)
{
string line;
ifstream in(argv[1],ios::in);
if(!in.is_open()) return EXIT_FAILURE;
while(getline(in,line,'\n')){ //name
getline(in,line,'\n'); //seq
std:cout << line << endl;
getline(in,line,'\n'); //name2
getline(in,line,'\n'); //seq2
}
in.close();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment