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); } }