Beispiel #1
0
        protected void LoadBAMFile(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]);
                        SeqRead sq    = new SeqRead(this, start, spstrs [9].Length + start);
                        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);
            //	});
        }
Beispiel #2
0
 protected void ProcessLines(string line)
 {
     string[] spstrs = line.Split('\t');
     if (spstrs [2].Length > 2)
     {
         int     start = int.Parse(spstrs [3]);
         SeqRead sq    = new SeqRead(this, start, spstrs [9].Length + start);
         AllBAMPairs.Add(new SeqScaffPair(spstrs [2], sq));
     }
 }
Beispiel #3
0
 public bool HasOverLap(SeqRead sq)
 {
     if ((sq.Start >= Start && sq.Start <= End) || (sq.End <= End && sq.End >= Start) || (sq.Start <= Start && sq.End >= End))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #4
0
 public void AddRead(SeqRead _read)
 {
     if (Reads == null)
     {
         Reads = new List <SeqRead> ();
     }
     MainData.LoadedSeqs++;
     lock (Reads) {
         Reads.Add(_read);
     }
 }
Beispiel #5
0
 public bool HasOverLap(SeqRead sq, int st, int ed)
 {
     if ((sq.Start >= st && sq.Start <= ed) || (sq.End <= ed && sq.End >= st) || (sq.Start <= st && sq.End >= ed))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Beispiel #6
0
 public override void SendRead(SeqRead seq)
 {
     foreach (KeyValuePair <string, List <GeneElement> > kvp in Elements)
     {
         foreach (GeneElement ge in kvp.Value)
         {
             if (ge.HasOverLap(seq))
             {
                 ge.AddRead(seq);
             }
         }
     }
     base.SendRead(seq);
 }
Beispiel #7
0
 public void SendRead(SeqRead seq)
 {
     foreach (KeyValuePair <string, Gene> kvp in Genes)
     {
         if (kvp.Value.HasOverLap(seq))
         {
             kvp.Value.SendRead(seq);
         }
     }
     foreach (KeyValuePair <string, Region> kvp in Regions)
     {
         if (kvp.Value.HasOverLap(seq))
         {
             kvp.Value.SendRead(seq);
         }
     }
 }
Beispiel #8
0
        public virtual void SendRead(SeqRead seq)
        {
            AddRead(seq);

            if (RegElements != null)
            {
                foreach (KeyValuePair <string, List <MiscElement> > kvp in RegElements)
                {
                    foreach (MiscElement ge in kvp.Value)
                    {
                        if (ge.HasOverLap(seq))
                        {
                            ge.AddRead(seq);
                        }
                    }
                }
            }
        }
Beispiel #9
0
 public SeqScaffPair(string scf, SeqRead sq)
 {
     Scaffold = scf;
     Read     = sq;
 }