コード例 #1
0
        protected void OnSave(object sender, EventArgs e)
        {
            bool   success = true;
            double x, y;

            model.Axes [0].Title = xAxisEntry.Text;
            model.Axes [1].Title = yAxisEntry.Text;
            model.Title          = titleEntry.Text;

            if (!double.TryParse(xScaleEntry.Text, out x))
            {
                success = false;
            }
            if (!double.TryParse(yScaleEntry.Text, out y))
            {
                success = false;
            }
            if (fileEntry.Text.Length < 2)
            {
                success = false;
            }

            if (!success)
            {
                MainData.ShowMessageWindow("Unable to verify field entries, x & y are numbers, and you need a file location!", false);
            }
            else
            {
                SaveToPdf(fileEntry.Text, x, y);
                MainData.UpdateLog("Success!\nSaved Pdf to: " + fileEntry.Text, false);
                this.Destroy();
            }
        }
コード例 #2
0
ファイル: WindowMain.cs プロジェクト: OliverCardiff/Renoo
        protected void OnFkpmLoad(object sender, EventArgs e)
        {
            if (MainData.FPKMFileNames.Count > 0)
            {
                List <PreSampleDefinition> prels = new List <PreSampleDefinition> ();

                foreach (string st in MainData.FPKMFileNames)
                {
                    List <string> cols = null;
                    FKPM.GetSampleNames(st, out cols);
                    int cnt = 0;
                    foreach (string ss in cols)
                    {
                        PreSampleDefinition pef = new PreSampleDefinition(SampleType.Expr);
                        pef.singleFName    = st;
                        pef.singleColID    = ss;
                        pef.singleColIndex = cnt + 9;
                        pef.IsGenotyped    = false;
                        pef.TotalColumns   = cols.Count;
                        prels.Add(pef);
                        cnt += 4;
                    }
                }

                SampleAllocationWindow swind = new SampleAllocationWindow(prels);

                swind.ShowAll();
            }
            else
            {
                MainData.ShowMessageWindow("You need to add some files to load first!", false);
            }
        }
コード例 #3
0
ファイル: WindowMain.cs プロジェクト: OliverCardiff/Renoo
 protected void OnRankSplitProcess(object sender, EventArgs e)
 {
     try{
         ParameterizedThreadStart prams = new ParameterizedThreadStart(RankSplit.ProcessRequest);
         Thread        o   = new Thread(prams);
         RankSplitInfo rsi = GatherRankSplitInfo(true);
         o.Start((object)rsi);
     }
     catch (Exception ex)
     {
         MainData.ShowMessageWindow(ex.Message, false);
     }
 }
コード例 #4
0
        protected void OnRunGroupTest(object sender, EventArgs e)
        {
            BetweenGroupTest pt;

            try
            {
                pt       = StatsTester.BetweenTestEnum [groupTestCombo.ActiveText];
                Thread t = new Thread(delegate() { TestDoWorkBetween(pt); });
                t.Start();
            }
            catch (Exception ex) {
                MainData.ShowMessageWindow("You need to Select A Comparison Test!\n" + ex.Message, false);
            }
        }
コード例 #5
0
        protected void OnRunCovTest(object sender, EventArgs e)
        {
            PairedTest pt;

            try
            {
                pt = StatsTester.PairedTestEnum [covTestCombo.ActiveText];

                Thread t = new Thread(delegate() { TestDoWorkPaired(pt); });
                t.Start();
            }
            catch (Exception ex) {
                MainData.ShowMessageWindow("You need to Select A Correlation Test!\n" + ex.Message, false);
            }
        }
コード例 #6
0
ファイル: WindowMain.cs プロジェクト: OliverCardiff/Renoo
 protected void OnRankSplitSaveGo(object sender, EventArgs e)
 {
     try{
         ParameterizedThreadStart prams = new ParameterizedThreadStart(RankSplit.ProcessRequest);
         Thread        o   = new Thread(prams);
         RankSplitInfo rsi = GatherRankSplitInfo(false);
         if (RankSplit.PickFileName(out RankSplit.LastFileName))
         {
             o.Start((object)rsi);
         }
     }
     catch (Exception ex)
     {
         MainData.ShowMessageWindow(ex.Message, false);
     }
 }
