private void SetMassTagReferencesForNetAlignment() { if (!string.IsNullOrEmpty(Parameters.ReferenceTargetsFilePath)) { IqTargetImporter massTagImporter = new BasicIqTargetImporter(Parameters.ReferenceTargetsFilePath); var massTagRefs = massTagImporter.Import(); IqMassAndNetAligner.SetMassTagReferences(massTagRefs); IqLogger.Log.Info("IQ Net aligner - " + massTagRefs.Count + " reference targets were loaded successfully."); } else { IqLogger.Log.Info("IQ Net aligner INACTIVE - no reference tags were loaded. You need to define 'TargetsUsedForLookupFilePath'"); } }
public void Test1() { var targetsFileName = @"\\proto-7\VOrbi05\2013_2\mhp_plat_test_1_14April13_Frodo_12-12-04\MSG201305011339_Auto939903\mhp_plat_test_1_14April13_Frodo_12-12-04_msgfdb_fht.txt"; var massTagFilename = @"\\protoapps\DataPkgs\Public\2013\795_Iq_analysis_of_mouse_O16O18\Targets\MT_Mouse_MHP_O18_Set1_P890_targets.txt"; var rawFile = @"D:\Data\O16O18\Vlad_Mouse\mhp_plat_test_1_14April13_Frodo_12-12-04.raw"; WorkflowExecutorBaseParameters parameters = new BasicTargetedWorkflowExecutorParameters(); parameters.TargetsFilePath = targetsFileName; var run = new RunFactory().CreateRun(rawFile); var massAndNetAligner = new IqMassAndNetAligner(parameters, run); massAndNetAligner.LoadAndInitializeTargets(); IqTargetImporter massTagImporter = new BasicIqTargetImporter(massTagFilename); var massTagRefs = massTagImporter.Import(); massAndNetAligner.SetMassTagReferences(massTagRefs); //massAligner.Targets = massAligner.Targets.Take(1).ToList(); massAndNetAligner.ExecuteAlignment(); var sb = new StringBuilder(); var usefulResults = new List <IqResult>(); foreach (var iqResult in massAndNetAligner.Results) { var childresults = iqResult.ChildResults(); foreach (var childresult in childresults) { if (childresult.ObservedIsotopicProfile == null) { continue; } sb.Append(childresult.Target.ID); sb.Append("\t"); if (childresult.ObservedIsotopicProfile == null) { sb.Append("[null]"); sb.Append(Environment.NewLine); } else { usefulResults.Add(childresult); sb.Append(childresult.ChromPeakSelected.XValue); sb.Append("\t"); sb.Append(childresult.ElutionTimeObs); sb.Append("\t"); sb.Append(childresult.ParentResult.Target.ElutionTimeTheor); sb.Append("\t"); sb.Append(childresult.MZObs.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.MonoMassObs.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.MassErrorBefore.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.FitScore.ToString("0.000")); sb.Append(Environment.NewLine); } } } var averageMassError = usefulResults.Average(p => p.MassErrorBefore); var stdev = MathUtils.GetStDev(usefulResults.Select(p => p.MassErrorBefore).ToList()); //Console.WriteLine(sb.ToString()); Console.WriteLine("avg mass error= " + averageMassError); Console.WriteLine("stdev= " + stdev); Console.WriteLine("----------- mass alignment ------------"); TestUtilities.DisplayXYValues(massAndNetAligner.MassAlignmentInfo.ScanAndPpmShiftVals); Console.WriteLine("------------NET alignment --------------"); DisplayNetAlignmentInfo(massAndNetAligner.NetAlignmentInfo); }
public void AlignUsingMsgfOutputFullProcessingTest1() { var targetsFileName = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\AlignmentInfo\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_msgfdb_fht.txt"; var massTagFilename = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\Targets\QCShew_ProdTest_Formic_P823_PMT3.txt"; var rawFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18.RAW"; WorkflowExecutorBaseParameters parameters = new BasicTargetedWorkflowExecutorParameters(); parameters.TargetsFilePath = targetsFileName; parameters.ReferenceTargetsFilePath = massTagFilename; var run = new RunFactory().CreateRun(rawFile); var massAndNetAligner = new IqMassAndNetAligner(parameters, run); massAndNetAligner.LoadAndInitializeTargets(); massAndNetAligner.Targets = massAndNetAligner.Targets.Take(2000).ToList(); var exportedAlignmentResultsFile = @"\\protoapps\UserData\Slysz\Standard_Testing\Targeted_FeatureFinding\Unlabelled\AlignmentInfo\QC_Shew_08_04-pt5-2_11Jan09_Sphinx_08-11-18_iqAlignmentResults.txt"; if (!File.Exists(exportedAlignmentResultsFile)) { File.Delete(exportedAlignmentResultsFile); } IqTargetImporter massTagImporter = new BasicIqTargetImporter(massTagFilename); var massTagRefs = massTagImporter.Import(); massAndNetAligner.SetMassTagReferences(massTagRefs); //massAligner.Targets = massAligner.Targets.Take(1).ToList(); massAndNetAligner.ExecuteAlignment(); var sb = new StringBuilder(); var usefulResults = new List <IqResult>(); massAndNetAligner.ExportResults(exportedAlignmentResultsFile); foreach (var iqResult in massAndNetAligner.Results) { var childresults = iqResult.ChildResults(); foreach (var childresult in childresults) { if (childresult.ObservedIsotopicProfile == null) { continue; } sb.Append(childresult.Target.ID); sb.Append("\t"); if (childresult.ObservedIsotopicProfile == null) { sb.Append("[null]"); sb.Append(Environment.NewLine); } else { usefulResults.Add(childresult); sb.Append(childresult.ChromPeakSelected.XValue); sb.Append("\t"); sb.Append(childresult.ElutionTimeObs); sb.Append("\t"); sb.Append(childresult.ParentResult.Target.ElutionTimeTheor); sb.Append("\t"); sb.Append(childresult.MZObs.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.MonoMassObs.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.MassErrorBefore.ToString("0.00000")); sb.Append("\t"); sb.Append(childresult.FitScore.ToString("0.000")); sb.Append(Environment.NewLine); } } } var averageMassError = usefulResults.Average(p => p.MassErrorBefore); var stdev = MathUtils.GetStDev(usefulResults.Select(p => p.MassErrorBefore).ToList()); Console.WriteLine(sb.ToString()); Console.WriteLine("avg mass error= " + averageMassError); Console.WriteLine("stdev= " + stdev); Console.WriteLine("----------- mass alignment ------------"); TestUtilities.DisplayXYValues(massAndNetAligner.MassAlignmentInfo.ScanAndPpmShiftVals); Console.WriteLine("------------NET alignment --------------"); DisplayNetAlignmentInfo(massAndNetAligner.NetAlignmentInfo); }