public void TestMergeExon1() { var item = new MatchedBedItem(); MatchExon e1 = new MatchExon(); e1.TranscriptId = "E1"; e1.Add(new Location(1, 10)); e1.Add(new Location(30, 40)); MatchExon e2 = new MatchExon(); e2.TranscriptId = "E2"; e2.Add(new Location(1, 10)); e2.Add(new Location(30, 40)); MatchExon e3 = new MatchExon(); e3.TranscriptId = "E3"; e3.Add(new Location(30, 39)); item.Exons.Add(e1); item.Exons.Add(e2); item.Exons.Add(e3); Assert.AreEqual(3, item.Exons.Count); item.MergeExon(); Assert.AreEqual(1, item.Exons.Count); Assert.AreEqual("E1;E2", item.Exons[0].TranscriptId); }
public string GetValue(MatchedBedItem item) { StringBuilder sb = new StringBuilder(); bool bFirst = true; foreach (var exon in item.Exons) { if (bFirst) { sb.Append(string.Format("{0}\t{1}", bedFile.GetValue(item), item.Exons.Count)); } else { sb.Append(string.Format("{0}\t{1}", missHeader, item.Exons.Count)); } sb.AppendLine(string.Format("\t{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", exon.TranscriptId, exon.TranscriptType, exon.TranscriptCount, exon.RetainedIntron ? 1 : 0, exon.IntronSize, exon.Count, string.Join(";", exon.ConvertAll(m => string.Format("{0}-{1}", m.Start, m.End))))); } return(sb.ToString()); }
public MatchedBedItem Next() { string line = ""; while ((line = reader.ReadLine()) != null) { if (line.Length > 0 && line[0] != '\t') { var parts = line.Split('\t'); if (parts.Length < 14) { continue; } long chromstart; if (!long.TryParse(parts[1], out chromstart)) { continue; } var result = new MatchedBedItem(); result.Seqname = parts[0]; result.Start = chromstart; result.End = long.Parse(parts[2]); result.Name = parts[3]; result.Score = double.Parse(parts[4]); result.Strand = parts[5][0]; result.Exons.Add(ParseMatchExon(parts)); int c; while ((c = reader.Peek()) != -1) { if (c != '\t') { break; } line = reader.ReadLine(); parts = line.Split('\t'); result.Exons.Add(ParseMatchExon(parts)); } return(result); } } return(null); }
public MatchedBedItem Next() { string line = ""; while ((line = reader.ReadLine()) != null) { if (line.Length > 0 && line[0] != '\t') { var parts = line.Split('\t'); if (parts.Length < 14) { continue; } long chromstart; if (!long.TryParse(parts[1], out chromstart)) { continue; } var result = new MatchedBedItem(); result.Seqname = parts[0]; result.Start = chromstart; result.End = long.Parse(parts[2]); result.Name = parts[3]; result.Score = double.Parse(parts[4]); result.Strand = parts[5][0]; result.Exons.Add(ParseMatchExon(parts)); int c; while ((c = reader.Peek()) != -1) { if (c != '\t') { break; } line = reader.ReadLine(); parts = line.Split('\t'); result.Exons.Add(ParseMatchExon(parts)); } return result; } } return null; }
public string GetValue(MatchedBedItem item) { StringBuilder sb = new StringBuilder(); bool bFirst = true; foreach (var exon in item.Exons) { if (bFirst) { sb.Append(string.Format("{0}\t{1}", bedFile.GetValue(item), item.Exons.Count)); } else { sb.Append(string.Format("{0}\t{1}", missHeader, item.Exons.Count)); } sb.AppendLine(string.Format("\t{0}\t{1}\t{2}\t{3}\t{4}\t{5}\t{6}", exon.TranscriptId, exon.TranscriptType, exon.TranscriptCount, exon.RetainedIntron ? 1 : 0, exon.IntronSize, exon.Count, string.Join(";", exon.ConvertAll(m => string.Format("{0}-{1}", m.Start, m.End))))); } return sb.ToString(); }