コード例 #7
0
ファイル: LoaderSettings.cs プロジェクト: OliverCardiff/Renoo
        protected void OnAccept(object sender, EventArgs e)
        {
            string msg;
            bool   canClose = true;

            foreach (SettingBinder b in _settings)
            {
                if (!b.ReturnSettings(out msg))
                {
                    MainData.ShowMessageWindow(msg, false);
                    canClose = false;
                }
            }
            if (canClose)
            {
                this.Destroy();
            }
        }
コード例 #8
0
ファイル: WindowMain.cs プロジェクト: OliverCardiff/Renoo
        protected void OnVcfLoad(object sender, EventArgs e)
        {
            if (MainData.VariantFileNames.Count > 0)
            {
                List <PreSampleDefinition> prels = new List <PreSampleDefinition> ();

                foreach (string st in MainData.VariantFileNames)
                {
                    List <string> cols = null;

                    if (Variant.IsGenotyped(st, ref cols))
                    {
                        int cnt = 0;
                        foreach (string ss in cols)
                        {
                            PreSampleDefinition pef = new PreSampleDefinition(SampleType.Vcf);
                            pef.singleFName    = st;
                            pef.singleColID    = ss;
                            pef.singleColIndex = cnt + 9;
                            pef.IsGenotyped    = true;
                            pef.TotalColumns   = cols.Count;
                            prels.Add(pef);
                            cnt++;
                        }
                    }
                    else
                    {
                        PreSampleDefinition pef = new PreSampleDefinition(SampleType.Vcf);
                        pef.singleFName  = st;
                        pef.IsGenotyped  = false;
                        pef.TotalColumns = 0;
                        prels.Add(pef);
                    }
                }

                SampleAllocationWindow swind = new SampleAllocationWindow(prels);

                swind.ShowAll();
            }
            else
            {
                MainData.ShowMessageWindow("You need to add some files to load first!", false);
            }
        }
コード例 #9
0
 protected void AddRegion(string id, string typename, int start, int end, Sense sense)
 {
     try{
         if (typename.Equals("gene"))
         {
             Gene g = new Gene(id, typename, start, end, sense);
             Genes.Add(id, g);
         }
         else
         {
             Region r = new Region(id, typename, start, end, sense);
             Regions.Add(id, r);
         }
     }
     catch (Exception e) {
         MainData.ShowMessageWindow("Your Gff3 IDs are not consistent!\n " +
                                    "Change Gff3 loader options to fix them!\n Error: " + e.Message + "\n Offending id:" + id, true);
     }
 }
コード例 #10
0
ファイル: LoaderSettings.cs プロジェクト: OliverCardiff/Renoo
        protected void OnRunFilter(object sender, EventArgs e)
        {
            bool   parseSuccess = true;
            string failfield    = "(";

            instructions = new List <ElementFilterInstruction> ();
            FiltSettings.Clear();

            foreach (FilterEntryBinder feb in filtEntBind)
            {
                if (feb.Check.Active)
                {
                    int ma; int mi;
                    if (!int.TryParse(feb.MaxEnt.Text, out ma))
                    {
                        parseSuccess = false;
                        failfield   += feb.id + "min val, ";
                    }
                    if (!int.TryParse(feb.MinEnt.Text, out mi))
                    {
                        parseSuccess = false;
                        failfield   += feb.id + "max val, ";
                    }
                    if (parseSuccess)
                    {
                        FiltSettings.Add(new OldFiltSettings(feb.id, mi, ma));
                        ElementFilterInstruction efil = new ElementFilterInstruction(feb.id, mi, ma);
                        instructions.Add(efil);
                    }
                }
            }

            if (parseSuccess)
            {
                MainData.RunElementFilter(instructions);
                this.Destroy();
            }
            else
            {
                MainData.ShowMessageWindow("The following entries were in error: " + failfield, false);
            }
        }
