/// <summary> /// Find the last position before 'pos' within an exon /// </summary> /// <param name="pos"></param> /// <returns></returns> private long LastExonPositionBefore(long pos) { long last = -1; foreach (Exon ex in Exons.OrderBy(x => x.OneBasedStart)) { if (pos < ex.OneBasedStart) { // Nothing found? if (last < 0) { Console.WriteLine("WARNING: Cannot find last exonic position before " + pos + " for transcript '" + ID + "'"); return(-1); } return(last); } else if (pos <= ex.OneBasedEnd) { return(pos); } last = ex.OneBasedEnd; } if (last < 0) { Console.WriteLine("WARNING: Cannot find last exonic position before " + pos + " for transcript '" + ID + "'"); } return(pos); }
/// <summary> /// Find the first position after 'pos' within an exon /// </summary> /// <param name="pos"></param> /// <returns></returns> private long FirstExonPositionAfter(long pos) { foreach (Exon ex in Exons.OrderBy(x => x.OneBasedStart)) { if (pos <= ex.OneBasedStart) { return(ex.OneBasedStart); } if (pos <= ex.OneBasedEnd) { return(pos); } } Console.WriteLine("WARNING: Cannot find first exonic position after " + pos + " for transcript '" + ID + "'"); return(-1); }