コード例 #1
0
 public void SendFKPM(FKPMGene fkp)
 {
     if (Genes.ContainsKey(fkp.gene))
     {
         Genes [fkp.gene].SendFKPM(fkp.fkpm);
     }
     if (Regions.ContainsKey(fkp.gene))
     {
         Regions [fkp.gene].SendFKPM(fkp.fkpm);
     }
 }
コード例 #2
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);
                            }
                        }
                    }
                }
            }
        }