3 #include <QDomDocument>
19 QList< US_Convert::TripleInfo >& triples,
23 const int channelID = 1;
24 QString error = QString(
"" );
27 QStringList q(
"delete_rawData" );
28 q << QString::number( ExpData.
expID );
36 q <<
"delete_experiment_solutions"
37 << QString::number( ExpData.
expID );
45 q <<
"delete_cell_experiments"
46 << QString::number( ExpData.
expID );
55 for (
int trx = 0; trx < triples.size(); trx++ )
65 qDebug() <<
"cvio:WrRDB: trx" << trx <<
"soluGUID"
67 QStringList q (
"get_solutionID_from_GUID" );
93 error +=
"Error processing buffer " +
95 "Buffer was not found in the database";
98 error +=
"Error processing analyte \n"
99 "An analyte was not found in the database";
102 error +=
"Error processing solution " +
104 "Solution was not found in the database";
107 error +=
"Error saving solution to DB " +
'\n' +
115 error +=
"Error processing solution " +
117 "Solution was not found in the database";
127 << QString::number( ExpData.
expID )
129 << QString::number( channelID );
140 triples[ trx ].tripleID = rawDataID;
144 QString(
"upload_aucData" ), rawDataID );
149 error +=
"Error processing file:\n" +
152 "Could not open file or no data \n";
157 error +=
"Error returned processing file:\n" +
165 error +=
"Error returned processing file:\n" +
173 QStringList parts = triple->
tripleDesc.split(
" / ");
174 QString cell = parts[ 0 ];
175 QString letters(
"0ABCDEFGH");
176 QString channel = parts[ 1 ];
177 int channelNum = letters.indexOf( channel );
180 q <<
"new_cell_experiment"
183 << QString::number( channelNum )
185 << QString::number( ExpData.
expID );
188 error +=
"Error returned writing cell record: " + cellGUID +
"\n" +
193 q <<
"new_experiment_solution"
194 << QString::number( ExpData.
expID )
196 << QString::number( channelID );
198 qDebug() <<
"cvio:WrRDB: newExp id solID chnID" << ExpData.
expID
202 error += QObject::tr(
"MySQL error associating experiment %1\n"
203 " with solution %2\n"
204 " code: %3 error: %4\n" )
210 if ( error != QString(
"" ) )
218 q <<
"delete_experiment"
219 << QString::number( ExpData.
expID );
225 error +=
"MySQL error deleting experiment "
226 + QString::number( ExpData.
expID )
235 return( QString(
"" ) );
240 US_DB2* db, QVector< SP_SPEEDPROFILE >& speedsteps )
244 QList< US_Convert::TripleInfo > triples;
245 qDebug() <<
"rDBE: call ExpData.readFromDB";
246 int readStatus = ExpData.
readFromDB( runID, db, speedsteps );
247 qDebug() <<
"rDBE: ss size ss0.sp ss0.avg" << speedsteps.size()
248 << speedsteps[0].rotorspeed << speedsteps[0].avg_speed;
251 return(
"The current run ID is not found in the database." );
261 qDebug() <<
"rDBE: remove local auc files";
263 QStringList nameFilters = QStringList(
"*.auc" );
264 QStringList files = d.entryList( nameFilters,
265 QDir::NoDotAndDotDot | QDir::Files );
266 foreach ( QString file, files )
267 if ( ! d.remove( file ) )
268 qDebug() <<
"Unable to remove file " << file;
271 qDebug() <<
"rDBE: call readRawDataFromDB";
273 if ( status != QString(
"" ) )
277 qDebug() <<
"rDBE: call ExpData.project.saveToDisk";
279 qDebug() <<
"rDBE: call solution.saveToDisk (loop)";
285 if ( csguid == psguid )
continue;
292 qDebug() <<
"rDBE: call ExpData.saveRIDisk";
297 qDebug() <<
"rDBE: call ExpData.saveToDisk";
299 QVector< SP_SPEEDPROFILE > sp_dmy;
301 runID, dir, sp_dmy );
304 runID, dir, speedsteps );
308 QString writeFile = runID +
"."
310 return(
"Cannot open write file: " + dir + writeFile );
317 return(
"Unspecified error writing xml file." );
319 return( QString(
"" ) );
324 QList< US_Convert::TripleInfo >& triples,
329 qDebug() <<
" rRDD: build raw list";
330 QStringList q(
"get_rawDataIDs" );
331 q << QString::number( ExpData.
expID );
334 QStringList rawDataIDs;
335 QStringList filenames;
339 rawDataIDs << db->
value( 0 ).toString();
340 filenames << db->
value( 2 ).toString();
343 if ( rawDataIDs.size() < 1 )
344 return(
"There were no auc files found in the database." );
350 work.mkdir( ExpData.
runID );
353 qDebug() <<
" rRDD: read BlobFromDB (loop)";
354 QString error = QString(
"" );
355 for (
int i = 0; i < rawDataIDs.size(); i++ )
357 QString f = dir +
"/" + filenames[ i ];
358 int readStatus = db->
readBlobFromDB( f, QString(
"download_aucData" ),
359 rawDataIDs[ i ].toInt() );
363 error +=
"Error processing file: " + f +
"\n" +
364 "Could not open file or no data \n";
369 error +=
"Error returned processing file: " + f +
"\n" +
375 if ( error != QString(
"" ) )
379 QList<cellInfo> cells;
381 q <<
"all_cell_experiments"
382 << QString::number( ExpData.
expID );
387 QString letters(
"0ABCDEFGH");
397 qDebug() <<
" rRDD: build TripleInfo";
399 for (
int i = 0; i < rawDataIDs.size(); i++ )
410 QString uuidc = db->
value( 0 ).toString();
415 triple.
tripleID = rawDataIDs[ i ].toInt();
420 QString runType = part[ 1 ];
421 if ( runType ==
"WA" )
422 wl = QString::number( part[ 4 ].toDouble() / 1000.0 );
425 triple.
tripleDesc = part[ 2 ] +
" / " + part[ 3 ] +
" / " + wl;
430 foreach (
struct cellInfo cell, cells )
454 if ( csolID != psolID )
476 error +=
"Error processing file: " + filenames[ i ] +
"\n" +
481 QStringList part = triples[ 0 ].tripleFilename.split(
"." );
484 if ( error != QString(
"" ) )
487 return( QString(
"" ) );
491 QList< US_Convert::TripleInfo >& triples,
500 QStringList q(
"get_person_info" );
501 q << QString::number( ExpData.
invID );
507 ExpData.
invGUID = QString(
"" );
508 ExpData.
name = QString(
"" );
516 ExpData.
name = db->
value( 1 ).toString() +
", " + db->
value( 0 ).toString();
520 QRegExp rx(
"^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$" );
527 for (
int trx = 0; trx < triples.size(); trx++ )
529 if ( triples[ trx ].excluded )
continue;
532 (
unsigned char*) triples[ trx ].tripleGUID );
533 if ( ! rx.exactMatch( uuidc ) )
538 if ( ! rx.exactMatch( ExpData.
rotorGUID ) )
545 q << QString(
"get_personID_from_GUID" )
562 q << QString(
"get_rotorID_from_GUID" )
582 q << QString(
"get_rotor_info" )
583 << QString::number( ExpData.
rotorID );
596 q << QString(
"get_rotor_calibration_profiles" )
597 << QString::number( ExpData.
rotorID );
608 q << QString(
"get_rotor_calibration_info" )
615 QStringList dateParts = db->
value( 7 ).toString().split(
" " );
616 ExpData.
rotorUpdated = QDate::fromString( dateParts[ 0 ],
"yyyy-MM-dd" );
621 for (
int i = 0; i < triples.size(); i++ )
623 if ( triples[ i ].excluded )
continue;
626 (
unsigned char*) triples[ i ].tripleGUID );
628 q << QString(
"get_rawDataID_from_GUID" )
633 qDebug() <<
"iSv: trip" << i <<
"tGUID" << uuidc
639 triples[ i ].tripleID = db->
value( 0 ).toString().toInt();
640 qDebug() <<
"iSv: tID" << triples[i].tripleID;
643 else if ( status == US_DB2::NOROWS )
645 triples[ i ].tripleID = 0;
646 memset( triples[ i ].tripleGUID, 0, 16 );
652 qDebug() <<
"get_rawDataID_from_GUID error: " << db->
lastErrno();
653 qDebug() <<
"triple GUID = " << uuidc;