Exemple #1
0
 protected virtual string GetReadNamesSection(int st, int ed)
 {
     if (Reads != null)
     {
         string retStr = "";
         foreach (SeqRead sq in Reads)
         {
             NameRead nq = sq as NameRead;
             if (nq == null)
             {
                 throw new Exception("Sequences were not loaded with read names!");
             }
             if (HasOverLap(nq, st, ed))
             {
                 if (retStr.Length > 1)
                 {
                     retStr += "\t" + nq.Name;
                 }
                 else
                 {
                     retStr = nq.Name;
                 }
             }
         }
         return(retStr);
     }
     else
     {
         return("");
     }
 }
Exemple #2
0
        protected void LoadBAMNameFile(string fileName)
        {
            int count = 0;

            using (StreamReader st = new StreamReader(fileName)) {
                string line = "";
                while ((int)'@' == st.Peek())
                {
                    st.ReadLine();
                }
                while ((line = st.ReadLine()) != null)
                {
                    string[] spstrs = line.Split('\t');
                    if (spstrs [2].Length > 2 && spstrs.Length >= 10)
                    {
                        int      start = int.Parse(spstrs [3]);
                        NameRead sq    = new NameRead(this, start, spstrs [9].Length + start, spstrs[0]);
                        AllBAMPairs.Add(new SeqScaffPair(spstrs [2], sq));

                        count++;
                        if (count % 1000000 == 0)
                        {
                            int tot = count / 1000000;
                            MainData.UpdateLog("Read " + tot + "M seqs from " + MainData.MainWindow.MaxLenString(fileName, 20), true);
                        }
                    }
                }
            }
            //Parallel.ForEach(lines, x =>
            //	{
            //		ProcessLines(x);
            //	});
        }