Open main menu

Genome Analysis Wiki β

Changes

LibStatGen: FASTQ

1,576 bytes added, 16:18, 12 March 2010
no edit summary
ERROR on Line 33: No Sequence Identifier specified before the comment.
 
== Use of the FastQFile class ===
Generally this class is used to read a fastq file and perform operations on the sequences.
Here is an example of how this would be done.
 
bool <yourMethod>()
{
String filename = <your filename>;
BaseAsciiMap::SPACE_TYPE spaceType = <BASE_SPACE/COLOR_SPACE>;
// Open the fastqfile.
if(openFile(filename, spaceType) != FASTQ_SUCCESS)
{
// Failed to open the specified file.
// Report the error and exit (handled by error).
error("Failed to open file: %s", filename.c_str());
return (false);
}
// Keep reading the file until there are no more fastq sequences to process.
while (!ifeof(myFile))
{
// Read one sequence. This call will read all the lines for
// one sequence.
FastQFile::FastQStatus = readFastQSequence;
/////////////////////////////////////////////////////////////////
// NOTE: It is up to you if you want to process only for success:
// if(readFastQSequence() == FASTQ_SUCCESS)
// or for FASTQ_SUCCESS and FASTQ_INVALID:
// if(readFastQSequence() != FASTQ_FAILURE)
// Do NOT try to process on a FASTQ_FAILURE
/////////////////////////////////////////////////////////////////
if(readFastQSequence() == FASTQ_SUCCESS)
{
// The sequence is valid.
<Your Processing Here>
}
}
// Finished processing all of the sequences in the file.
// Close the input file.
closeFile();
return(true/false); // It is up to you to determine what is considered success/failure.
}
== Validation Criteria Used For Reading a Sequence ==