/// <summary> /// Get image & coordinates file from KEGG FTP /// </summary> /// <param name="pathwayId"></param> /// <returns></returns> public static TargetMap GetKeggPathway( string pathwayId) { if (ServiceFacade.UseRemoteServices) { Mobius.Services.Native.INativeSession nativeClient = ServiceFacade.CreateNativeSessionProxy(); Services.Native.NativeMethodTransportObject resultObject = ServiceFacade.InvokeNativeMethod(nativeClient, (int)Services.Native.ServiceCodes.MobiusTargetMapService, (int)Services.Native.ServiceOpCodes.MobiusTargetMapService.GetKeggPathway, new Services.Native.NativeMethodTransportObject(new object[] { pathwayId })); ((System.ServiceModel.IClientChannel)nativeClient).Close(); if (resultObject == null) { return(null); } ServiceTypes.TargetMap serviceTargetMap = (ServiceTypes.TargetMap)resultObject.Value; TargetMap targetMap = ServiceFacade.TypeConversionHelper.Convert <ServiceTypes.TargetMap, TargetMap>(serviceTargetMap); return(targetMap); } else { return(UAL.TargetMapDao.GetKeggPathway(pathwayId)); } }
public IrtPeptidePicker() { _scoredPeptides = null; _cirtPeptides = null; _cirtAll = new TargetMap <double>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); }
public ChooseIrtStandardPeptidesDlg(SrmDocument document, string documentFilePath, ICollection <DbIrtPeptide> dbIrtPeptides, IEnumerable <PeptideGroupDocNode> peptideGroups) { InitializeComponent(); Document = document; Regression = null; _documentFilePath = documentFilePath; _dbIrtPeptides = dbIrtPeptides; _librarySpectra = new List <SpectrumMzInfo>(); _irtAdd = new List <MeasuredRetentionTime>(); _irtTargets = null; comboExisting.Items.AddRange(IrtStandard.ALL.Where(standard => !standard.Name.Equals(IrtStandard.EMPTY.Name) && !standard.Name.Equals(IrtStandard.AUTO.Name)) .Cast <object>().ToArray()); comboExisting.SelectedIndex = 0; PeptideGroupDocNode[] proteinsContainingCommonIrts, proteinsNotContainingCommonIrts; CreateIrtCalculatorDlg.SeparateProteinGroups(peptideGroups, out proteinsContainingCommonIrts, out proteinsNotContainingCommonIrts); foreach (var protein in proteinsContainingCommonIrts.Concat(proteinsNotContainingCommonIrts)) { comboProteins.Items.Add(new PeptideGroupItem(protein)); } if (proteinsContainingCommonIrts.Any()) { comboProteins.SelectedIndex = 0; } UpdateSelection(this, null); }
private void TestIrts() { PrepareDocument("ImportPeptideSearch-irts.sky"); var importPeptideSearchDlg = ShowDialog <ImportPeptideSearchDlg>(SkylineWindow.ShowImportPeptideSearchDlg); var doc = SkylineWindow.Document; RunUI(() => { Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.spectra_page); importPeptideSearchDlg.BuildPepSearchLibControl.AddSearchFiles(new[] { GetTestPath("biognosystiny.blib") }); importPeptideSearchDlg.BuildPepSearchLibControl.IrtStandards = IrtStandard.BIOGNOSYS_11; importPeptideSearchDlg.BuildPepSearchLibControl.WorkflowType = ImportPeptideSearchDlg.Workflow.dia; }); var addIrtDlg = ShowDialog <AddIrtPeptidesDlg>(() => Assert.IsTrue(importPeptideSearchDlg.ClickNextButton())); var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addIrtDlg.OkDialog); OkDialog(recalibrateDlg, recalibrateDlg.ClickNo); doc = WaitForDocumentChange(doc); RunUI(() => { Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.chromatograms_page); importPeptideSearchDlg.ImportResultsControl.FoundResultsFiles = new List <ImportPeptideSearch.FoundResultsFile> { new ImportPeptideSearch.FoundResultsFile(MODLESS_BASE_NAME, SearchFilesModless.First()) }; Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.transition_settings_page); Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.full_scan_settings_page); Assert.IsTrue(importPeptideSearchDlg.ClickNextButton()); Assert.IsTrue(importPeptideSearchDlg.CurrentPage == ImportPeptideSearchDlg.Pages.import_fasta_page); importPeptideSearchDlg.ImportFastaControl.SetFastaContent(GetTestPath("yeast-10.fasta")); }); var peptidesPerProteinDlg = ShowDialog <PeptidesPerProteinDlg>(importPeptideSearchDlg.ClickNextButtonNoCheck); RunUI(() => peptidesPerProteinDlg.KeepAll = true); WaitForConditionUI(() => peptidesPerProteinDlg.DocumentFinalCalculated); // The AllChromatogramsGraph will immediately show an error because the file being imported is bogus. var importResultsDlg = ShowDialog <AllChromatogramsGraph>(peptidesPerProteinDlg.OkDialog); doc = WaitForDocumentChangeLoaded(doc); WaitForConditionUI(5000, () => importResultsDlg.Finished && importResultsDlg.Files.Any(f => !string.IsNullOrEmpty(f.Error))); OkDialog(importResultsDlg, importResultsDlg.ClickClose); // The document should have the 11 Biognosys standard peptides in the first peptide group var irt = doc.PeptideGroups.First(); Assert.AreEqual(11, irt.PeptideCount); var irtMap = new TargetMap <bool>(IrtStandard.BIOGNOSYS_11.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); foreach (var nodePep in irt.Peptides) { Assert.IsTrue(irtMap.ContainsKey(nodePep.ModifiedTarget)); } RunUI(() => SkylineWindow.SaveDocument()); }
public static bool GenRDTemplates(string outputtemplatefilename, string basenamespace, out string code, params string[] inputfiles) { code = string.Empty; // tokenize data bool tokok = true; for (int i = 0; i < inputfiles.Length; i++) { var source = inputfiles[i]; var inputcode = h.getfile(source, null); tokok &= createstream(source, inputcode, i == 0); } if (!tokok) { return(false); } // generate constants GenericTracker <Token[]> const2consttoks = getcodeconstants(); // generate helpers GenericTracker <List <Token> > function2ftoks = new GenericTracker <List <Token> >(); bool helperok = transform_assist_helpers(getallsourcetypes(basenamespace, inputfiles), const2consttoks, ref function2ftoks); // generate classes string assistcode; List <string> typenames; var assistok = transform_assist_calls(outputtemplatefilename, getsourcetype(basenamespace, inputfiles[0]), function2ftoks, const2consttoks, out assistcode, out typenames); if (helperok && assistok) { // generate method to get all the types as params var getallmethod = gencode_gettypes_fromnames(outputtemplatefilename, typenames); // add to global RD listing class var rdlisting_class = TargetMap.GetClass(outputtemplatefilename, string.Empty, getallmethod); // wrap it all together code = RD_AssistTemplate.GetTemplateFile(rdlisting_class + assistcode); // save class if required bool savefile = !string.IsNullOrWhiteSpace(outputtemplatefilename); //var folder = h.gf(); var folder = Environment.CurrentDirectory + "\\"; var fn = folder + outputtemplatefilename + ".cs"; if (savefile && !string.IsNullOrWhiteSpace(code) && h.setfile(fn, code)) { } return(true); } return(false); }
void OnSceneGUI() { Event e = Event.current; //Debug.Log("type " + e.type + ", ismouse " + e.isMouse + ", button " + e.button); // Is edit mode enabled ? if (IsEditModeEnabled) { // Catch window focus. int controlID = GUIUtility.GetControlID(FocusType.Passive); if (e.type == EventType.Layout) { HandleUtility.AddDefaultControl(controlID); return; } // Release mouse if (e.type == EventType.MouseUp && e.button == editMapButtonID) { _isDragging = false; } // paint. if ((e.type == EventType.MouseDrag || e.type == EventType.MouseDown) && e.button == editMapButtonID) { float rayDistance; Ray ray = HandleUtility.GUIPointToWorldRay(e.mousePosition); Plane plane = new Plane(new Vector3(0, 1, 0), 0); if (plane.Raycast(ray, out rayDistance)) { Vector3 point = ray.GetPoint(rayDistance); //Debug.Log("type " + e.type + ", ismouse " + e.isMouse + ", button " + e.button); if (e.type == EventType.MouseDrag && _isDragging) { if (TargetMap.EditHexagon(_lastMousePosition, point, _typeIdBrush, _heightBrush, _paintLayer)) { MapModified(); } } else { if (TargetMap.EditHexagon(point, _typeIdBrush, _heightBrush, _paintLayer)) { MapModified(); } _isDragging = true; } _lastMousePosition = point; } e.Use(); } } }
public static void SetStandards(IEnumerable <DbIrtPeptide> peptides, IEnumerable <Target> standards) { var standardMap = new TargetMap <bool>(standards.Select(target => new KeyValuePair <Target, bool>(target, true))); foreach (var pep in peptides.Where(pep => standardMap.ContainsKey(pep.ModifiedTarget))) { pep.Standard = true; } }
private static RegressionLine GetRegression(TargetMap <double> knownIrts, DbIrtPeptide[] matchingPeptides, int?minPoints, out RegressionGraphData graphData) { graphData = null; var matchingPeptideIrts = new TargetMap <List <double> >(matchingPeptides.Select(pep => new KeyValuePair <Target, List <double> >(pep.ModifiedTarget, new List <double>()))); foreach (var pep in matchingPeptides) { var list = matchingPeptideIrts[pep.ModifiedTarget]; list.Add(pep.Irt); } var listX = new List <double>(); var listY = new List <double>(); var targets = new Dictionary <int, Target>(); foreach (var(i, kvp) in matchingPeptideIrts.Where(kvp => kvp.Value.Count > 0).Select((kvp, i) => Tuple.Create(i, kvp))) { targets[i] = kvp.Key; listX.Add(new Statistics(kvp.Value).Median()); listY.Add(knownIrts[kvp.Key]); } var regressionMinPoints = minPoints ?? RCalcIrt.MinStandardCount(knownIrts.Count); var removed = new List <Tuple <double, double> >(); if (!IrtRegression.TryGet <RegressionLine>(listX, listY, regressionMinPoints, out var regression, removed)) { return(null); } var outliers = new HashSet <int>(); for (var i = 0; i < listX.Count; i++) { if (removed.Contains(Tuple.Create(listX[i], listY[i]))) { outliers.Add(i); } } graphData = new RegressionGraphData { Title = Resources.ChooseIrtStandardPeptidesDlg_OkDialog_Linear_regression, LabelX = Resources.ChooseIrtStandardPeptidesDlg_OkDialog_Library_iRTs, LabelY = Resources.ChooseIrtStandardPeptidesDlg_OkDialog_Known_iRTs, XValues = listX.ToArray(), YValues = listY.ToArray(), Tooltips = targets.ToDictionary(target => target.Key, target => target.Value.ToString()), OutlierIndices = outliers, RegressionLine = regression, MinCorrelation = RCalcIrt.MIN_IRT_TO_TIME_CORRELATION, MinPoints = regressionMinPoints, }; return(regression as RegressionLine); }
public void MappingBehaviorCanBe_SupportedByDomainEntity() { var targetMaps = new TargetMap[] { }; var domainEntity = CreateTestEntity <SourceDomainEntity>(targetMaps); var behavior = domainEntity.Entity.GetBehavior <IMappingBehavior>(); behavior.supported.Should().BeTrue(); behavior.instance.Should().NotBeNull(); }
public static int Resolve(this TargetMap value, int factionId) { MapAttribute mapAttribute = value.smethod_0 <MapAttribute>(); if (mapAttribute != null && mapAttribute.ByFaction != 0) { return(MapUtils.smethod_12(mapAttribute.ByFaction, factionId)); } return((int)value); }
public static string GetName(this TargetMap value) { MapAttribute mapAttribute = value.smethod_0 <MapAttribute>(); if (mapAttribute != null) { return(mapAttribute.Name); } return(value.ToString()); }
/// <summary> /// Summarize the current data set producing one row per key value (e.g. CompoundId) /// </summary> /// <param name="sumMethod"></param> /// <param name="outputFormat"></param> /// <param name="targetMap"></param> /// <returns></returns> public QueryManager Summarize( TargetAssaySummarizationLevel sumLevel, SummarizationType sumMethod, ColumnsToTransform colsToSumm, OutputDest outputDest, TargetMap targetMap) { //if (UnpivotedResults) return SummarizeUnpivoted(sumLevel, sumMethod, outputDest, targetMap); //else return SummarizePivoted(sumLevel, sumMethod, colsToSumm, outputDest, targetMap); throw new NotImplementedException(); }
public GClass888(GClass890 gclass890_1) { Class13.lOBHd9Nzn7x2T(); this.dictionary_0 = new Dictionary <string, DateTimeOffset>(); this.random_0 = new Random(); this.list_0 = new List <GClass892>(); this.object_0 = new object(); base..ctor(); this.Context = gclass890_1; this.list_0.Add(this.Module = new GClass893(gclass890_1)); foreach (object obj in Enum.GetValues(typeof(TargetMap))) { TargetMap targetMap = (TargetMap)obj; if (targetMap != TargetMap.PayloadEscort) { GClass892 gclass = null; if (MapUtils.smethod_6((int)targetMap)) { if (MapUtils.smethod_7((int)targetMap)) { gclass = new GClass900(gclass890_1, targetMap); } else if (MapUtils.smethod_8((int)targetMap)) { gclass = new GClass901(gclass890_1, targetMap); } } else { gclass = new GClass896(gclass890_1, targetMap); } if (gclass != null) { this.list_0.Add(gclass); } } } this.list_0.Add(new GClass894(gclass890_1)); if (Constants.bool_0) { this.list_0.Add(new GClass902(gclass890_1)); } this.list_0.Add(new GClass897(gclass890_1)); if (Constants.FrozenLabirynthEnabled) { this.list_0.Add(new GClass898(gclass890_1)); } if (Constants.PayloadEscortEnabled) { this.list_0.Add(new GClass899(gclass890_1)); } this.list_0.Add(new GClass903(gclass890_1)); this.Module.Start(); }
public GClass837(GClass839 gclass839_1) { Class13.NP5bWyNzLwONS(); this.dictionary_0 = new Dictionary <string, DateTimeOffset>(); this.random_0 = new Random(); this.list_0 = new List <GClass841>(); this.object_0 = new object(); base..ctor(); this.Context = gclass839_1; this.list_0.Add(this.Module = new GClass842(gclass839_1)); foreach (object obj in Enum.GetValues(typeof(TargetMap))) { TargetMap targetMap = (TargetMap)obj; if (targetMap != TargetMap.PayloadEscort) { GClass841 gclass = null; if (MapUtils.smethod_6((int)targetMap)) { if (MapUtils.smethod_7((int)targetMap)) { gclass = new GClass849(gclass839_1, targetMap); } else if (MapUtils.smethod_8((int)targetMap)) { gclass = new GClass850(gclass839_1, targetMap); } } else { gclass = new GClass845(gclass839_1, targetMap); } if (gclass != null) { this.list_0.Add(gclass); } } } this.list_0.Add(new GClass843(gclass839_1)); if (Constants.bool_0) { this.list_0.Add(new GClass851(gclass839_1)); } this.list_0.Add(new GClass846(gclass839_1)); if (Constants.FrozenLabirynthEnabled) { this.list_0.Add(new GClass847(gclass839_1)); } if (Constants.PayloadEscortEnabled) { this.list_0.Add(new GClass848(gclass839_1)); } this.list_0.Add(new GClass852(gclass839_1)); this.Module.Start(); }
public static List <IrtStandard> BestMatch(IEnumerable <Target> targets) { var targetMap = new TargetMap <bool>(targets.Select(t => new KeyValuePair <Target, bool>(t, true))); var matches = ALL.Where(s => s.Peptides.Count > 0 && s.Peptides.All(pep => targetMap.ContainsKey(pep.ModifiedTarget))).ToList(); if (matches.Contains(BIOGNOSYS_10) && matches.Contains(BIOGNOSYS_11)) { matches.Remove(BIOGNOSYS_10); } return(matches); }
public CurrentCalculator(IEnumerable <DbIrtPeptide> standardPeptides, IEnumerable <DbIrtPeptide> libraryPeptides) : base(NAME_INTERNAL) { _dictStandards = new TargetMap <double>(standardPeptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); _dictLibrary = new TargetMap <double>(libraryPeptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); var minStandard = _dictStandards.Values.Min(); var minLibrary = _dictLibrary.Values.Min(); // Come up with a value lower than the lowest value, but still within the scale // of the measurements. _unknownScore = Math.Min(minStandard, minLibrary) - Math.Abs(minStandard - minLibrary); }
public void NoMappingStragetySpecified_ObjectsAreAutoMapped() { var targetMaps = new TargetMap[] { }; var domainEntity = CreateTestEntity <SourceDomainEntity>(targetMaps); domainEntity.ValueOne = "V1"; domainEntity.ValueTwo = "V2"; var model = domainEntity.MapTo <TargetModel>(); Assert.Equal(model.ValueOne, domainEntity.ValueOne); Assert.Equal(model.ValueTwo, domainEntity.ValueTwo); }
internal static Target FromHandle(LLVMTargetRef targetHandle) { lock ( TargetMap ) { if (TargetMap.TryGetValue(targetHandle.Pointer, out Target retVal)) { return(retVal); } retVal = new Target(targetHandle); TargetMap.Add(targetHandle.Pointer, retVal); return(retVal); } }
public override string ToString() { if (Type == SCPointOfInterestType.Warp) { return(Coords.ToString() + "->Warp"); } else if (Type == SCPointOfInterestType.Exit) { return(Coords.ToString() + "->Exit"); } { return(Coords.ToString() + "->" + TargetMap.ToString() + TargetCoords.ToString()); } }
internal static Target FromHandle(LLVMTargetRef targetHandle) { targetHandle.ValidateNotDefault(nameof(targetHandle)); lock ( TargetMap ) { if (TargetMap.TryGetValue(targetHandle, out Target retVal)) { return(retVal); } retVal = new Target(targetHandle); TargetMap.Add(targetHandle, retVal); return(retVal); } }
public void TargetMap_ForSource_MapTo_SetsTarget() { var sourceProperty = typeof(User).GetProperty("Id"); var mapInfo = new MapInfo { Source = new MapItem { Name = sourceProperty?.Name, Type = sourceProperty?.PropertyType } }; var targetMapping = new TargetMap <UserView, string>(mapInfo); targetMapping.MapTo(p => p.Id); mapInfo.Target.Name.ShouldBe("Id"); }
public void TargetMap_ForReadOnlyTarget_MapTo_ThrowsException() { var sourceProperty = typeof(User).GetProperty("Id"); var mapInfo = new MapInfo { Source = new MapItem { Name = sourceProperty?.Name, Type = sourceProperty?.PropertyType } }; var targetMapping = new TargetMap <UserView, string>(mapInfo); var exception = Should.Throw <InvalidOperationException>(() => targetMapping.MapTo(p => p.HasName)); exception.Message.ShouldBe("Cannot map to readonly property 'HasName'."); }
private bool ProcessStandard() { var standard = (IrtStandard)comboExisting.SelectedItem; if (ReferenceEquals(standard, IrtStandard.CIRT_SHORT)) { var knownIrts = new TargetMap <double>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); var matchingPeptides = _dbIrtPeptides.Where(pep => knownIrts.ContainsKey(pep.ModifiedTarget)).ToArray(); var regression = GetRegression(knownIrts, matchingPeptides, RCalcIrt.MIN_PEPTIDES_COUNT, out var graphData); if (regression != null) { var numCirts = graphData.XValues.Length; int cirtCount; using (var dlg = new AddIrtStandardsDlg(numCirts, string.Format(Resources.LibraryBuildNotificationHandler_AddIrts__0__distinct_CiRT_peptides_were_found__How_many_would_you_like_to_use_as_iRT_standards_, numCirts), graphData)) { if (dlg.ShowDialog(this) != DialogResult.OK) { return(false); } cirtCount = dlg.StandardCount; } Regression = regression; var outlierTargets = graphData.OutlierIndices.Select(idx => new Target(graphData.Tooltips[idx])).ToArray(); SetStandards(IrtPeptidePicker.Pick(cirtCount, matchingPeptides, outlierTargets)); return(true); } } var irts = new TargetMap <double>(standard.Peptides.Select(pep => new KeyValuePair <Target, double>(pep.ModifiedTarget, pep.Irt))); var peptides = _dbIrtPeptides.Where(pep => irts.ContainsKey(pep.ModifiedTarget)).ToArray(); Regression = GetRegression(irts, peptides, null, out _); if (Regression != null) { SetStandards(standard.Peptides.Select(pep => pep.ModifiedTarget)); } else if (standard.HasDocument) { var missing = new TargetMap <bool>(standard.MissingFromDocument(Document).Select(target => new KeyValuePair <Target, bool>(target, true))); _irtAdd.AddRange(standard.Peptides.Where(pep => missing.ContainsKey(pep.ModifiedTarget)) .Select(pep => new MeasuredRetentionTime(pep.ModifiedTarget, pep.Irt, true, true))); Document = standard.ImportTo(Document); } return(true); }
/// <summary> /// Load any target map info /// </summary> void LoadTargetMap() { try { Tso = TargetSummaryOptions.GetFromMdbAssayOptionsColumn(Qt); if (Tso == null || Lex.IsNullOrEmpty(Tso.TargetMapName)) { return; } TargetMap = TargetMapDao.GetMapByLabel(Tso.TargetMapName); // get the basics TargetMap = TargetMapDao.GetMapWithCoords(TargetMap.Name); // get the coords return; } catch (Exception ex) { return; } // just return if "none" or no longer exists }
private void comboRegression_SelectedIndexChanged(object sender, EventArgs e) { labelMinIrt.Enabled = textMinIrt.Enabled = labelMaxIrt.Enabled = textMaxIrt.Enabled = labelMinPeptide.Enabled = comboMinPeptide.Enabled = labelMaxPeptide.Enabled = comboMaxPeptide.Enabled = SelectedRegressionOption.AllowEditEquation; if (!SelectedRegressionOption.AllowEditEquation) { textMinIrt.Clear(); textMaxIrt.Clear(); comboMinPeptide.Items.Clear(); comboMaxPeptide.Items.Clear(); } lblEquation.Visible = calibrateMeasuredRt.Visible = !SelectedRegressionOption.ForcedIrts; if (IsRecalibration) { UpdateEquation(sender, e); return; } calibratePeptides.ReadOnly = calibrateMeasuredRt.ReadOnly = !SelectedRegressionOption.AllowEditGrid; gridViewCalibrate.AllowUserToAddRows = gridViewCalibrate.AllowUserToDeleteRows = SelectedRegressionOption.AllowEditGrid; if (SelectedRegressionOption.ForcedStandards) { _gridViewDriver.SetPeptides(SelectedRegressionOption.StandardPeptides.Select(pep => new StandardPeptide(pep)).ToArray()); return; } if (SelectedRegressionOption.MatchedPeptideCount == 0) // fixed point { StandardsChanged(sender, e); UpdateEquation(sender, e); return; } // If standard peptide list is empty, or contains over 50% of the selected regression's peptides, use results var regressionPeptides = new TargetMap <bool>(SelectedRegressionOption.MatchedRegressionPeptides.Select(match => new KeyValuePair <Target, bool>(match.Item1.ModifiedTarget, true))); if (StandardPeptideCount == 0 || StandardPeptideList.Count(pep => regressionPeptides.ContainsKey(pep.Target)) >= regressionPeptides.Count / 2) { if (!SetCalibrationPeptides()) { comboRegression.SelectedIndex = 0; return; } } UpdateEquation(sender, e); }
public static List <IrtStandard> BestMatch(ICollection <SpectrumMzInfo> targets) { var potentialMatches = BestMatch(targets.Select(t => t.Key.Target)).ToList(); var matches = new List <IrtStandard>(); foreach (var standard in potentialMatches) { var doc = standard.GetDocument(); if (doc == null || doc.Peptides.All(nodePep => nodePep.ExplicitModsHeavy.Count == 0)) { matches.Add(standard); continue; } // Compare precursor m/zs in document (heavy label check) var docPeps = new TargetMap <PeptideDocNode>(doc.Peptides.Select(pep => new KeyValuePair <Target, PeptideDocNode>(pep.ModifiedTarget, pep))); var matchTargets = doc.Peptides.Select(pep => pep.ModifiedTarget).ToHashSet(); foreach (var target in targets) { if (!docPeps.TryGetValue(target.Key.Target, out var nodePep)) { continue; } var nodeTranGroup = nodePep.TransitionGroups.FirstOrDefault(precursor => precursor.PrecursorCharge == target.Key.Charge); if (nodeTranGroup != null && Math.Abs(nodeTranGroup.PrecursorMz - target.PrecursorMz) < 1) { matchTargets.Remove(nodePep.ModifiedTarget); } } if (matchTargets.Count == 0) { matches.Add(standard); } } if (matches.Contains(BIOGNOSYS_10) && matches.Contains(BIOGNOSYS_11)) { matches.Remove(BIOGNOSYS_10); } return(matches); }
public ChangeIrtPeptidesDlg(IList <DbIrtPeptide> irtPeptides, IEnumerable <PeptideGroupDocNode> proteins) { TargetResolver = new TargetResolver(irtPeptides.Select(p => p.Target)); _dictSequenceToPeptide = new TargetMap <DbIrtPeptide>(irtPeptides.Select(pep => new KeyValuePair <Target, DbIrtPeptide>(pep.ModifiedTarget, pep))); InitializeComponent(); comboProteins.Items.Add(new ComboBoxProtein(null)); comboProteins.Items.AddRange(proteins.Select(protein => new ComboBoxProtein(protein)) .Where(protein => protein.PeptideStrings(TargetResolver).Any()).ToArray()); comboProteins.SelectedIndex = 0; if (comboProteins.Items.Count == 1) { comboProteins.Enabled = false; } Peptides = irtPeptides.Where(peptide => peptide.Standard).ToArray(); }
public override void OnInspectorGUI() { GUILayout.Space(15.0f); GUI.enabled = TargetMap.IsValid; _paintLayer = (PaintLayer)EditorGUILayout.MaskField("Painted layer: ", (int)_paintLayer, new[] { "Type", "Height" }); // HexaType picker GUI.enabled = TargetMap.IsValid && _paintLayer.Contain(PaintLayer.Type); _typeIdBrush = EditorGUILayout.Popup("Brush type: ", _typeIdBrush, GUI.enabled ? TargetMap.Types.GetNames() : new[] { "" }); // Height picker GUI.enabled = TargetMap.IsValid && _paintLayer.Contain(PaintLayer.Height); _heightBrush = EditorGUILayout.Slider("Brush height: ", _heightBrush, 0, 20); // Space GUILayout.Space(5.0f); // Enable edit mode buton GUI.enabled = TargetMap.IsValid; GUI.color = IsEditModeEnabled ? Color.green : Color.yellow; if (GUILayout.Button(EditModeButtonString)) { IsEditModeEnabled = !IsEditModeEnabled; } GUI.color = Color.white; GUILayout.Label(IsEditModeEnabled ? "Edit mode hide scene view handlers!" : ""); // Rebuild button. if (GUILayout.Button("Force rebuild")) { TargetMap.ForceRebuild(); } GUILayout.Space(15.0f); // Set Data GUI.enabled = true; TargetMap.HexData = EditorGUILayout.ObjectField("HexTerrain data:", TargetMap.HexData, typeof(HexTerrainData), false) as HexTerrainData; TargetMap.Types = EditorGUILayout.ObjectField("Types data:", TargetMap.Types, typeof(HexagonTypeData), false) as HexagonTypeData; }
public IEnumerable <PeptideDocNode> FindInDocument(SrmDocument document) { var standardDoc = GetDocument(); var docPeps = new TargetMap <Dictionary <int, SignedMz> >(standardDoc != null ? standardDoc.Peptides.Select(pep => new KeyValuePair <Target, Dictionary <int, SignedMz> >(pep.ModifiedTarget, pep.TransitionGroups.ToDictionary(nodeTranGroup => nodeTranGroup.PrecursorCharge, nodeTranGroup => nodeTranGroup.PrecursorMz))) : Peptides.Select(pep => new KeyValuePair <Target, Dictionary <int, SignedMz> >(pep.ModifiedTarget, null))); // Compare precursor m/z to see if heavy labeled foreach (var nodePep in document.Peptides) { if (docPeps.TryGetValue(nodePep.ModifiedTarget, out var precursors) && (precursors == null || nodePep.TransitionGroups.Any(nodeTranGroup => precursors.TryGetValue(nodeTranGroup.PrecursorCharge, out var mz) && Math.Abs(mz - nodeTranGroup.PrecursorMz) < 1))) { yield return(nodePep); } } }
private void CirtLibraryBuildTest() { RunUI(() => { SkylineWindow.NewDocument(true); SkylineWindow.ModifyDocument("Set default settings", doc => doc.ChangeSettings(SrmSettingsList.GetDefault())); }); var peptideSettingsDlg = ShowDialog <PeptideSettingsUI>(SkylineWindow.ShowPeptideSettingsUI); // build a library with CiRT peptides BuildLibrary(TestFilesDir.GetTestPath("maxquant_cirt"), null, null, false, true, false, false, IrtStandard.CIRT_SHORT); var addIrtStandardsDlg = WaitForOpenForm <AddIrtStandardsDlg>(); // use 15 CiRT peptides as standards const int numStandards = 15; RunUI(() => addIrtStandardsDlg.StandardCount = numStandards); var addIrtPeptidesDlg = ShowDialog <AddIrtPeptidesDlg>(addIrtStandardsDlg.OkDialog); // don't recalibrate; add RT predictor var recalibrateDlg = ShowDialog <MultiButtonMsgDlg>(addIrtPeptidesDlg.OkDialog); var addRetentionTimePredictorDlg = ShowDialog <AddRetentionTimePredictorDlg>(recalibrateDlg.ClickNo); OkDialog(addRetentionTimePredictorDlg, addRetentionTimePredictorDlg.OkDialog); // verify that there are 15 CiRT peptides as standards in the calculator var editIrtCalcDlg = ShowDialog <EditIrtCalcDlg>(peptideSettingsDlg.EditCalculator); var cirtPeptides = new TargetMap <bool>(IrtStandard.CIRT.Peptides.Select(pep => new KeyValuePair <Target, bool>(pep.ModifiedTarget, true))); RunUI(() => { Assert.AreEqual(numStandards, editIrtCalcDlg.StandardPeptideCount); Assert.IsTrue(editIrtCalcDlg.StandardPeptides.All(pep => cirtPeptides.ContainsKey(pep.ModifiedTarget))); }); OkDialog(editIrtCalcDlg, editIrtCalcDlg.CancelDialog); OkDialog(peptideSettingsDlg, peptideSettingsDlg.CancelDialog); RunUI(() => SkylineWindow.SaveDocument(TestFilesDir.GetTestPath("cirt_test.sky"))); }