public static bool HasInternalSoftclip(this CigarAlignment cigar) { var subCigar = cigar.GetSubCigar(cigar.GetPrefixClip() > 0 ? 1 : 0, cigar.Count - (cigar.GetSuffixClip() > 0 ? 1 : 0)); foreach (CigarOp op in subCigar) { if (op.Type == 'S') { return(true); } } return(false); }
public void GetSubCigar() { var cigar = new CigarAlignment("2S3M1D1M"); var subCigar = cigar.GetSubCigar(0, cigar.Count - 1); Assert.Equal("2S3M1D", subCigar.ToString()); subCigar = cigar.GetSubCigar(0, cigar.Count); Assert.Equal("2S3M1D1M", subCigar.ToString()); subCigar = cigar.GetSubCigar(1, cigar.Count); Assert.Equal("3M1D1M", subCigar.ToString()); subCigar = cigar.GetSubCigar(1, cigar.Count - 1); Assert.Equal("3M1D", subCigar.ToString()); subCigar = cigar.GetSubCigar(2, 2); Assert.Equal("", subCigar.ToString()); Assert.Throws <ArgumentException>(() => cigar.GetSubCigar(3, 2)); }
public static CigarAlignment GetCigarWithoutProbeClips(this CigarAlignment cigar, bool isRead1) { return(isRead1 ? cigar.GetSubCigar(cigar.GetPrefixClip() > 0 ? 1 : 0, cigar.Count) : cigar.GetSubCigar(0, cigar.Count - (cigar.GetSuffixClip() > 0 ? 1 : 0))); }