コード例 #11
0
ファイル: WindowMain.cs プロジェクト: OliverCardiff/Renoo
        protected void OnBamLoad(object sender, EventArgs e)
        {
            if (MainData.BAMFileNames.Count > 0)
            {
                List <PreSampleDefinition> prels = new List <PreSampleDefinition> ();

                foreach (string st in MainData.BAMFileNames)
                {
                    PreSampleDefinition pef = new PreSampleDefinition(SampleType.BAM);
                    pef.singleFName = st;
                    prels.Add(pef);
                }

                SampleAllocationWindow swind = new SampleAllocationWindow(prels);

                swind.ShowAll();
            }
            else
            {
                MainData.ShowMessageWindow("You need to add some files to load first!", false);
            }
        }
コード例 #12
0
        protected void OnAccept(object sender, EventArgs e)
        {
            bool success = true;
            Dictionary <string, PreSampleDefinition> defsToSend = new Dictionary <string, PreSampleDefinition> ();

            foreach (EntryDefPair edp in entries)
            {
                if (edp.Ent.Text.Length > 0)
                {
                    if (!defsToSend.ContainsKey(edp.Ent.Text))
                    {
                        defsToSend.Add(edp.Ent.Text, new PreSampleDefinition(edp.Pres, edp.Ent.Text));
                    }
                    else
                    {
                        defsToSend [edp.Ent.Text].MergeSamp(edp.Pres);
                    }
                }
                else
                {
                    success = false;
                }
            }
            if (success)
            {
                this.Destroy();
                Gtk.Application.Invoke(delegate {
                    MainData.SendSampleDefsToSamples(new List <PreSampleDefinition> (defsToSend.Values));
                }
                                       );
            }
            else
            {
                MainData.ShowMessageWindow("You need a sample ID for each set of information!", false);
            }
        }
コード例 #13
0
ファイル: RankSplit.cs プロジェクト: OliverCardiff/Renoo
        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);
            }
        }
コード例 #14
0
        public static void WriteDataFile(string fileName, NumericalText nt)
        {
            if (((nt.Data != null) && (nt.Data.Count > 0)) || ((nt.Tags != null) && (nt.Tags.Count > 0)))
            {
                int                 useLen         = Math.Min(nt.Titles.Count, (nt.Data.Count + nt.Tags.Count));
                int                 dataLen        = nt.Data [0].Count;
                List <int>          counts         = new List <int> ();
                List <int>          currentIndexes = new List <int> ();
                List <PrintOutNext> printTypes     = new List <PrintOutNext> ();

                if (nt.Tags != null)
                {
                    int tagInd = 0;
                    foreach (List <string> sl in nt.Tags)
                    {
                        counts.Add(sl.Count - 1);
                        printTypes.Add(PrintOutNext.Tag);
                        dataLen = Math.Max(dataLen, sl.Count);
                        currentIndexes.Add(tagInd);
                        tagInd++;
                    }
                }
                if (nt.Data != null)
                {
                    int datInd = 0;
                    foreach (List <Double> ld in nt.Data)
                    {
                        counts.Add(ld.Count - 1);
                        printTypes.Add(PrintOutNext.Data);
                        dataLen = Math.Max(dataLen, ld.Count);
                        currentIndexes.Add(datInd);
                        datInd++;
                    }
                }

                using (StreamWriter sw = new StreamWriter(fileName)) {
                    for (int i = 0; i < useLen; i++)
                    {
                        if (i > 0)
                        {
                            sw.Write("\t");
                        }
                        sw.Write(nt.Titles [i]);
                    }
                    sw.Write("\n");

                    for (int j = 0; j < dataLen; j++)
                    {
                        for (int i = 0; i < useLen; i++)
                        {
                            if (i > 0)
                            {
                                sw.Write("\t");
                            }
                            if (counts [i] >= j)
                            {
                                if (printTypes [i] == PrintOutNext.Data)
                                {
                                    sw.Write(nt.Data [currentIndexes[i]] [j]);
                                }
                                else
                                {
                                    sw.Write(nt.Tags [currentIndexes [i]] [j]);
                                }
                            }
                            else
                            {
                                sw.Write("x");
                            }
                        }
                        sw.Write("\n");
                    }
                }
                MainData.UpdateLog("Saved " + MainData.MainWindow.MaxLenString(fileName, 20), false);
            }
            else
            {
                MainData.ShowMessageWindow("There isn't any data there to save!", false);
            }
        }