public void LoadGFF3(string fileName) { string idTag = AppSettings.Loading.GFF3_ID_TAG.Item; int tagSize = idTag.Length; string line = ""; string parentTag = "arent="; int pTagSize = parentTag.Length; int count = 0; long modulo = MainData.ScanFileForModulo(fileName, 5); long lineCount = modulo * 5; MainData.UpdateLog("Reading... ", true); char[] spChar = { '\t' }; char[] spChar2 = { ';' }; using (StreamReader sr = new StreamReader(fileName)) { while ((line = sr.ReadLine()) != null) { if (line.Length > 10) { string[] spstr = line.Split(spChar, 10); string[] spstr2 = spstr [8].Split(spChar2, 20); string ID = ""; string pID = ""; foreach (string st in spstr2) { if (st.Contains(idTag)) { ID = st; break; } } foreach (string st in spstr2) { if (st.Contains(parentTag)) { pID = st; break; } } ID = ID.Substring(tagSize); GFF3ApplyOptionsToID(ref ID); if (pID != "") { GFF3ApplyOptionsToID(ref pID); } Sense sn = Sense.Sense; if (spstr [6].Equals("-")) { sn = Sense.AntiSense; } else if (spstr [6].Equals(".")) { sn = Sense.None; } string nameOfType = ID + "#" + spstr [2] + "#" + pID;; int sta, end; bool A = int.TryParse(spstr [3], out sta); bool B = int.TryParse(spstr [4], out end); if (A && B) { if (Scaffolds.ContainsKey(spstr [0])) { Scaffolds [spstr [0]].SendComponent(nameOfType, sta, end, sn); } else { throw new Exception("Gff3 references scaffold not found in genome!"); } } } count++; if (count % modulo == 0) { long perc = (long)(((float)count / (float)lineCount) * 100); MainData.UpdateLog("Read " + perc + "% of gff3..", true); } } } if (AppSettings.Genes.GENERATE_ANY_PROMO.Item || AppSettings.Genes.GENERATE_FLANK3.Item) { MainData.UpdateLog("Generating GFF3 additional elements as described in Settings -> Genes", true); foreach (KeyValuePair <string, Scaffold> kvp in Scaffolds) { kvp.Value.RunGenePostLoad(); } } }