コード例 #1
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);
            }
        }
コード例 #2
0
        public void SendFKPM(FKPM fkp)
        {
            if (!FragPerKiloMil.ContainsKey(fkp.Sample.ID))
            {
                FragPerKiloMil.Add(fkp.Sample.ID, new List <FKPM> ());
            }

            FragPerKiloMil [fkp.Sample.ID].Add(fkp);
            MainData.LoadedFKPM++;
        }
コード例 #3
0
 public FKPMGene(string gen, FKPM fk)
 {
     fkpm = fk;
     gene = gen;
 }
コード例 #4
0
        protected static void LoadFKPMFile(string fName, BioSample[] samps)
        {
            if (!AppSettings.Loading.FKPM_USE_OTHER_THAN_DIFFOUT.Item)
            {
                using (StreamReader sr = new StreamReader(fName)) {
                    sr.ReadLine();
                    string line;
                    int    idInd = AppSettings.Loading.FKPM_ID_COLUMN.Item;

                    while ((line = sr.ReadLine()) != null)
                    {
                        string[] spstr = line.Split('\t');
                        string   gen   = spstr [idInd];
                        for (int i = 9; (i + 3) < spstr.Length; i += 4)
                        {
                            bool   parseSuccess = true;
                            double hi; double lo; double fkpm;
                            if (!double.TryParse(spstr [i], out fkpm))
                            {
                                parseSuccess = false;
                            }
                            if (!double.TryParse(spstr [i + 1], out hi))
                            {
                                parseSuccess = false;
                            }
                            if (!double.TryParse(spstr [i + 2], out lo))
                            {
                                parseSuccess = false;
                            }
                            if (!spstr [i + 3].Contains("OK"))
                            {
                                parseSuccess = false;
                            }
                            int sampInd = i - 9;
                            if (i > 0)
                            {
                                sampInd++;
                                sampInd /= 4;
                            }
                            if (parseSuccess)
                            {
                                FKPM     fk  = new FKPM(fkpm, hi, lo, samps [sampInd]);
                                FKPMGene fkg = new FKPMGene(gen, fk);
                                AllFKPMS.Add(fkg);
                            }
                        }
                    }
                }
            }
            else
            {
                int colsPerItem = 1;
                if (AppSettings.Loading.FKPM_FILE_HAS_HILO.Item)
                {
                    colsPerItem += 2;
                }
                if (AppSettings.Loading.FKPM_FILE_HAS_TESTOK.Item)
                {
                    colsPerItem += 1;
                }

                char[] spch       = AppSettings.Loading.FKPM_FILE_DELIM.Item;
                int    firstScore = AppSettings.Loading.FKPM_SCORE_COLUMN.Item;
                int    idInd      = AppSettings.Loading.FKPM_ID_COLUMN.Item;

                using (StreamReader sr = new StreamReader(fName)) {
                    sr.ReadLine();
                    string line;

                    while ((line = sr.ReadLine()) != null)
                    {
                        string[] spstr = line.Split(spch);
                        string   gen   = spstr [idInd];

                        for (int i = firstScore; (i + colsPerItem - 1) < spstr.Length; i += colsPerItem)
                        {
                            bool   parseSuccess = true;
                            double hi = 0; double lo = 0; double fkpm;

                            if (!double.TryParse(spstr [i], out fkpm))
                            {
                                parseSuccess = false;
                            }
                            if (AppSettings.Loading.FKPM_FILE_HAS_HILO.Item)
                            {
                                int loIn = AppSettings.Loading.FKPM_TESTLO_COLUMN.Item;
                                int hiIn = AppSettings.Loading.FKPM_TESTHI_COLUMN.Item;

                                loIn = i + loIn - firstScore;
                                hiIn = i + hiIn - firstScore;

                                if (!double.TryParse(spstr [hiIn], out hi))
                                {
                                    parseSuccess = false;
                                }
                                if (!double.TryParse(spstr [loIn], out lo))
                                {
                                    parseSuccess = false;
                                }
                            }
                            if (AppSettings.Loading.FKPM_FILE_HAS_TESTOK.Item)
                            {
                                int textIn = AppSettings.Loading.FKPM_TESTOK_COLUMN.Item;
                                textIn = i + textIn - firstScore;

                                if (!spstr [textIn].Contains(AppSettings.Loading.FKPM_TESTOK_TEXT.Item))
                                {
                                    parseSuccess = false;
                                }
                            }
                            int sampInd = i - 9;
                            if (i > 0)
                            {
                                sampInd++;
                                sampInd /= 4;
                            }
                            if (parseSuccess)
                            {
                                FKPM     fk  = new FKPM(fkpm, hi, lo, samps [sampInd]);
                                FKPMGene fkg = new FKPMGene(gen, fk);
                                AllFKPMS.Add(fkg);
                            }
                        }
                    }
                }
            }
        }