void parseSeqs(string filename, SeqSet &data) { ifstream input; SeqStream input_stream(openSeqFile(filename, input)); if(!input_stream.good()) { throw("File stream is in a bad state"); } string format = guessFormat(input_stream); if(format == "fasta") { try { parseFasta(input_stream, filename, data); } catch(...) { input.close(); throw; } } else if(format == "fastq") { try { parseFastq(input_stream, filename, data); } catch(...) { input.close(); throw; } } else { input.close(); throw("Unrecognized format"); } input.close(); }
void CEPasteDialog::refresh() { switch (guessFormat(m_text)) { case InvalidFormat: default: refreshInvalidFormat(); break; case VaspFormat: refreshVaspFormat(); break; } }
void CEPasteDialog::accept() { switch (guessFormat(m_text)) { case InvalidFormat: default: break; case VaspFormat: if (!acceptVaspFormat()) { return; } break; } QDialog::accept(); }
string guessFormat(SeqStream s) { string format = ""; return guessFormat(s, format); }