Skip to content

Main content

CIGAR Reference Consumption Gap Tool

Count SAM reference-consuming operations and compare an explicit span; alignment placement constraints are outside this operation counter.

Loading tool…

Description

Return exact reference-consumed CIGAR span and discrepancy.

Sequence alignments distinguish flag bits, query/reference coordinates, CIGAR operations and scoring conventions. A single flag or length contribution does not establish a complete valid alignment; consuming reference bases differs from consuming query bases or counting a gap penalty.

Return exact reference-consumed CIGAR span and discrepancy.

When to use this tool

Use CIGAR Reference Consumption Gap when checking the stated alignment flag, operation, span or gap-scoring convention.

How to use the tool and how it works

  1. Enter cigar, suppliedReferenceSpan. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read consumedReferenceDecimal, gapDecimal. Use the output convention below.

Return exact reference-consumed CIGAR span and discrepancy. Accept supported operations with positive 1..128-digit lengths and nonnegative exact supplied span; sum M/D/N/=/X lengths with BigInt, gap = consumed-supplied.1

SAM/BAM defines separate flag, quality and CIGAR conventions. This local operation does not validate a complete alignment record.2

Input fieldMeaning and unitsAccepted input
cigarCigarRequired. Text; maximum UTF-16 length 8192.
suppliedReferenceSpanSupplied Reference SpanRequired. Text; maximum UTF-16 length 8192. Integer syntax: optional + or - and 1-128 decimal digits; leading zeros accepted. Apply the sign restriction above.
Output fieldInterpretationReturned shape
consumedReferenceDecimalConsumed Reference DecimalRequired. Text; maximum UTF-16 length 8192.
gapDecimalExact consumed-reference span minus supplied span, serialized as signed decimal text.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "cigar": "3S6M1P1I4M",
    "suppliedReferenceSpan": "10"
  },
  "output": {
    "consumedReferenceDecimal": "10",
    "gapDecimal": "0"
  }
}

Limitations and assumptions

  • This checks only reference consumption, not clipping placement, query span, reference bounds or a complete SAM/BAM record.
  • Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a complete SAM/BAM and reference-aware validator or alignment method with explicit clipping, coordinate and scoring policies for full processing.

References

  1. Calculation and input contract: bioinformatics/cigar-reference-consumption-gap — tool.io

  2. SAM/BAM format specification, version 1.6 — SAM/BAM Format Specification Working Group

Similar or alternative tools