+/**************************************************************************************************/
+inline vector<unsigned long int> setFilePosFasta(string filename, int& num) {
+
+ vector<unsigned long int> positions;
+ ifstream inFASTA;
+ openInputFile(filename, inFASTA);
+
+ string input;
+ while(!inFASTA.eof()){
+ input = getline(inFASTA); gobble(inFASTA);
+ if (input.length() != 0) {
+ if(input[0] == '>'){ unsigned long int pos = inFASTA.tellg(); positions.push_back(pos - input.length() - 1); }
+ }
+ }
+ inFASTA.close();
+
+ num = positions.size();
+
+ /*FILE * pFile;
+ long size;
+
+ //get num bytes in file
+ pFile = fopen (filename.c_str(),"rb");
+ if (pFile==NULL) perror ("Error opening file");
+ else{
+ fseek (pFile, 0, SEEK_END);
+ size=ftell (pFile);
+ fclose (pFile);
+ }*/
+
+ unsigned long int size = positions[(positions.size()-1)];
+ ifstream in;
+ openInputFile(filename, in);
+
+ in.seekg(size);
+
+ while(char c = in.get()){
+ if(in.eof()) { break; }
+ else { size++; }
+ }
+ in.close();
+
+ positions.push_back(size);
+
+ return positions;
+}
+/**************************************************************************************************/
+inline vector<unsigned long int> setFilePosEachLine(string filename, int& num) {
+
+ vector<unsigned long int> positions;
+ ifstream in;
+ openInputFile(filename, in);
+
+ string input;
+ while(!in.eof()){
+ unsigned long int lastpos = in.tellg();
+ input = getline(in); gobble(in);
+ if (input.length() != 0) {
+ unsigned long int pos = in.tellg();
+ if (pos != -1) { positions.push_back(pos - input.length() - 1); }
+ else { positions.push_back(lastpos); }
+ }
+ }
+ in.close();
+
+ num = positions.size();
+
+ FILE * pFile;
+ unsigned long int size;
+
+ //get num bytes in file
+ pFile = fopen (filename.c_str(),"rb");
+ if (pFile==NULL) perror ("Error opening file");
+ else{
+ fseek (pFile, 0, SEEK_END);
+ size=ftell (pFile);
+ fclose (pFile);
+ }
+
+ positions.push_back(size);
+
+ return positions;
+}
+