Skip to content

Main content

SAM Optional Field Type Token

Split a SAM optional field lexical TAG:TYPE:VALUE token without validating the type-specific value payload.

Loading tool…

Description

Split a supplied SAM-style optional-field token into tag, type and value text.

Sequence formats distinguish coordinate origins, included endpoints, allele separators and identifier grammars. A genomic interbase position differs from a base number, and a parsed optional-field value may still violate its declared type. Local token checks preserve representation without validating a complete file, sequence, reference assembly or biological interpretation.

Split a supplied SAM-style optional-field token into tag, type and value text.

When to use this tool

Use SAM Optional Field Type Token when you already have fieldToken and need to split a supplied SAM-style optional-field token into tag, type and value text.

How to use the tool and how it works

  1. Enter fieldToken. 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 tag, typeCode, valueText. Use the output convention below.

Require a two-character ASCII tag beginning with a letter, then a letter or digit; require : and one of A,i,f,Z,H,B and another :. Reject tab/CR/LF in the remaining value, then return the three parts.1

An optional SAM field combines a tag, type and value. Complete conformance also requires the value to satisfy that type; splitting the token does not perform those checks.2

Input fieldMeaning and unitsAccepted input
fieldTokenField TokenRequired. Text; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
tagTagRequired. Text; maximum UTF-16 length 8192.
typeCodeType CodeRequired. Text; maximum UTF-16 length 8192.
valueTextUnparsed suffix after TAG:TYPE:; can be empty and is not validated against typeCode.Required. Text; maximum UTF-16 length 8192.
json
{
  "input": {
    "fieldToken": "NM:i:3"
  },
  "output": {
    "tag": "NM",
    "typeCode": "i",
    "valueText": "3"
  }
}

Limitations and assumptions

  • The value can be empty and is not parsed according to its type. This is a lexical subset check, not validation of a complete SAM record, array subtype, numeric range or reference alignment.
  • 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 the complete applicable file specification and a full format validator for conformance. Verify reference assembly, sequence bounds, annotation and database context before interpreting local fields or coordinate transformations.

References

  1. Calculation and input contract: bioinformatics/sam-optional-field-type-token — tool.io

  2. Sequence Alignment/Map Format Specification, SAM 1.6 — SAM/BAM Format Specification Working Group

Similar or alternative tools