clj-hgvs.core

Main functions for handling HGVS. See http://varnomen.hgvs.org/ for the
detail HGVS nomenclature.

==

(== hgvs)(== hgvs1 hgvs2)(== hgvs1 hgvs2 & more)
Returns true if hgvs1 is equivalent to hgvs2, false otherwise.

This function compares the fundamental equivalence of the given HGVS, ignoring
the difference of the transcript version, the short/long amino acid style, and
the description of the same mutation.

data-readers

Tagged literal support if loader does not find "data_readers.clj".

format

(format hgvs)(format hgvs opts)
Returns a HGVS string representing the given HGVS map.

The second argument is an optional map to specify style:

  {:show-bases?        Display additional bases, e.g. g.6_8delTGC, default
                       false.

   :ins-format         Bases style of insertion, default :auto.
                       <:auto|:bases|:count>

   :range-format       Range style, default :auto. <:auto|:bases|:coord>

   :amino-acid-format  Amino acid style of protein HGVS, default :long.
                       <:long|:short>

   :show-ter-site?     Display a new ter codon site of protein frame shift,
                       default false.

   :ter-format         Ter codon style of protein frame shift and extension,
                       default :long. <:long|:short>}

hgvs

(hgvs transcript kind mutation)
Creates HGVS data represented as a record.

transcript is nilable for conventional reasons, but you should supply it if
possible.

kind must be one of :genome, :mitochondria, :coding-dna, :non-coding-dna,
:circular-dna, :rna, and :protein.

mutation must be a clj-hgvs.mutation record or string. The string mutation
will be parsed by clj-hgvs.mutation/parse.

normalize

(normalize s)
Reformats the HGVS string s, returning the normalized HGVS string.

The default style will be used for reformatting. See clj-hgvs.core/format
document for further details of the style options.

parse

(parse s)
Parses a HGVS string s, returning a map representing the HGVS.

plain

(plain hgvs)
Returns a plain map representing the given HGVS. This function is useful for
sending data through another codec. Use clj-hgvs.core/restore to retrieve
original HGVS data.

repair-hgvs-str

(repair-hgvs-str s)(repair-hgvs-str s repairers)
Attempts to repair an invalid HGVS string, returning a correct HGVS string.

The repair rules are based on frequent mistakes in popular public-domain
databases such as dbSNP and ClinVar. See clj-hgvs.repairer/built-in-repairers
for details of the built-in repair rules.

You may supply custom repair rules to the second argument:

  (defn lower-case-ext
    [s kind]
    (if (= kind :protein)
      (clojure.string/replace s #"EXT" "ext")
      s))

  (def my-repairers (conj clj-hgvs.repairer/built-in-repairers
                          lower-case-ext))

  (repair-hgvs-str "p.*833EXT*?" my-repairers)
  => "p.*833ext*?"

restore

(restore m)
Restores a plain map to a suitable HGVS data structure. This function is
useful for sending data through another codec.

with-validation-disabled

macro

(with-validation-disabled & body)
Disables validation within a scope.

HGVS data are checked upon interpretation phases by default, but in the scope,
all validations will be skipped. This macro may improve the performance on
handling HGVS which validity is already known.