I have large tabular text files that contain both numbers and letters. I want to use the numbers. What is the fastest way to read these data.
Currently I'm doing
while(!geno_stream.atEnd())
{
QString genoRow
= geno_stream.
readLine();
for(int i=0; i<row.size(); i++)
{
double value;
if(row.at(i)!="NA") value=row.at(i).toDouble();
else value =-9.0
}
}
QFile genofile(Genoname); if(!genofile.open(QIODevice::ReadOnly | QIODevice::Text)) {exit(1);}
QTextStream geno_stream(&genofile);
while(!geno_stream.atEnd())
{
QString genoRow = geno_stream.readLine();
QStringList row = genoRow.split("\t");
for(int i=0; i<row.size(); i++)
{
double value;
if(row.at(i)!="NA") value=row.at(i).toDouble();
else value =-9.0
}
}
To copy to clipboard, switch view to plain text mode
I need the process to be maximally fast. Is this a fast way?
What would be the best way when the data don't contain letters (all are numbers)?
Bookmarks