Example #1
0
 public Region(string _name, string typename) : base()
 {
     BlastHit       = null;
     RegionTypeName = typename;
     RegionName     = _name;
     RegElements    = new Dictionary <string, List <MiscElement> > ();
     FragPerKiloMil = new Dictionary <string, List <FKPM> > ();
 }
Example #2
0
 public Region(string _name, string typename, int _start, int _end)
     : base(_start, _end, Sense.None)
 {
     BlastHit       = null;
     RegionTypeName = typename;
     RegionName     = _name;
     RegElements    = new Dictionary <string, List <MiscElement> > ();
     FragPerKiloMil = new Dictionary <string, List <FKPM> > ();
 }
Example #3
0
        public void LoadOutFmt6(string fileName)
        {
            MainData.LoadedBlasts = 0;
            Dictionary <string, BlastHit> bhits = new Dictionary <string, BlastHit> ();

            string line = "";

            using (StreamReader sr = new StreamReader(fileName)) {
                while ((line = sr.ReadLine()) != null)
                {
                    string[] spstr  = line.Split('\t');
                    string[] spstr2 = spstr [0].Split('|');

                    bool   parseSuccess = true;
                    double ev; double pid;

                    if (!double.TryParse(spstr [2], out pid))
                    {
                        parseSuccess = false;
                    }
                    if (!double.TryParse(spstr [10], out ev))
                    {
                        parseSuccess = false;
                    }

                    if (parseSuccess)
                    {
                        BlastHit next = new BlastHit(spstr [1], pid, ev);
                        if (!bhits.ContainsKey(spstr2 [0]))
                        {
                            bhits.Add(spstr2 [0], next);
                        }
                    }
                }
            }

            foreach (KeyValuePair <string, BlastHit> kvp in bhits)
            {
                if (MainData.GeneToScaffDict.ContainsKey(kvp.Key))
                {
                    if (Scaffolds [MainData.GeneToScaffDict [kvp.Key]].Genes.ContainsKey(kvp.Key))
                    {
                        Scaffolds [MainData.GeneToScaffDict [kvp.Key]].Genes [kvp.Key].BlastHit = kvp.Value;
                        MainData.LoadedBlasts++;
                    }
                }
                if (MainData.RegionToScaffDict.ContainsKey(kvp.Key))
                {
                    if (Scaffolds [MainData.RegionToScaffDict [kvp.Key]].Regions.ContainsKey(kvp.Key))
                    {
                        Scaffolds [MainData.RegionToScaffDict [kvp.Key]].Regions [kvp.Key].BlastHit = kvp.Value;
                        MainData.LoadedBlasts++;
                    }
                }
            }
        }