UltraScan III
us_analyte.cpp
Go to the documentation of this file.
1 #include "us_analyte.h"
3 #include "us_constants.h"
4 #include "us_settings.h"
5 #include "us_math2.h"
6 #include "us_datafiles.h"
7 #include "us_util.h"
8 
9 #define DEBUG_QUERY qDebug() << "Q" << q << "Err" << db->lastErrno() << db->lastError();
10 
12 {
14  mw = 0.0;
15  description = "New Analyte";
16  analyteGUID .clear();
17  sequence .clear();
18  type = PROTEIN;
19  grad_form = false;
20 
21  // Placeholders for DNA/RNA
22  doubleStranded = true;
23  complement = false;
24  _3prime = false;
25  _5prime = false;
26 
27  sodium = 0.0;
28  potassium = 0.0;
29  lithium = 0.0;
30  magnesium = 0.0;
31  calcium = 0.0;
32 
33  extinction .clear();
34  refraction .clear();
35  fluorescence .clear();
36 }
37 
38 bool US_Analyte::operator== ( const US_Analyte& a ) const
39 {
40  if ( vbar20 != a.vbar20 ) return false;
41  if ( mw != a.mw ) return false;
42  if ( description != a.description ) return false;
43  if ( analyteGUID != a.analyteGUID ) return false;
44  if ( sequence != a.sequence ) return false;
45  if ( type != a.type ) return false;
46  if ( extinction != a.extinction ) return false;
47  if ( refraction != a.refraction ) return false;
48  if ( fluorescence != a.fluorescence ) return false;
49  if ( grad_form != a.grad_form ) return false;
50 
51  if ( type == DNA || type == RNA )
52  {
53  if ( doubleStranded != a.doubleStranded ) return false;
54  if ( complement != a.complement ) return false;
55  if ( _3prime != a._3prime ) return false;
56  if ( _5prime != a._5prime ) return false;
57  if ( sodium != a.sodium ) return false;
58  if ( potassium != a.potassium ) return false;
59  if ( lithium != a.lithium ) return false;
60  if ( magnesium != a.magnesium ) return false;
61  if ( calcium != a.calcium ) return false;
62  }
63 
64  // Not comparing message and analyteID
65 
66  return true;
67 }
68 
70  bool db_access,
71  const QString& guid,
72  US_DB2* db )
73 {
74  if ( db_access ) return load_db ( guid, db );
75  else return load_disk( guid );
76 }
77 
78 int US_Analyte::load_db( const QString& load_guid, US_DB2* db )
79 {
80  int error = US_DB2::OK;
81 
82  // Get analyteID
83  QStringList q( "get_analyteID" );
84  q << load_guid;
85 
86  db->query( q );
88  error = db->lastErrno();
89 
90  if ( error != US_DB2::OK )
91  {
92  message = QObject::tr( "Could not get analyteID" );
93  return error;
94  }
95 
96  db->next();
97  analyteID = db->value( 0 ).toString();
98 
99  // Get analyte info;
100  q.clear();
101  q << "get_analyte_info" << analyteID;
102 
103  db->query( q );
105  error = db->lastErrno();
106 
107  if ( error != US_DB2::OK )
108  {
109  message = QObject::tr( "Could not get analyte info" );
110  return error;
111  }
112 
113  db->next();
114 
115  analyteGUID = load_guid;;
116  QString a_type = db->value( 1 ).toString();
117  if ( a_type == "Protein" ) type = PROTEIN;
118  else if ( a_type == "DNA" ) type = DNA;
119  else if ( a_type == "RNA" ) type = RNA;
120  else if ( a_type == "Other" ) type = CARBOHYDRATE;
121  else type = PROTEIN;
122 
123  sequence = db->value( 2 ).toString();
124  vbar20 = db->value( 3 ).toString().toDouble();
125  description = db->value( 4 ).toString();
126  // We don't need spectrum -- db->value( 5 ).toString();
127  mw = db->value( 6 ).toString().toDouble();
128  grad_form = ( type == CARBOHYDRATE ) ?
129  US_Util::bool_flag( db->value( 7 ).toString() ) : false;
130 
131  q.clear();
132  q << "get_nucleotide_info" << analyteID;
133  db->query( q );
135  db->next();
136 
137  doubleStranded = US_Util::bool_flag( db->value( 0 ).toString() );
138  complement = US_Util::bool_flag( db->value( 1 ).toString() );
139  _3prime = US_Util::bool_flag( db->value( 2 ).toString() );
140  _5prime = US_Util::bool_flag( db->value( 3 ).toString() );
141  sodium = db->value( 4 ).toString().toDouble();
142  potassium = db->value( 5 ).toString().toDouble();
143  lithium = db->value( 6 ).toString().toDouble();
144  magnesium = db->value( 7 ).toString().toDouble();
145  calcium = db->value( 8 ).toString().toDouble();
146 
147  if ( type == DNA || type == RNA )
148  nucleotide();
149 
150  q.clear();
151  q << "get_spectrum" << analyteID << "Analyte" << "Extinction";
152 
153  db->query( q );
155 
156  while ( db->next() )
157  {
158  double lambda = db->value( 1 ).toDouble();
159  double coeff = db->value( 2 ).toDouble();
160  extinction[ lambda ] = coeff;
161  }
162 
163  q[ 3 ] = "Refraction";
164  db->query( q );
165 
166  while ( db->next() )
167  {
168  double lambda = db->value( 1 ).toDouble();
169  double coeff = db->value( 2 ).toDouble();
170  refraction[ lambda ] = coeff;
171  }
172 
173  q[ 3 ] = "Fluorescence";
174  db->query( q );
175 
176  while ( db->next() )
177  {
178  double lambda = db->value( 1 ).toDouble();
179  double coeff = db->value( 2 ).toDouble();
180  fluorescence[ lambda ] = coeff;
181  }
182 
183  return US_DB2::OK;
184 }
185 
186 int US_Analyte::load_disk( const QString& guid )
187 {
188  int error = US_DB2::NO_ANALYTE; // Error by default
189 
190  QString path;
191 
192  if ( ! analyte_path( path ) )
193  {
194  message = QObject::tr ( "Could not create analyte directory" );
195  return error;
196  }
197 
198  QDir f( path );
199  QStringList filter( "A*.xml" );
200  QStringList names = f.entryList( filter, QDir::Files, QDir::Name );
201  QString filename;
202  bool found = false;
203 
204  for ( int i = 0; i < names.size(); i++ )
205  {
206  filename = path + "/" + names[ i ];
207  QFile file( filename );
208 
209  if ( ! file.open( QIODevice::ReadOnly | QIODevice::Text) ) continue;
210 
211  QXmlStreamReader xml( &file );
212 
213  while ( ! xml.atEnd() )
214  {
215  xml.readNext();
216 
217  if ( xml.isStartElement() )
218  {
219  if ( xml.name() == "analyte" )
220  {
221  QXmlStreamAttributes a = xml.attributes();
222 
223  if ( a.value( "analyteGUID" ).toString() == guid ) found = true;
224  break;
225  }
226  }
227  }
228 
229  file.close();
230 
231  if ( found ) return read_analyte( filename );
232  }
233 
234  message = QObject::tr ( "Could not find analyte guid" );
235  return error;
236 }
237 
238 int US_Analyte::read_analyte( const QString& filename )
239 {
240  QFile file( filename );
241 
242  // Read in the filename and populate class
243  if ( ! file.open( QIODevice::ReadOnly | QIODevice::Text) )
244  {
245  qDebug() << "Cannot open file " << filename;
246  message = QObject::tr( "Could not open analyte file for reading" );
247  return US_DB2::ERROR;
248  }
249 
250  double freq;
251  double value;
252  QString type_string;
253  QXmlStreamReader xml( &file );
254  QXmlStreamAttributes a;
255 
256  while ( ! xml.atEnd() )
257  {
258  xml.readNext();
259 
260  if ( xml.isStartElement() )
261  {
262  if ( xml.name() == "analyte" )
263  {
264  a = xml.attributes();
265 
266  type_string = a.value( "type" ).toString();
267 
268  // Set description and guid
269  description = a.value( "description" ).toString();
270  analyteGUID = a.value( "analyteGUID" ).toString();
271  vbar20 = a.value( "vbar20" ).toString().toDouble();
272 
273  // Set type
274  if ( type_string == "PROTEIN" )
275  {
276  type = PROTEIN;
277  }
278 
279  else if ( type_string == "DNA" || type_string == "RNA" )
280  {
281  type = ( type_string == "DNA" ) ? DNA : RNA;
282  }
283 
284  else if ( type_string == "CARBOHYDRATE" )
285  {
286  type = CARBOHYDRATE;
287  }
288 
289  mw = a.value( "mw" ).toString().toDouble();
291  a.value( "gradient_forming" ).toString() );
292  }
293 
294  else if ( xml.name() == "sequence" )
295  {
296  sequence = xml.readElementText();
297 
298  // Set mw
299  if ( type == PROTEIN )
300  {
303 
304  // The sequence tag comes before the extinction extinction tag
305  // so a value set there will override this setting, if it
306  // exists. It's not the way xml is really supposed work, but it
307  // will be ok in this case.
308 
309  extinction[ 280.0 ] = p.e280;
310  mw = ( mw == 0.0 ) ? p.mw : mw;
311  }
312  else if ( type == DNA || type == RNA )
313  {
315  a.value( "stranded" ).toString() );
317  a.value( "complement_only" ).toString() );
319  a.value( "ThreePrimeHydroxyl" ).toString() );
321  a.value( "FivePrimeHydroxyl" ).toString() );
322 
323  sodium = a.value( "sodium" ).toString().toDouble();
324  potassium = a.value( "potassium" ).toString().toDouble();
325  lithium = a.value( "lithium" ).toString().toDouble();
326  magnesium = a.value( "magnesium" ).toString().toDouble();
327  calcium = a.value( "calcium" ).toString().toDouble();
328 
329  nucleotide();
330  }
331 
332  }
333  else if ( xml.name() == "extinction" )
334  {
335  QXmlStreamAttributes a = xml.attributes();
336  freq = a.value( "frequency" ).toString().toDouble();
337  value = a.value( "value" ).toString().toDouble();
338  extinction[ freq ] = value;
339  }
340 
341  else if ( xml.name() == "refraction" )
342  {
343  QXmlStreamAttributes a = xml.attributes();
344  freq = a.value( "frequency" ).toString().toDouble();
345  value = a.value( "value" ).toString().toDouble();
346  refraction[ freq ] = value;
347  }
348 
349  else if ( xml.name() == "fluorescence" )
350  {
351  QXmlStreamAttributes a = xml.attributes();
352  freq = a.value( "frequency" ).toString().toDouble();
353  value = a.value( "value" ).toString().toDouble();
354  fluorescence[ freq ] = value;
355  }
356  }
357  }
358 
359  return US_DB2::OK;
360 }
361 
363 {
364  sequence.toLower();
365 
366  uint A = sequence.count( "a" );
367  uint C = sequence.count( "c" );
368  uint G = sequence.count( "g" );
369  uint T = sequence.count( "t" );
370  uint U = sequence.count( "u" );
371 
372  const double mw_A = 313.209;
373  const double mw_C = 289.184;
374  const double mw_G = 329.208;
375  const double mw_T = 304.196;
376  const double mw_U = 274.170;
377 
378  mw = 0.0;
379  uint total = A + G + C + T + U;
380 
381  if ( doubleStranded ) total *= 2;
382 
383  if ( type == DNA )
384  {
385  if ( doubleStranded )
386  {
387  mw += A * mw_A;
388  mw += G * mw_G;
389  mw += C * mw_C;
390  mw += T * mw_T;
391  mw += A * mw_T;
392  mw += G * mw_C;
393  mw += C * mw_G;
394  mw += T * mw_A;
395  }
396 
397  if ( complement )
398  {
399  mw += A * mw_T;
400  mw += G * mw_C;
401  mw += C * mw_G;
402  mw += T * mw_A;
403  }
404 
405  if ( ! complement && ! doubleStranded )
406  {
407  mw += A * mw_A;
408  mw += G * mw_G;
409  mw += C * mw_C;
410  mw += T * mw_T;
411  }
412  }
413  else /* RNA */
414  {
415  if ( doubleStranded )
416  {
417  mw += A * ( mw_A + 15.999 );
418  mw += G * ( mw_G + 15.999 );
419  mw += C * ( mw_C + 15.999 );
420  mw += U * ( mw_U + 15.999 );
421  mw += A * ( mw_U + 15.999 );
422  mw += G * ( mw_C + 15.999 );
423  mw += C * ( mw_G + 15.999 );
424  mw += U * ( mw_A + 15.999 );
425  }
426 
427  if ( complement )
428  {
429  mw += A * ( mw_U + 15.999 );
430  mw += G * ( mw_C + 15.999 );
431  mw += C * ( mw_G + 15.999 );
432  mw += U * ( mw_A + 15.999 );
433  }
434 
435  if ( ! complement && ! doubleStranded )
436  {
437  mw += A * ( mw_A + 15.999 );
438  mw += G * ( mw_G + 15.999 );
439  mw += C * ( mw_C + 15.999 );
440  mw += U * ( mw_U + 15.999 );
441  }
442  }
443 
444  mw += sodium * total * 22.99;
445  mw += potassium * total * 39.1;
446  mw += lithium * total * 6.94;
447  mw += magnesium * total * 24.305;
448  mw += calcium * total * 40.08;
449 
450  if ( _3prime )
451  {
452  mw += 17.01;
453  if ( doubleStranded ) mw += 17.01;
454  }
455  else // we have phosphate
456  {
457  mw += 94.87;
458  if ( doubleStranded ) mw += 94.87;
459  }
460 
461  if ( _5prime )
462  {
463  mw -= 77.96;
464  if ( doubleStranded ) mw -= 77.96;
465  }
466 }
467 
468 bool US_Analyte::analyte_path( QString& path )
469 {
470  QDir dir;
471  path = US_Settings::dataDir() + "/analytes";
472 
473  if ( ! dir.exists( path ) )
474  {
475  if ( ! dir.mkpath( path ) )
476  {
477  return false;
478  }
479  }
480 
481  return true;
482 }
483 
485  bool db_access,
486  const QString& filename,
487  US_DB2* db )
488 {
489  if ( db_access ) return write_db ( db );
490  else return write_disk( filename );
491 }
492 
493 int US_Analyte::write_disk( const QString& filename )
494 {
495  QFile file( filename );
496 
497  if ( ! file.open( QIODevice::WriteOnly | QIODevice::Text) )
498  {
499  qDebug() << "Cannot open file for writing: " << filename;
500  message = QObject::tr( "Cannot open file for writing" );
501  return US_DB2::ERROR;
502  }
503 
504  QXmlStreamWriter xml( &file );
505  xml.setAutoFormatting( true );
506 
507  xml.writeStartDocument();
508  xml.writeDTD ( "<!DOCTYPE US_Analyte>" );
509  xml.writeStartElement( "AnalyteData" );
510  xml.writeAttribute ( "version", "1.0" );
511 
512  xml.writeStartElement( "analyte" );
513 
514  // Set attributes depending on type
515  QString b; // bool
516 
517  switch ( type )
518  {
519  case US_Analyte::PROTEIN:
520  {
521  if ( vbar20 < 1e-2 )
522  {
525  vbar20 = p.vbar20;
526  }
527 
528  xml.writeAttribute( "type", "PROTEIN" );
529  xml.writeAttribute( "vbar20", QString::number( vbar20 ) );
530  }
531  break;
532 
533  case US_Analyte::DNA:
534  case US_Analyte::RNA:
535  if ( type == US_Analyte::DNA )
536  xml.writeAttribute( "type", "DNA" );
537  else
538  xml.writeAttribute( "type", "RNA" );
539  xml.writeAttribute( "stranded",
541  xml.writeAttribute( "complement_only",
543  xml.writeAttribute( "ThreePrimeHydroxyl",
545  xml.writeAttribute( "FivePrimeHydroxyl",
547 
548  xml.writeAttribute( "sodium", QString::number( sodium ) );
549  xml.writeAttribute( "potassium", QString::number( potassium ) );
550  xml.writeAttribute( "lithium", QString::number( lithium ) );
551  xml.writeAttribute( "magnesium", QString::number( magnesium ) );
552  xml.writeAttribute( "calcium", QString::number( calcium ) );
553  xml.writeAttribute( "vbar20", QString::number( vbar20 ) );
554  break;
555 
557  xml.writeAttribute( "type", "CARBOHYDRATE" );
558  xml.writeAttribute( "vbar20", QString::number( vbar20 ) );
559  xml.writeAttribute( "gradient_forming",
561  break;
562  }
563 
564  if ( mw > 0.0 )
565  xml.writeAttribute( "mw", QString::number( mw ) );
566 
567  xml.writeAttribute( "description", description );
568  xml.writeAttribute( "analyteGUID", analyteGUID );
569 
570  xml.writeStartElement( "sequence" );
571  xml.writeCharacters( "\n" );
572 
573  for ( int i = 0; i < sequence.length() / 80; i++ )
574  xml.writeCharacters( sequence.mid( i * 80, 80 ) + "\n" );
575 
576  if ( sequence.length() % 80 > 0 )
577  xml.writeCharacters( sequence.mid( ( sequence.length() / 80 ) * 80 ) );
578 
579  xml.writeCharacters( "\n" );
580  xml.writeEndElement(); // sequence
581 
582  // Add extinction values
583  QList< double > keys = extinction.keys();
584  double freq;
585  double value;
586 
587  for ( int i = 0; i < keys.size(); i++ )
588  {
589  freq = keys[ i ];
590  value = extinction[ keys[ i ] ];
591 
592  xml.writeStartElement( "extinction" );
593  xml.writeAttribute( "frequency", QString::number( freq , 'f', 1 ) );
594  xml.writeAttribute( "value", QString::number( value ) );
595  xml.writeEndElement(); // extinction
596  }
597 
598  // Add refraction values
599  keys = refraction.keys();
600 
601  for ( int i = 0; i < keys.size(); i++ )
602  {
603  freq = keys[ i ];
604  value = refraction[ keys[ i ] ];
605 
606  xml.writeStartElement( "refraction" );
607  xml.writeAttribute( "frequency", QString::number( freq , 'f', 1 ) );
608  xml.writeAttribute( "value", QString::number( value ) );
609  xml.writeEndElement(); // refraction
610  }
611 
612  // Add fluorescence values
613  keys = fluorescence.keys();
614 
615  for ( int i = 0; i < keys.size(); i++ )
616  {
617  freq = keys[ i ];
618  value = fluorescence[ keys[ i ] ];
619 
620  xml.writeStartElement( "fluorescence" );
621  xml.writeAttribute( "frequency", QString::number( freq , 'f', 1 ) );
622  xml.writeAttribute( "value", QString::number( value ) );
623  xml.writeEndElement(); // fluorescence
624  }
625 
626  xml.writeEndElement(); // analyte
627  xml.writeEndDocument();
628  file.close();
629 
630  file.close();
631 
632  return US_DB2::OK;
633 }
634 
636 {
637  QStringList q;
638 
639  q << "delete_spectrum" << analyteID << "Analyte" << "Extinction";
640  db->statusQuery( q );
642  q[ 3 ] = "Refraction";
643  db->statusQuery( q );
645  q[ 3 ] = "Fluorescence";
646  db->statusQuery( q );
648 
649  QList< double > keys = extinction.keys();
650  int kntext = keys.size();
651  kntext = ( kntext > 0 && extinction.values()[ 0 ] == 0.0 ) ? 0 : kntext;
652 
653  q.clear();
654  q << "new_spectrum" << analyteID << "Analyte" << "Extinction" << "" << "";
655 
656  for ( int i = 0; i < kntext; i++ )
657  {
658  double key = keys[ i ];
659  QString lambda = QString::number( key, 'f', 1 );
660  q[ 4 ] = lambda;
661 
662  QString coeff = QString::number( extinction[ key ] );
663  q[ 5 ] = coeff;
664 
665  db->statusQuery( q );
667  }
668 
669  keys = refraction.keys();
670  int kntref = keys.size();
671  kntref = ( kntref > 0 && refraction.values()[ 0 ] == 0.0 ) ? 0 : kntref;
672 
673  q[ 3 ] = "Refraction";
674 
675  for ( int i = 0; i < kntref; i++ )
676  {
677  double key = keys[ i ];
678  QString lambda = QString::number( key, 'f', 1 );
679  q[ 4 ] = lambda;
680 
681  QString coeff = QString::number( refraction[ key ] );
682  q[ 5 ] = coeff;
683 
684  db->statusQuery( q );
686  }
687 
688  keys = fluorescence.keys();
689  int kntflu = keys.size();
690  kntflu = ( kntflu > 0 && fluorescence.values()[ 0 ] == 0.0 ) ? 0 : kntflu;
691 
692  q[ 3 ] = "Fluorescence";
693 
694  for ( int i = 0; i < kntflu; i++ )
695  {
696  double key = keys[ i ];
697  QString lambda = QString::number( key, 'f', 1 );
698  q[ 4 ] = lambda;
699 
700  QString coeff = QString::number( fluorescence[ key ] );
701  q[ 5 ] = coeff;
702 
703  db->statusQuery( q );
705  }
706 
707  q.clear();
708  q << "count_spectrum" << analyteID << "Analyte" << "Extinction";
709  int cntext = db->functionQuery( q );
711  q[ 3 ] = "Refraction";
712  int cntref = db->functionQuery( q );
714  q[ 3 ] = "Fluourescence";
715  int cntflu = db->functionQuery( q );
717 
718  if ( ( kntext != cntext ) ||
719  ( kntref != cntref ) ||
720  ( kntflu != cntflu ) )
721  {
722  qDebug() << "set_spectrum *ERROR* ext k c" << kntext << cntext
723  << "ref k c" << kntref << cntref
724  << "flu k c" << kntflu << cntflu;
725  }
726 }
727 
729 {
730  QStringList q;
731  bool insert = true;
732 
733  message = QObject::tr( "inserted into" );
734 
735  if ( analyteGUID.size() != 36 )
736  {
737  message = QObject::tr ( "The analyte GUID is invalid" );
738  return US_DB2::BADGUID;
739  }
740 
741  q << "new_analyte" << analyteGUID;
742 
743  // Check that the guid exists in the db
744  QStringList q2;
745 
746  q2 << "get_analyteID" << analyteGUID;
747 
748  db->query( q2 );
750 
751  if ( db->lastErrno() == US_DB2::OK )
752  {
753  db->next();
754  analyteID = db->value( 0 ).toString();
755  q[ 0 ] = "update_analyte";
756  q[ 1 ] = analyteID;
757  message = QObject::tr( "updated in" );
758  insert = false;
759  }
760 
761  // Finish populating the query
762  if ( type == US_Analyte::PROTEIN ) q << "Protein";
763  else if ( type == US_Analyte::DNA ) q << "DNA";
764  else if ( type == US_Analyte::RNA ) q << "RNA";
765  else q << "Other";
766 
767  QString spectrum = ""; // Unused element
768  double lambda1 = 0.0;
769  double coeff1 = 0.0;
770 
771  if ( extinction.keys().count() > 0 )
772  {
773  lambda1 = extinction.keys()[ 0 ];
774  coeff1 = extinction[ lambda1 ];
775  }
776 
777  else if ( refraction.keys().count() > 0 )
778  {
779  lambda1 = refraction.keys()[ 0 ];
780  coeff1 = refraction[ lambda1 ];
781  }
782 
783  else if ( fluorescence.keys().count() > 0 )
784  {
785  lambda1 = fluorescence.keys()[ 0 ];
786  coeff1 = fluorescence[ lambda1 ];
787  }
788 
789  if ( coeff1 != 0.0 )
790  { // Compose spectrum string from first lambda/coeff pair
791  spectrum = QString::number( lambda1 ) + "/" + QString::number( coeff1 );
792  }
793 
794  q << sequence;
795  q << QString::number( vbar20 );
796  q << description;
797  q << spectrum;
798  q << QString::number( mw );
800 
801  if ( insert )
802  q << QString::number( US_Settings::us_inv_ID() );
803 
804  db->statusQuery( q );
806 
807  int error = db->lastErrno();
808  if ( error != US_DB2::OK )
809  {
810  message = QObject::tr ( "Could not update the DB" );
811  return error;
812  }
813 
814  if ( insert ) analyteID = QString::number( db->lastInsertID() );
815 
816  if ( type == US_Analyte::DNA || type == US_Analyte::RNA )
817  write_nucleotide( db );
818 
819  set_spectrum( db );
820 
821  // Write to disk too
822  QString path;
823  analyte_path( path );
824  QString filename = get_filename( path, analyteGUID );
825  write_disk( filename );
826 
827  return US_DB2::OK;
828 }
829 
830 QString US_Analyte::get_filename( const QString& path, const QString& guid )
831 {
832  return
833  US_DataFiles::get_filename( path, guid, "A", "analyte", "analyteGUID" );
834 }
835 
837 {
838  QStringList q;
839  q << "set_nucleotide_info" << analyteID;
840  q << QString::number( doubleStranded );
841  q << QString::number( complement );
842  q << QString::number( _3prime );
843  q << QString::number( _5prime );
844  q << QString::number( sodium );
845  q << QString::number( potassium );
846  q << QString::number( lithium );
847  q << QString::number( magnesium );
848  q << QString::number( calcium );
849 
850  db->statusQuery( q );
851 
852  if ( db->lastErrno() != US_DB2::OK )
853  message = QObject::tr ( "Could not update nucleotide info" );
854 }
855 
856 void US_Analyte::dump( void )
857 {
858  switch ( type )
859  {
860  case PROTEIN : qDebug() << "Type: PROTEIN" ; break;
861  case DNA : qDebug() << "Type: DNA" ; break;
862  case RNA : qDebug() << "Type: RNA" ; break;
863  case CARBOHYDRATE: qDebug() << "Type: OTHER" ; break;
864  default : qDebug() << "Type: **UNKNOWN**" ; break;
865  }
866 
867  qDebug() << "msg :" << message ;
868  qDebug() << "anaID :" << analyteID ;
869 
870  qDebug() << "vbar20:" << vbar20 ;
871  qDebug() << "mw :" << mw ;
872  qDebug() << "descr :" << description ;
873  qDebug() << "guid :" << analyteGUID ;
874  qDebug() << "seq :" << sequence ;
875 
876  qDebug() << "dblStr:" << doubleStranded ;
877  qDebug() << "comple:" << complement ;
878  qDebug() << "3prime:" << _3prime ;
879  qDebug() << "5prime:" << _5prime ;
880  qDebug() << "na :" << sodium ;
881  qDebug() << "k :" << potassium ;
882  qDebug() << "li :" << lithium ;
883  qDebug() << "mg :" << magnesium ;
884  qDebug() << "ca :" << calcium ;
885  qDebug() << "grad_f:" << grad_form ;
886 
887  qDebug() << "extinction";
888  foreach( double wl, extinction.keys() )
889  qDebug() << wl << extinction[ wl ];
890 
891  qDebug() << "refraction";
892  foreach( double wl, refraction.keys() )
893  qDebug() << wl << refraction[ wl ];
894 
895  qDebug() << "fluorescence";
896  foreach( double wl, fluorescence.keys() )
897  qDebug() << wl << fluorescence[ wl ];
898 }