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); // }); }
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)); } }
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); } }
public void AddRead(SeqRead _read) { if (Reads == null) { Reads = new List <SeqRead> (); } MainData.LoadedSeqs++; lock (Reads) { Reads.Add(_read); } }
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); } }
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); }
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); } } }
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); } } } } }
public SeqScaffPair(string scf, SeqRead sq) { Scaffold = scf; Read = sq; }