public StatsOutputWindow(RSplitContainer rsp) : base(Gtk.WindowType.Toplevel) { DataToProcess = rsp; this.Build(); BuildComparisonMatrix(); PopulateCombos(); }
public static void MakeRankLineGraph(Dictionary <string, List <double> > data, GraphWindow grWind, string xLab, string yLab, string title, RSplitContainer <double> rsc, bool mergeOld) { try { UpdateLog("Summarising groups..", true); RankLine rLine = new RankLine(data, "Rank-Groups by Mean", ModelDisplayType.Line); PlotModel model = new PlotModel { Title = title }; LinearAxis axX = new LinearAxis(AxisPosition.Bottom, 0, rLine.GetXPercentLimit(1) + 1, xLab); LinearAxis axY = new LinearAxis(AxisPosition.Left, 0, rLine.GetYPercentLimit(1), yLab); //model.titlefontsize! model.TitlePadding = 10; axX.AxisTitleDistance = 10; axY.AxisTitleDistance = 10; model.Axes.Add(axX); model.Axes.Add(axY); rLine.AddToModel(model); if (mergeOld && RSPToMergeSeries != null) { foreach (Series sr in RSPToMergeSeries) { model.Series.Add(sr); } } else { if (RSPToMergeSeries != null) { RSPToMergeSeries.Clear(); } } RSPToMergeSeries.AddRange(rLine.GetNextSeries(title.Split(' ')[0])); model.IsLegendVisible = true; MainWindow.InsertGraph(grWind, model, rLine); MainWindow.SetRSplitDoubleContainer(rsc); UpdateLog("Made a Mean-Error Rank/Split Bar graph...", true); ProgramState.MadeGlobalGraph = true; } catch (Exception e) { ShowMessageWindow(e.Message, true); } }
private static Dictionary <string, List <T> > ProcessRSplitContainer <T>(RSplitContainer <T> rspc, RankSplitInfo rsi, Dictionary <string, double> rDict, Dictionary <string, T> outDict, bool seqMatch) { if (rsi.doSubSet && rsi.SubSetType == SubSetMethod.Previous) { rspc.AddIDFilterList(rsi.oldIDlist); } rspc.MergeDictosToList(rDict, outDict, false, seqMatch); if (rsi.doSubSet && rsi.SubSetType == SubSetMethod.Current) { return(rspc.GetDivisionDict(rsi.SplitCount, rsi.subCurMainRank, rsi.subCurSplitCount)); } else { return(rspc.GetDivisionDict(rsi.SplitCount)); } }
public static void ProcessRequest(object TheInfo) { try { RankSplitInfo info = TheInfo as RankSplitInfo; string fName = LastFileName; bool keepGoing = true; bool seqMatch = false; RankMethodSubSequence = info.SeqDiv; OutputMethodSubSequence = info.SeqDivOut; if (RankMethodSubSequence == SubSequenceDivision.Normalised) { RankStartDiv = info.divStart; RankEndDiv = info.divEnd; } if (OutputMethodSubSequence == SubSequenceDivision.Normalised) { OutputStartDiv = info.divStartOut; OutputEndDiv = info.divEndOut; } if (RankMethodSubSequence == SubSequenceDivision.AbsoluteBases) { RankBaseCount = info.baseCount; RankFromStart = info.fromStart; } if (OutputMethodSubSequence == SubSequenceDivision.AbsoluteBases) { OutputFromStart = info.fromStartOut; OutputBaseCount = info.baseCountOut; } if (info.GraphingType == GraphType.Image && OutputMethodSubSequence != SubSequenceDivision.AbsoluteBases) { OutputMethodSubSequence = SubSequenceDivision.AbsoluteBases; OutputFromStart = !AppSettings.Output.DEFAULT_IMG_FROMEND.Item; OutputBaseCount = AppSettings.Output.DEFAULT_IMG_BASES.Item; } if (info.sample != "All") { SampleToUse = info.sample; UseSample = true; } else { UseSample = false; } if (info.SeqFeature == info.SeqFeature2) { seqMatch = true; } else { seqMatch = false; } if (keepGoing) { RSplitContainer <string> rspcString = new RSplitContainer <string> ("none", false); RSplitContainer <double> rspcDouble = new RSplitContainer <double> (0, false); RSplitContainer <List <double> > rspcListDouble = new RSplitContainer <List <double> > (null, true); Dictionary <string, double> rankDict = Methods [info.RMethod].Invoke(info.SeqFeature); Dictionary <string, string> baseDict; Dictionary <string, double> singleDict; Dictionary <string, List <double> > listDict; if (info.doGraph == false) { switch (info.Text) { case OutputMethText.BlastID: baseDict = MainData.Genome.RSPOUTBlastHitID(info.SeqFeature); rspcString.MergeDictosToList(rankDict, baseDict, true, seqMatch); ProcessingClass.WriteDataFile(fName, rspcString.GetData(false)); break; case OutputMethText.BaseSeq: baseDict = MainData.Genome.RSPOUTBaseSeq(info.SeqFeature); rspcString.MergeDictosToList(rankDict, baseDict, false, seqMatch); ProcessingClass.WriteDataFile(fName, rspcString.GetData(false)); break; case OutputMethText.FastaBase: baseDict = MainData.Genome.RSPOUTBaseSeq(info.SeqFeature); rspcString.MergeDictosToList(rankDict, baseDict, false, seqMatch); rspcString.WriteFastaFile(fName); break; case OutputMethText.SeqNames: baseDict = MainData.Genome.RSPOUTReadName(info.SeqFeature); rspcString.MergeDictosToList(rankDict, baseDict, false, seqMatch); ProcessingClass.WriteDataFile(fName, rspcString.GetData(false)); break; default: break; } } else { string yLab; string xLab; SetLabels(info.Graph, info.GraphingType, out xLab, out yLab); string title = info.SeqFeature + " "; if (info.doSubSeq) { title += "from "; if (info.SeqDiv == SubSequenceDivision.AbsoluteBases) { title += info.baseCount + " "; if (info.fromStart) { title += "from start "; } else { title += "to end "; } } else { title += "division " + info.divStart + "/20 to " + info.divEnd + "/20 "; } } title += "ranked by " + MethodDesc [info.RMethod] + " and split into " + info.SplitCount + " groups"; Dictionary <string, List <double> > procCont; Dictionary <string, List <List <double> > > procContList; switch (info.Graph) { case OutputMethGraph.Expr: singleDict = MainData.Genome.RSPOUTExprValue(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Histo) { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; case OutputMethGraph.ExprNorm: singleDict = MainData.Genome.RSPOUTExprNorm(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Histo) { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; case OutputMethGraph.ExprVar: singleDict = MainData.Genome.RSPOUTExprRange(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Histo) { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; case OutputMethGraph.MethyCov: if (info.GraphingType == GraphType.Spatial) { listDict = MainData.Genome.RSPOUTMethylCoverageDivision(info.SeqFeature2); procContList = ProcessRSplitContainer <List <double> > (rspcListDouble, info, rankDict, listDict, seqMatch); if (info.SeqDivOut != SubSequenceDivision.AbsoluteBases) { MainData.MakeMultiBayesRankGraph(procContList, GraphWindow.Global, xLab, yLab, title, rspcListDouble, info.MergeGraphs); } else { MainData.MakeMultiBayesBaseRankGraph(procContList, GraphWindow.Global, xLab, yLab, title, info.fromStartOut, rspcListDouble, info.MergeGraphs); } } else if (info.GraphingType == GraphType.Means) { singleDict = MainData.Genome.RSPOUTQuantMethyCov(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else if (info.GraphingType == GraphType.Image) { //TODO: Make the image! } break; case OutputMethGraph.MethyDepthCov: if (info.GraphingType == GraphType.Spatial) { listDict = MainData.Genome.RSPOUTMethylCoverageDepthDivision(info.SeqFeature2); procContList = ProcessRSplitContainer <List <double> > (rspcListDouble, info, rankDict, listDict, seqMatch); if (info.SeqDivOut != SubSequenceDivision.AbsoluteBases) { MainData.MakeMultiBayesRankGraph(procContList, GraphWindow.Global, xLab, yLab, title, rspcListDouble, info.MergeGraphs); } else { MainData.MakeMultiBayesBaseRankGraph(procContList, GraphWindow.Global, xLab, yLab, title, info.fromStartOut, rspcListDouble, info.MergeGraphs); } } else if (info.GraphingType == GraphType.Means) { singleDict = MainData.Genome.RSPOUTQuantMethyDepthCov(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else if (info.GraphingType == GraphType.Histo) { singleDict = MainData.Genome.RSPOUTMethylDepthTotal(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else if (info.GraphingType == GraphType.Image) { listDict = MainData.Genome.RSPOUTMethylCoverageDepthDivision(info.SeqFeature2); procContList = ProcessRSplitContainer <List <double> > (rspcListDouble, info, rankDict, listDict, seqMatch); MainData.MakeRegionChangeMap(procContList, rspcListDouble, info.MergeGraphs); } break; case OutputMethGraph.BlastE: singleDict = MainData.Genome.RSPBlastEValue(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Means) { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; case OutputMethGraph.BlastID: singleDict = MainData.Genome.RSPBlastPercID(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Means) { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; case OutputMethGraph.Variant: singleDict = MainData.Genome.RSPOUTQuantVar(info.SeqFeature2); procCont = ProcessRSplitContainer <double> (rspcDouble, info, rankDict, singleDict, seqMatch); if (info.GraphingType == GraphType.Means) { MainData.MakeRankLineGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } else { MainData.MakeMultiHistoRankGraph(procCont, GraphWindow.Global, xLab, yLab, title, rspcDouble, info.MergeGraphs); } break; default: break; } } } } catch (Exception e) { MainData.ShowMessageWindow(e.Message, true); } }
public static void MakeMultiHistoRankGraph(Dictionary <string, List <double> > data, GraphWindow grWind, string xLab, string yLab, string title, RSplitContainer <double> rsc, bool mergeOld) { try { UpdateLog("Making Odds ratios..", true); MultiHisto mHist = new MultiHisto(data, 100, ModelDisplayType.Line); PlotModel model = new PlotModel { Title = title }; LinearAxis axX = new LinearAxis(AxisPosition.Bottom, 0, mHist.GetXPercentLimit(1) + 1, xLab); LinearAxis axY = new LinearAxis(AxisPosition.Left, 0, mHist.GetYPercentLimit(1), yLab); model.TitlePadding = 10; axX.AxisTitleDistance = 10; axY.AxisTitleDistance = 10; model.Axes.Add(axX); model.Axes.Add(axY); mHist.AddToModel(model); if (mergeOld && RSPToMergeSeries != null) { foreach (Series sr in RSPToMergeSeries) { model.Series.Add(sr); } } else { if (RSPToMergeSeries != null) { RSPToMergeSeries.Clear(); } } RSPToMergeSeries.AddRange(mHist.GetNextSeries(title.Split(' ')[0])); model.IsLegendVisible = true; MainWindow.InsertGraph(grWind, model, mHist); MainWindow.SetRSplitDoubleContainer(rsc); UpdateLog("Made a density-based Rank/Split graph...", true); ProgramState.MadeGlobalGraph = true; } catch (Exception e) { ShowMessageWindow(e.Message, true); } }
public static void MakeRegionChangeMap(Dictionary <string, List <List <double> > > data, RSplitContainer <List <double> > rsc, bool mergeOld) { try{ UpdateLog("Making Images..", true); RegionChangeMap rcm = new RegionChangeMap(data, ColourRank.Sequential, RankSplit.OutputBaseCount, 20, RankSplit.OutputFromStart); List <Bitmap> bml = rcm.GetBmps(); List <string> stl = rcm.GetStrs(); MainWindow.InsertImage(bml, stl); MainWindow.SetRSplitDoubleContainer(rsc); ProgramState.ImageHasBitmap = true; UpdateLog("Images sent to Image tab!", true); } catch (Exception e) { ShowMessageWindow(e.Message, true); } }
public void SetRSplitDoubleContainer(RSplitContainer <List <double> > rsc) { LatestRSplitLISTDUB = rsc; CurrentRSPContainerType = CurrentSavedRankData.ListDouble; }
public void SetRSplitDoubleContainer(RSplitContainer <double> rsc) { LatestRSplitDOUBLE = rsc; CurrentRSPContainerType = CurrentSavedRankData.Double; }