Hi Aaron, currently, I/O is a bit of a sore point for SeqAn users since there is no real documentation at this point. However, we are currently working on this, so it should be much better in the next release. Meanwhile, I recommend you to look at the actual I/O code, e.g. the loadReads() function in module store. For your problem, there is a simple solution. Instead of using "while (!faStream.is_open())" and "while (cin)", you have to use "while (!seqan::_streamEOF(std::faStream))" and "while (!seqan::_streamEOF(std::cin)". I'm sorry about any inconvenience. Bests, Manuel Am 10.03.2011 um 02:59 schrieb Aaron Quinlan: > Hi all, > I am trying to use the SeqAn Fasta reading API to do a basic conversion of a Fasta file. My listing compiles fine and works when run on a proper file. However, when the Fasta file is passed via stdin (cin), I doesn't work. My question is whether or not the reader API in file.h can work with standard in? It seems like it should as cin can be treated as just an istream pointer... > > I would be grateful for help, as I am sure there is a trivial solution. > > $ cat faToTab.cpp > > #include <iostream> > #include <fstream> > #include <cstdio> > #include <seqan/sequence.h> > #include <seqan/file.h> > > using namespace std; > using namespace seqan; > > int main(int argc, char* argv[]) > { > > if (argc > 1) { > ifstream faStream; > faStream.open(argv[1], ios::in); > if ( !faStream.is_open() ) { > cerr << "Error: The requested file (" << argv[1] << ") could not be opened. Exiting!" << endl; > exit (1); > } > else { > String<char> name; > String<Dna5> seq; > while (!faStream.eof()) > { > readMeta(faStream, name, Fasta()); > read(faStream, seq, Fasta()); > cout << name << "\t" << seq << endl; > } > } > } > else { > String<char> name; > String<Dna5> seq; > while (cin) > { > readMeta(cin, name, Fasta()); > read(cin, seq, Fasta()); > cout << name << "\t" << seq << endl; > } > } > } > > $ faToTab test.fa > 1 GAGAGAG > 2 AGGGAGGAGAGGACCC > > $ cat test.fa | faToTab > ? > > Best, > Aaron > > Aaron Quinlan, Ph.D. > University of Virginia > Box 800717 > Charlottesville, VA 22908 > (T) 434.243.1669 (F) 434.924.1312 > cphg.virginia.edu/quinlan > arq5x@virginia.edu > > > > _______________________________________________ > seqan-dev mailing list > seqan-dev@lists.fu-berlin.de > https://lists.fu-berlin.de/listinfo/seqan-dev