void SQLiteApplets::insert () { v1 [3] = ""; v1 [4] = "1"; v1 [5] = "0"; StringVector fileList; fileList.push_back ( "dbstat_hist" ); fileList.push_back ( "error_hist" ); fileList.push_back ( "fit_graph" ); fileList.push_back ( "hist" ); fileList.push_back ( "mmod_hist" ); fileList.push_back ( "pr_graph" ); fileList.push_back ( "sp_graph" ); for ( StringVectorSizeType i = 0 ; i < fileList.size () ; i++ ) { string path = MsparamsDir::instance ().getParamPath ( fileList [i] + ".par.txt" ); GenNameValueStream nvs ( path ); if ( genFileExists ( path ) ) { v1 [0] = fileList [i]; GenCommentedIFStream ifs ( path ); ParameterList p ( ifs ); StringVector sv = p.getNameList (); int numValues = p.size (); for ( int j = 0 ; j < numValues ; j++ ) { StringVector sv2 = p.getStringVectorValue ( sv [j] ); for ( int k = 0 ; k < sv2.size () ; k++ ) { v1 [1] = sv [j]; v1 [2] = sv2 [k]; insertTable ( tableName, n1, v1 ); } } } } }
void SQLiteQuanMSMSPurity::insert () { v1 [5] = ""; v1 [6] = "1"; v1 [7] = "0"; StringVector quanTypes = QuanMSMSXMLData::instance ().getQuanMSMSNames (); for ( StringVectorSizeType i = 0 ; i < quanTypes.size () ; i++ ) { v1 [0] = quanTypes [i]; string purityPath = MsparamsDir::instance ().getParamPath ( v1 [0] + ".txt" ); if ( genFileExists ( purityPath ) ) { GenCommentedIFStream ifs ( purityPath ); while ( ifs.getUncommentedLine ( v1 [1] ) ) { ParameterList p ( ifs ); StringVector sv = p.getNameList (); int numQuanPeaks = p.size (); for ( int j = 0 ; j < numQuanPeaks ; j++ ) { v1 [2] = sv [j]; istringstream ist ( p.getStringValue ( sv [j] ) ); for ( int k = 1 ; k <= 4 ; k++ ) { v1 [3] = "coefficient" + gen_itoa ( k ); ist >> v1 [4]; insertTable ( tableName, n1, v1 ); } } } } } }
PurityCorrection::PurityCorrection ( const ParameterList* params ) { string quanType = params->getStringValue ( "quan_type", "" ); if ( isQuanMSMS ( quanType ) ) { // This is an MSMS quantitation type string purityName = params->getStringValue ( "purity_correction", "" ); string purityFile = quanType + ".txt"; string purityPath = MsparamsDir::instance ().getParamPath ( purityFile ); if ( purityName == FROM_FORMULAE ) { numQuanPeaks = QuanMSMSXMLData::instance ().getNumQuanPeaks ( quanType ); matrix = QuanMSMSXMLData::instance ().getFormulaPurityCoefficients ( quanType ); } else if ( purityName == NO_CORRECTION ) { numQuanPeaks = QuanMSMSXMLData::instance ().getNumQuanPeaks ( quanType ); matrix.resize ( numQuanPeaks ); for ( int i = 0 ; i < numQuanPeaks ; i++ ) { for ( int j = 0 ; j < 4 ; j++ ) { matrix [i].push_back ( 0.0 ); } } } else { if ( purityName != DEFAULT ) { if ( isPrefix ( purityName, quanType ) ) { purityName = purityName.substr ( quanType.length () + 1 ); } else { ErrorHandler::genError ()->error ( "Invalid purity name.\n" ); } } GenIFStream fromFile ( purityPath ); string line; bool flag = false; while ( getline ( fromFile, line ) ) { if ( line == purityName ) { ParameterList p ( fromFile ); StringVector sv = p.getNameList (); numQuanPeaks = p.size (); matrix.resize ( numQuanPeaks ); for ( int i = 0 ; i < numQuanPeaks ; i++ ) { istringstream ist ( p.getStringValue ( sv [i] ) ); double num; while ( ist >> num ) { matrix [i].push_back ( num / 100.0 ); } } flag = true; break; } } if ( !flag ) { ErrorHandler::genError ()->error ( "Invalid purity name.\n" ); } } a = nrmatrix ( 1, numQuanPeaks, 1, numQuanPeaks ); loadA (); b = nrmatrix ( 1, numQuanPeaks, 1, 1 ); }
void SQLiteIDNameValueList::insert () { v1 [3] = ""; v1 [4] = "1"; v1 [5] = "0"; string path = MsparamsDir::instance ().getParamPath ( fileName ); if ( genFileExists ( path ) ) { GenCommentedIFStream ifs ( path ); while ( ifs.getUncommentedLine ( v1 [0] ) ) { ParameterList p ( ifs ); StringVector sv = p.getNameList (); int numValues = p.size (); for ( int i = 0 ; i < numValues ; i++ ) { StringVector sv2 = p.getStringVectorValue ( sv [i] ); for ( int j = 0 ; j < sv2.size () ; j++ ) { v1 [1] = sv [i]; v1 [2] = sv2 [j]; insertTable ( tableName, n1, v1 ); } } } } }