This is the cl-sam Reference Manual, version 0.16.0, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Dec 15 05:20:49 2024 GMT+0.
cl-sam/cl-sam.asd
cl-sam/cl-sam/package.lisp
cl-sam/cl-sam/conditions.lisp
cl-sam/cl-sam/bgzf.lisp
cl-sam/cl-sam/bgzf-reader.lisp
cl-sam/cl-sam/bgzf-writer.lisp
cl-sam/cl-sam/bgzip-stream.lisp
cl-sam/cl-sam/sam.lisp
cl-sam/cl-sam/bam.lisp
cl-sam/cl-sam/bam-index.lisp
cl-sam/cl-sam/bam-index-reader.lisp
cl-sam/cl-sam/bam-index-writer.lisp
cl-sam/cl-sam/bam-indexer.lisp
cl-sam/cl-sam/bam-reader.lisp
cl-sam/cl-sam/bam-writer.lisp
cl-sam/cl-sam/sam-writer.lisp
cl-sam/cl-sam/external-bam-sort.lisp
cl-sam/cl-sam/bam-utilities.lisp
cl-sam/cl-sam/cl-sam.lisp
The main system appears first, followed by any subsystem dependency.
cl-sam
Toolkit for manipulation of DNA sequence alignment data stored in the Sequence Alignment/Map (SAM) format.
Keith James
GPL v3
0.16.0
deoxybyte-systems
(system)., at least version "1.0.0"
deoxybyte-gzip
(system)., at least version "0.6.0"
deoxybyte-unix
(system)., at least version "0.8.0"
cl-sam
(module).
Modules are listed depth-first from the system components tree.
cl-sam/cl-sam
cl-sam
(system).
package.lisp
(file).
conditions.lisp
(file).
bgzf.lisp
(file).
bgzf-reader.lisp
(file).
bgzf-writer.lisp
(file).
bgzip-stream.lisp
(file).
sam.lisp
(file).
bam.lisp
(file).
bam-index.lisp
(file).
bam-index-reader.lisp
(file).
bam-index-writer.lisp
(file).
bam-indexer.lisp
(file).
bam-reader.lisp
(file).
bam-writer.lisp
(file).
sam-writer.lisp
(file).
external-bam-sort.lisp
(file).
bam-utilities.lisp
(file).
cl-sam.lisp
(file).
Files are sorted by type and then listed depth-first from the systems components trees.
cl-sam/cl-sam.asd
cl-sam/cl-sam/package.lisp
cl-sam/cl-sam/conditions.lisp
cl-sam/cl-sam/bgzf.lisp
cl-sam/cl-sam/bgzf-reader.lisp
cl-sam/cl-sam/bgzf-writer.lisp
cl-sam/cl-sam/bgzip-stream.lisp
cl-sam/cl-sam/sam.lisp
cl-sam/cl-sam/bam.lisp
cl-sam/cl-sam/bam-index.lisp
cl-sam/cl-sam/bam-index-reader.lisp
cl-sam/cl-sam/bam-index-writer.lisp
cl-sam/cl-sam/bam-indexer.lisp
cl-sam/cl-sam/bam-reader.lisp
cl-sam/cl-sam/bam-writer.lisp
cl-sam/cl-sam/sam-writer.lisp
cl-sam/cl-sam/external-bam-sort.lisp
cl-sam/cl-sam/bam-utilities.lisp
cl-sam/cl-sam/cl-sam.lisp
cl-sam/cl-sam/conditions.lisp
package.lisp
(file).
cl-sam
(module).
bam-error
(condition).
bam-sort-error
(condition).
bgzf-io-error
(condition).
bgzf-of
(reader method).
errno-of
(reader method).
position-of
(reader method).
prev-position-of
(reader method).
prev-reference-of
(reader method).
reference-of
(reader method).
cl-sam/cl-sam/bgzf.lisp
conditions.lisp
(file).
cl-sam
(module).
bgzf
(structure).
bgzf-close
(function).
bgzf-eof-p
(function).
bgzf-open
(function).
bgzf-open-p
(function).
bgzf-seek
(function).
bgzf-tell
(function).
with-bgzf
(macro).
*default-compression*
(special variable).
*empty-bgz-record*
(special variable).
+bgz-max-payload-length+
(constant).
+member-footer-length+
(constant).
+member-header-length+
(constant).
+sf1+
(constant).
+sf2+
(constant).
+slen+
(constant).
+xlen+
(constant).
bgz-member
(structure).
bgz-member-bsize
(reader).
(setf bgz-member-bsize)
(writer).
bgz-member-cdata
(function).
(setf bgz-member-cdata)
(function).
bgz-member-cend
(function).
(setf bgz-member-cend)
(function).
bgz-member-cm
(function).
bgz-member-crc32
(function).
(setf bgz-member-crc32)
(function).
bgz-member-flg
(function).
(setf bgz-member-flg)
(function).
bgz-member-id1
(function).
bgz-member-id2
(function).
bgz-member-isize
(function).
(setf bgz-member-isize)
(function).
bgz-member-mtime
(function).
(setf bgz-member-mtime)
(function).
bgz-member-os
(function).
(setf bgz-member-os)
(function).
bgz-member-p
(function).
bgz-member-sf1
(reader).
bgz-member-sf2
(reader).
bgz-member-slen
(reader).
bgz-member-udata
(reader).
(setf bgz-member-udata)
(writer).
bgz-member-xfl
(function).
(setf bgz-member-xfl)
(function).
bgz-member-xlen
(function).
(setf bgz-member-xlen)
(function).
bgzf-buffer
(reader).
(setf bgzf-buffer)
(writer).
bgzf-coffset
(function).
bgzf-compression
(reader).
(setf bgzf-compression)
(writer).
bgzf-empty-p
(function).
bgzf-eof
(reader).
(setf bgzf-eof)
(writer).
bgzf-load-seek
(reader).
(setf bgzf-load-seek)
(writer).
bgzf-loaded-p
(reader).
(setf bgzf-loaded-p)
(writer).
bgzf-offset
(reader).
(setf bgzf-offset)
(writer).
bgzf-p
(function).
bgzf-pathname
(reader).
(setf bgzf-pathname)
(writer).
bgzf-pointer
(reader).
(setf bgzf-pointer)
(writer).
bgzf-position
(reader).
(setf bgzf-position)
(writer).
bgzf-stream
(reader).
(setf bgzf-stream)
(writer).
bgzf-uoffset
(function).
bgzf-util-buffer
(reader).
(setf bgzf-util-buffer)
(writer).
copy-bgz-member
(function).
copy-bgzf
(function).
deflate-bgz-member
(function).
inflate-bgz-member
(function).
make-bgz-member
(function).
make-bgzf
(function).
cl-sam/cl-sam/bgzf-reader.lisp
bgzf.lisp
(file).
cl-sam
(module).
read-bgz-member
(function).
read-bytes
(function).
read-string
(function).
cl-sam/cl-sam/bgzf-writer.lisp
bgzf-reader.lisp
(file).
cl-sam
(module).
bgzf-flush
(function).
write-bgz-member
(function).
write-bytes
(function).
write-chunked-bytes
(function).
cl-sam/cl-sam/bgzip-stream.lisp
bgzf-writer.lisp
(file).
cl-sam
(module).
bgzip-input-stream
(class).
bgzip-open
(function).
bgzip-stream
(class).
stream-close
(method).
stream-element-type
(method).
stream-file-position
(method).
stream-read-byte
(method).
stream-read-sequence
(method).
with-open-bgzip
(macro).
%stream-read-sequence
(function).
+bgzip-buffer-size+
(constant).
bgzf-handle-mixin
(class).
bgzip-buffer
(type).
bgzip-buffer-index
(type).
buffer-empty-p
(function).
fill-buffer
(function).
cl-sam/cl-sam/sam.lisp
bgzip-stream.lisp
(file).
cl-sam
(module).
*sam-version*
(special variable).
add-pg-record
(function).
coordinate-sorted-p
(function).
ensure-mandatory-header-tags
(function).
ensure-valid-header-tags
(function).
ensure-valid-programs
(function).
hd-record
(function).
header-records
(function).
header-tags
(function).
header-type
(function).
header-value
(function).
last-programs
(function).
make-header-record
(function).
make-sam-header
(function).
merge-header-records
(function).
merge-sam-headers
(function).
name-sorted-p
(function).
pg-record
(function).
previous-programs
(function).
rg-record
(function).
sq-record
(function).
subst-group-order
(function).
subst-sam-version
(function).
subst-sort-order
(function).
valid-reference-name-p
(function).
valid-sam-version-p
(function).
*mandatory-header-tags*
(special variable).
*valid-group-orders*
(special variable).
*valid-header-tags*
(special variable).
*valid-header-types*
(special variable).
*valid-sort-orders*
(special variable).
define-header-tag-parser
(macro).
ensure-order
(function).
ensure-sam-version
(function).
ensure-unique-tag-values
(function).
find-duplicate-header-tags
(function).
find-duplicate-records
(function).
group-by-tag
(function).
header-record
(function).
mandatory-header-tags
(function).
parse-hd-tag
(function).
parse-pg-tag
(function).
parse-rg-tag
(function).
parse-sq-tag
(function).
partition-by-type
(function).
simplify-records
(function).
update-pg-records
(function).
user-header-tag-p
(function).
valid-header-tags
(function).
cl-sam/cl-sam/bam.lisp
sam.lisp
(file).
cl-sam
(module).
alignment-bin
(function).
alignment-cigar
(function).
alignment-core
(function).
alignment-core-alist
(function).
alignment-flag
(function).
alignment-flag-alist
(function).
alignment-not-primary-p
(function).
alignment-position
(function).
alignment-reference-end
(function).
alignment-tag-documentation
(generic function).
alignment-tag-values
(function).
bam-sort-error
(function).
cigar-length
(function).
copy-alignment-record
(function).
define-alignment-tag
(macro).
fails-platform-qc-p
(function).
first-in-pair-p
(function).
flag-bits
(function).
insert-length
(function).
make-alignment-record
(function).
make-reference-table
(function).
mapped-proper-pair-p
(function).
mapping-quality
(function).
mate-alignment-position
(function).
mate-forward-p
(function).
mate-mapped-p
(function).
mate-reference-id
(function).
mate-reverse-p
(function).
mate-unmapped-p
(function).
medial-frag-p
(function).
pcr/optical-duplicate-p
(function).
print-object
(method).
quality-string
(function).
query-forward-p
(function).
query-mapped-p
(function).
query-reverse-p
(function).
query-unmapped-p
(function).
read-length
(function).
read-name
(function).
read-name-length
(function).
reference-id
(function).
second-in-pair-p
(function).
seq-string
(function).
sequenced-pair-p
(function).
unknown-frag-p
(function).
valid-flag-p
(function).
valid-mapped-pair-p
(function).
valid-mapped-proper-pair-p
(function).
with-bam
(macro).
%encode-string-tag
(function).
*bam-magic*
(special variable).
*invalid-read-name-chars*
(special variable).
+alignment-size-tag+
(constant).
+null-byte+
(constant).
+tag-size+
(constant).
+unknown-position+
(constant).
+unknown-quality+
(constant).
+unknown-reference+
(constant).
alignment
(structure).
alignment-indices
(function).
alignment-p
(function).
alignment-primary-p
(function).
alignment-read-length
(function).
alignment-reference-length
(function).
alignment-tag-bytes
(function).
aln-bin
(reader).
(setf aln-bin)
(writer).
aln-cigar
(reader).
(setf aln-cigar)
(writer).
aln-flag
(reader).
(setf aln-flag)
(writer).
aln-insert-length
(reader).
(setf aln-insert-length)
(writer).
aln-map-qual
(reader).
(setf aln-map-qual)
(writer).
aln-mate-pos
(reader).
(setf aln-mate-pos)
(writer).
aln-mate-ref-id
(reader).
(setf aln-mate-ref-id)
(writer).
aln-pos
(reader).
(setf aln-pos)
(writer).
aln-qual-str
(reader).
(setf aln-qual-str)
(writer).
aln-read-name
(reader).
(setf aln-read-name)
(writer).
aln-record
(reader).
(setf aln-record)
(writer).
aln-ref-id
(reader).
(setf aln-ref-id)
(writer).
aln-ref-len
(reader).
(setf aln-ref-len)
(writer).
aln-seq-str
(reader).
(setf aln-seq-str)
(writer).
copy-alignment
(function).
decode-cigar
(function).
decode-quality-string
(function).
decode-read-name
(function).
decode-seq-string
(function).
decode-tag-values
(function).
encode-alignment-tag
(generic function).
encode-char-tag
(function).
encode-cigar
(function).
encode-float-tag
(function).
encode-hex-tag
(function).
encode-int-tag
(function).
encode-quality-string
(function).
encode-read-name
(function).
encode-seq-string
(function).
encode-string-tag
(function).
encode-unknown-quality
(function).
ensure-valid-flag
(function).
ensure-valid-read-name
(function).
ensure-valid-reference-name
(function).
flag-symbol
(function).
flag-validation-error
(function).
make-alignment
(function).
make-aln
(function).
print-aln
(function).
valid-read-name-p
(function).
cl-sam/cl-sam/bam-index.lisp
bam.lisp
(file).
cl-sam
(module).
bam-index
(structure).
bam-index-refs
(reader).
(setf bam-index-refs)
(writer).
bin
(structure).
bin-chunk
(function).
bin-chunks
(reader).
(setf bin-chunks)
(writer).
bin-num
(reader).
chunk
(structure).
chunk-end
(reader).
(setf chunk-end)
(writer).
chunk-start
(reader).
(setf chunk-start)
(writer).
empty-bin-p
(function).
find-bam-index
(function).
find-bins
(function).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
print-object
(method).
ref-index
(function).
ref-index
(structure).
ref-index-bin
(function).
ref-index-bins
(reader).
(setf ref-index-bins)
(writer).
ref-index-intervals
(reader).
(setf ref-index-intervals)
(writer).
*bam-index-file-type*
(special variable).
*bam-index-magic*
(special variable).
*tree-deepening-boundaries*
(special variable).
*voffset-merge-distance*
(special variable).
+linear-bin-size+
(constant).
+max-num-bins+
(constant).
+samtools-kludge-bin+
(constant).
adjacentp
(function).
bam-index-p
(function).
bin-p
(function).
chunk-p
(function).
copy-bam-index
(function).
copy-bin
(function).
copy-chunk
(function).
copy-ref-index
(function).
copy-region
(function).
copy-samtools-bam-index
(function).
copy-samtools-ref-index
(function).
find-interval
(function).
make-bam-chunks
(function).
make-bam-index
(function).
make-bin
(function).
make-chunk
(function).
make-ref-index
(function).
make-region
(function).
make-samtools-bam-index
(function).
make-samtools-ref-index
(function).
max-bin-num
(function).
merge-chunks
(function).
print-bin
(function).
print-chunk
(function).
print-ref-index
(function).
print-region
(function).
print-samtools-ref-index
(function).
ref-index-id
(reader).
ref-index-p
(function).
region
(function).
region
(structure).
region-end
(reader).
(setf region-end)
(writer).
region-p
(function).
region-ref
(reader).
(setf region-ref)
(writer).
region-start
(reader).
(setf region-start)
(writer).
region-to-bin
(function).
region-to-bins
(function).
region-to-interval
(function).
run-length-encode
(function).
samtools-bam-index
(structure).
samtools-bam-index-p
(function).
samtools-bam-index-refs
(function).
(setf samtools-bam-index-refs)
(function).
samtools-bam-index-unassigned
(reader).
(setf samtools-bam-index-unassigned)
(writer).
samtools-ref-index
(structure).
samtools-ref-index-bins
(function).
(setf samtools-ref-index-bins)
(function).
samtools-ref-index-end
(reader).
(setf samtools-ref-index-end)
(writer).
samtools-ref-index-id
(function).
samtools-ref-index-intervals
(function).
(setf samtools-ref-index-intervals)
(function).
samtools-ref-index-mapped
(reader).
(setf samtools-ref-index-mapped)
(writer).
samtools-ref-index-p
(function).
samtools-ref-index-start
(reader).
(setf samtools-ref-index-start)
(writer).
samtools-ref-index-unmapped
(reader).
(setf samtools-ref-index-unmapped)
(writer).
voffset-merge-p
(function).
cl-sam/cl-sam/bam-index-reader.lisp
bam-index.lisp
(file).
cl-sam
(module).
read-bam-index
(function).
with-bam-index
(macro).
read-bin
(function).
read-binning-index
(function).
read-index-magic
(function).
read-linear-index
(function).
read-ref-index
(function).
cl-sam/cl-sam/bam-index-writer.lisp
bam-index-reader.lisp
(file).
cl-sam
(module).
write-bam-index
(generic function).
%write-int32
(function).
%write-int64
(function).
write-bin
(function).
write-binning-index
(function).
write-index-magic
(function).
write-linear-index
(function).
write-ref-index
(generic function).
cl-sam/cl-sam/bam-indexer.lisp
bam-index-writer.lisp
(file).
cl-sam
(module).
index-bam-file
(function).
%make-bam-index
(function).
%make-ref-index
(function).
cl-sam/cl-sam/bam-reader.lisp
bam-indexer.lisp
(file).
cl-sam
(module).
parse-region-string
(function).
read-alignment
(function).
read-bam-header
(function).
read-bam-magic
(function).
read-bam-meta
(function).
read-bam-terminator
(function).
read-num-references
(function).
read-reference-meta
(function).
bam-meta-size
(function).
bam-meta-size2
(function).
block-sizes
(function).
ensure-valid-region
(function).
make-bam-full-scan-input
(function).
make-bam-index-input
(function).
make-bam-scan-input
(function).
make-region<
(function).
normalise-regions
(function).
partition-regions
(function).
cl-sam/cl-sam/bam-writer.lisp
bam-reader.lisp
(file).
cl-sam
(module).
make-bam-output
(function).
write-alignment
(function).
write-bam-header
(function).
write-bam-magic
(function).
write-bam-meta
(function).
write-num-references
(function).
write-reference-meta
(function).
cl-sam/cl-sam/sam-writer.lisp
bam-writer.lisp
(file).
cl-sam
(module).
write-header-record
(function).
write-sam-alignment
(function).
write-sam-header
(function).
make-header-string
(function).
write-cigar
(function).
write-quality-string
(function).
write-seq-string
(function).
write-tag-values
(function).
cl-sam/cl-sam/external-bam-sort.lisp
sam-writer.lisp
(file).
cl-sam
(module).
alignment-name<
(function).
alignment-record<
(function).
initialize-instance
(method).
make-merge-stream
(method).
sort-bam-file
(function).
stream-merge
(method).
stream-read-element
(method).
stream-write-element
(method).
%read-bam-alignment
(function).
alignment-name-natural<
(function).
bam-merge-stream
(class).
bam-sort-input-stream
(class).
bam-sort-output-stream
(class).
buffer-of
(reader method).
parse-digits
(function).
sort-bam-alignments
(function).
cl-sam/cl-sam/bam-utilities.lisp
external-bam-sort.lisp
(file).
cl-sam
(module).
alignment-generator
(function).
alignment-orphanizer
(function).
generate-bam-file
(function).
generate-reference-file
(function).
repair-mapping-flags
(function).
default-orphanizer-test
(function).
default-qual-string
(function).
default-seq-string
(function).
encode-phred-quality
(function).
cl-sam/cl-sam/cl-sam.lisp
bam-utilities.lisp
(file).
cl-sam
(module).
stream-view-sam
(function).
Packages are listed by definition order.
sam
cl-sam is a Common Lisp toolkit for manipulation of
DNA sequence alignment data stored in the Sequence Alignment/Map (SAM)
format <http://samtools.sourceforge.net>. The SAM specficiation
describes text (SAM) and binary (BAM) formats.
cl-sam uses the BGZF block compression code from the SAMtools C
toolkit, but is otherwise an independent Lisp implementation capable
of editing every aspect of BAM files or creating BAM data de novo.
The following example implements something similar to samtools
flagstat:
;;; (with-bgzf (bgzf "example.bam" :direction :input)
;;; (multiple-value-bind (header num-refs ref-meta)
;;; (read-bam-meta bgzf)
;;; (format t "BAM header: ~s~%" header)
;;; (format t "Number of references: ~d~%" num-refs)
;;; (loop
;;; for (id name length) in ref-meta
;;; do (format t "Reference name: ~s Length: ~d~%" id name length)))
;;; (loop
;;; for alignment = (read-alignment bgzf)
;;; while alignment
;;; for flag = (alignment-flag alignment)
;;; count flag into total
;;; count (fails-platform-qc-p flag) into qc-fail
;;; count (pcr/optical-duplicate-p flag) into duplicates
;;; count (not (query-unmapped-p flag)) into mapped
;;; count (sequenced-pair-p flag) into seq-paired
;;; count (first-in-pair-p flag) into read1
;;; count (second-in-pair-p flag) into read2
;;; count (mapped-proper-pair-p flag) into proper-paired
;;; count (and (not (query-unmapped-p flag))
;;; (not (mate-unmapped-p flag))) into both-mapped
;;; count (mate-unmapped-p flag) into singletons
;;; finally (format t (str "~d in total~%"
;;; "~d QC failure~%"
;;; "~d duplicates~%"
;;; "~d mapped (~$%)~%"
;;; "~d paired in sequencing~%"
;;; "~d read1~%"
;;; "~d read2~%"
;;; "~d properly paired (~$%)~%"
;;; "~d both mapped~%"
;;; "~d singletons (~$%)~%")
;;; total qc-fail duplicates mapped
;;; (* 100 (/ mapped total))
;;; seq-paired read1 read2 proper-paired
;;; (* 100 (/ proper-paired total))
;;; both-mapped singletons
;;; (* 100 (/ singletons total)))))
cffi
.
common-lisp
.
uk.co.deoxybyte-io
.
uk.co.deoxybyte-utilities
.
*sam-version*
(special variable).
add-pg-record
(function).
alignment-bin
(function).
alignment-cigar
(function).
alignment-core
(function).
alignment-core-alist
(function).
alignment-flag
(function).
alignment-flag-alist
(function).
alignment-generator
(function).
alignment-name<
(function).
alignment-not-primary-p
(function).
alignment-orphanizer
(function).
alignment-position
(function).
alignment-record<
(function).
alignment-reference-end
(function).
alignment-tag-documentation
(generic function).
alignment-tag-values
(function).
bam-error
(condition).
bam-index
(structure).
bam-index-refs
(reader).
(setf bam-index-refs)
(writer).
bam-sort-error
(function).
bam-sort-error
(condition).
bgzf
(structure).
bgzf-close
(function).
bgzf-eof-p
(function).
bgzf-io-error
(condition).
bgzf-open
(function).
bgzf-open-p
(function).
bgzf-seek
(function).
bgzf-tell
(function).
bgzip-input-stream
(class).
bgzip-open
(function).
bgzip-stream
(class).
bin
(structure).
bin-chunk
(function).
bin-chunks
(reader).
(setf bin-chunks)
(writer).
bin-num
(reader).
chunk
(structure).
chunk-end
(reader).
(setf chunk-end)
(writer).
chunk-start
(reader).
(setf chunk-start)
(writer).
cigar-length
(function).
coordinate-sorted-p
(function).
copy-alignment-record
(function).
define-alignment-tag
(macro).
empty-bin-p
(function).
ensure-mandatory-header-tags
(function).
ensure-valid-header-tags
(function).
ensure-valid-programs
(function).
fails-platform-qc-p
(function).
find-bam-index
(function).
find-bins
(function).
first-frag-p
(function).
first-in-pair-p
(function).
flag-bits
(function).
flagstat
(function).
frag-forward-p
(function).
frag-mapped-p
(function).
frag-reverse-p
(function).
frag-unmapped-p
(function).
generate-bam-file
(function).
generate-reference-file
(function).
hd-record
(function).
header-records
(function).
header-tags
(function).
header-type
(function).
header-value
(function).
index-bam-file
(function).
insert-length
(function).
last-frag-p
(function).
last-programs
(function).
make-alignment-record
(function).
make-bam-output
(function).
make-header-record
(function).
make-reference-table
(function).
make-sam-header
(function).
mapped-proper-pair-p
(function).
mapping-quality
(function).
mate-alignment-position
(function).
mate-forward-p
(function).
mate-mapped-p
(function).
mate-reference-id
(function).
mate-reverse-p
(function).
mate-unmapped-p
(function).
medial-frag-p
(function).
merge-header-records
(function).
merge-sam-headers
(function).
multiple-frags-p
(function).
name-sorted-p
(function).
next-reverse-p
(function).
next-unmapped-p
(function).
parse-region-string
(function).
pcr/optical-duplicate-p
(function).
pg-record
(function).
previous-programs
(function).
proper-aligned-frags-p
(function).
quality-string
(function).
query-forward-p
(function).
query-mapped-p
(function).
query-reverse-p
(function).
query-unmapped-p
(function).
read-alignment
(function).
read-bam-header
(function).
read-bam-index
(function).
read-bam-magic
(function).
read-bam-meta
(function).
read-bam-terminator
(function).
read-length
(function).
read-name
(function).
read-name-length
(function).
read-num-references
(function).
read-reference-meta
(function).
ref-index
(function).
ref-index
(structure).
ref-index-bin
(function).
ref-index-bins
(reader).
(setf ref-index-bins)
(writer).
ref-index-intervals
(reader).
(setf ref-index-intervals)
(writer).
reference-id
(function).
repair-mapping-flags
(function).
rg-record
(function).
second-in-pair-p
(function).
seq-string
(function).
sequenced-pair-p
(function).
sort-bam-file
(function).
sq-record
(function).
subst-group-order
(function).
subst-sam-version
(function).
subst-sort-order
(function).
unknown-frag-p
(function).
valid-flag-p
(function).
valid-mapped-pair-p
(function).
valid-mapped-proper-pair-p
(function).
valid-reference-name-p
(function).
valid-sam-version-p
(function).
view-sam
(function).
with-bam
(macro).
with-bam-index
(macro).
with-bgzf
(macro).
with-open-bgzip
(macro).
write-alignment
(function).
write-bam-header
(function).
write-bam-index
(generic function).
write-bam-magic
(function).
write-bam-meta
(function).
write-header-record
(function).
write-num-references
(function).
write-reference-meta
(function).
write-sam-alignment
(function).
write-sam-header
(function).
%encode-string-tag
(function).
%make-bam-index
(function).
%make-ref-index
(function).
%read-bam-alignment
(function).
%stream-read-sequence
(function).
%write-int32
(function).
%write-int64
(function).
*bam-index-file-type*
(special variable).
*bam-index-magic*
(special variable).
*bam-magic*
(special variable).
*default-compression*
(special variable).
*empty-bgz-record*
(special variable).
*invalid-read-name-chars*
(special variable).
*mandatory-header-tags*
(special variable).
*tree-deepening-boundaries*
(special variable).
*valid-group-orders*
(special variable).
*valid-header-tags*
(special variable).
*valid-header-types*
(special variable).
*valid-sort-orders*
(special variable).
*voffset-merge-distance*
(special variable).
+alignment-size-tag+
(constant).
+bgz-max-payload-length+
(constant).
+bgzip-buffer-size+
(constant).
+linear-bin-size+
(constant).
+max-num-bins+
(constant).
+member-footer-length+
(constant).
+member-header-length+
(constant).
+null-byte+
(constant).
+samtools-kludge-bin+
(constant).
+sf1+
(constant).
+sf2+
(constant).
+slen+
(constant).
+tag-size+
(constant).
+unknown-position+
(constant).
+unknown-quality+
(constant).
+unknown-reference+
(constant).
+xlen+
(constant).
adjacentp
(function).
alignment
(structure).
alignment-indices
(function).
alignment-name-natural<
(function).
alignment-p
(function).
alignment-primary-p
(function).
alignment-read-length
(function).
alignment-reference-length
(function).
alignment-tag-bytes
(function).
aln-bin
(reader).
(setf aln-bin)
(writer).
aln-cigar
(reader).
(setf aln-cigar)
(writer).
aln-flag
(reader).
(setf aln-flag)
(writer).
aln-insert-length
(reader).
(setf aln-insert-length)
(writer).
aln-map-qual
(reader).
(setf aln-map-qual)
(writer).
aln-mate-pos
(reader).
(setf aln-mate-pos)
(writer).
aln-mate-ref-id
(reader).
(setf aln-mate-ref-id)
(writer).
aln-pos
(reader).
(setf aln-pos)
(writer).
aln-qual-str
(reader).
(setf aln-qual-str)
(writer).
aln-read-name
(reader).
(setf aln-read-name)
(writer).
aln-record
(reader).
(setf aln-record)
(writer).
aln-ref-id
(reader).
(setf aln-ref-id)
(writer).
aln-ref-len
(reader).
(setf aln-ref-len)
(writer).
aln-seq-str
(reader).
(setf aln-seq-str)
(writer).
bam-index-p
(function).
bam-merge-stream
(class).
bam-meta-size
(function).
bam-meta-size2
(function).
bam-sort-input-stream
(class).
bam-sort-output-stream
(class).
bgz-member
(structure).
bgz-member-bsize
(reader).
(setf bgz-member-bsize)
(writer).
bgz-member-cdata
(function).
(setf bgz-member-cdata)
(function).
bgz-member-cend
(function).
(setf bgz-member-cend)
(function).
bgz-member-cm
(function).
bgz-member-crc32
(function).
(setf bgz-member-crc32)
(function).
bgz-member-flg
(function).
(setf bgz-member-flg)
(function).
bgz-member-id1
(function).
bgz-member-id2
(function).
bgz-member-isize
(function).
(setf bgz-member-isize)
(function).
bgz-member-mtime
(function).
(setf bgz-member-mtime)
(function).
bgz-member-os
(function).
(setf bgz-member-os)
(function).
bgz-member-p
(function).
bgz-member-sf1
(reader).
bgz-member-sf2
(reader).
bgz-member-slen
(reader).
bgz-member-udata
(reader).
(setf bgz-member-udata)
(writer).
bgz-member-xfl
(function).
(setf bgz-member-xfl)
(function).
bgz-member-xlen
(function).
(setf bgz-member-xlen)
(function).
bgzf-buffer
(reader).
(setf bgzf-buffer)
(writer).
bgzf-coffset
(function).
bgzf-compression
(reader).
(setf bgzf-compression)
(writer).
bgzf-empty-p
(function).
bgzf-eof
(reader).
(setf bgzf-eof)
(writer).
bgzf-flush
(function).
bgzf-handle-mixin
(class).
bgzf-load-seek
(reader).
(setf bgzf-load-seek)
(writer).
bgzf-loaded-p
(reader).
(setf bgzf-loaded-p)
(writer).
bgzf-of
(generic reader).
bgzf-offset
(reader).
(setf bgzf-offset)
(writer).
bgzf-p
(function).
bgzf-pathname
(reader).
(setf bgzf-pathname)
(writer).
bgzf-pointer
(reader).
(setf bgzf-pointer)
(writer).
bgzf-position
(reader).
(setf bgzf-position)
(writer).
bgzf-stream
(reader).
(setf bgzf-stream)
(writer).
bgzf-uoffset
(function).
bgzf-util-buffer
(reader).
(setf bgzf-util-buffer)
(writer).
bgzip-buffer
(type).
bgzip-buffer-index
(type).
bin-p
(function).
block-sizes
(function).
buffer-empty-p
(function).
buffer-of
(generic reader).
chunk-p
(function).
copy-alignment
(function).
copy-bam-index
(function).
copy-bgz-member
(function).
copy-bgzf
(function).
copy-bin
(function).
copy-chunk
(function).
copy-ref-index
(function).
copy-region
(function).
copy-samtools-bam-index
(function).
copy-samtools-ref-index
(function).
decode-cigar
(function).
decode-quality-string
(function).
decode-read-name
(function).
decode-seq-string
(function).
decode-tag-values
(function).
default-orphanizer-test
(function).
default-qual-string
(function).
default-seq-string
(function).
define-header-tag-parser
(macro).
deflate-bgz-member
(function).
encode-alignment-tag
(generic function).
encode-char-tag
(function).
encode-cigar
(function).
encode-float-tag
(function).
encode-hex-tag
(function).
encode-int-tag
(function).
encode-phred-quality
(function).
encode-quality-string
(function).
encode-read-name
(function).
encode-seq-string
(function).
encode-string-tag
(function).
encode-unknown-quality
(function).
ensure-order
(function).
ensure-sam-version
(function).
ensure-unique-tag-values
(function).
ensure-valid-flag
(function).
ensure-valid-read-name
(function).
ensure-valid-reference-name
(function).
ensure-valid-region
(function).
errno-of
(generic reader).
fill-buffer
(function).
find-duplicate-header-tags
(function).
find-duplicate-records
(function).
find-interval
(function).
flag-symbol
(function).
flag-validation-error
(function).
group-by-tag
(function).
header-record
(function).
inflate-bgz-member
(function).
make-alignment
(function).
make-aln
(function).
make-bam-chunks
(function).
make-bam-full-scan-input
(function).
make-bam-index
(function).
make-bam-index-input
(function).
make-bam-scan-input
(function).
make-bgz-member
(function).
make-bgzf
(function).
make-bin
(function).
make-chunk
(function).
make-header-string
(function).
make-ref-index
(function).
make-region
(function).
make-region<
(function).
make-samtools-bam-index
(function).
make-samtools-ref-index
(function).
mandatory-header-tags
(function).
max-bin-num
(function).
merge-chunks
(function).
next-forward-p
(function).
next-mapped-p
(function).
normalise-regions
(function).
parse-digits
(function).
parse-hd-tag
(function).
parse-pg-tag
(function).
parse-rg-tag
(function).
parse-sq-tag
(function).
partition-by-type
(function).
partition-regions
(function).
position-of
(generic reader).
prev-position-of
(generic reader).
prev-reference-of
(generic reader).
print-aln
(function).
print-bin
(function).
print-chunk
(function).
print-ref-index
(function).
print-region
(function).
print-samtools-ref-index
(function).
read-bgz-member
(function).
read-bin
(function).
read-binning-index
(function).
read-bytes
(function).
read-index-magic
(function).
read-linear-index
(function).
read-ref-index
(function).
read-string
(function).
ref-index-id
(reader).
ref-index-p
(function).
reference-of
(generic reader).
region
(function).
region
(structure).
region-end
(reader).
(setf region-end)
(writer).
region-p
(function).
region-ref
(reader).
(setf region-ref)
(writer).
region-start
(reader).
(setf region-start)
(writer).
region-to-bin
(function).
region-to-bins
(function).
region-to-interval
(function).
run-length-encode
(function).
samtools-bam-index
(structure).
samtools-bam-index-p
(function).
samtools-bam-index-refs
(function).
(setf samtools-bam-index-refs)
(function).
samtools-bam-index-unassigned
(reader).
(setf samtools-bam-index-unassigned)
(writer).
samtools-ref-index
(structure).
samtools-ref-index-bins
(function).
(setf samtools-ref-index-bins)
(function).
samtools-ref-index-end
(reader).
(setf samtools-ref-index-end)
(writer).
samtools-ref-index-id
(function).
samtools-ref-index-intervals
(function).
(setf samtools-ref-index-intervals)
(function).
samtools-ref-index-mapped
(reader).
(setf samtools-ref-index-mapped)
(writer).
samtools-ref-index-p
(function).
samtools-ref-index-start
(reader).
(setf samtools-ref-index-start)
(writer).
samtools-ref-index-unmapped
(reader).
(setf samtools-ref-index-unmapped)
(writer).
simplify-records
(function).
sort-bam-alignments
(function).
stream-view-sam
(function).
update-pg-records
(function).
user-header-tag-p
(function).
valid-header-tags
(function).
valid-read-name-p
(function).
voffset-merge-p
(function).
write-bgz-member
(function).
write-bin
(function).
write-binning-index
(function).
write-bytes
(function).
write-chunked-bytes
(function).
write-cigar
(function).
write-index-magic
(function).
write-linear-index
(function).
write-quality-string
(function).
write-ref-index
(generic function).
write-seq-string
(function).
write-tag-values
(function).
Definitions are sorted by export status, category, package, and then by lexicographic order.
Defines a new alignment tag to hold a datum of a particular SAM
type.
Arguments:
- tag (symbol): The tag e.g. :rg
- value-type (symbol): The value type, one of :char , :string , :hex
:int32 or :float .
Optional:
- docstring (string): Documentation for the tag.
Evaluates BODY with VAR bound to a new BAM generator function on
pathname designator FILESPEC. The direction (:input versus :output) is
determined by the stream-opening arguments in ARGS. The standard
generator interface functions NEXT and HAS-MORE-P may be used in
operations on the returned generator.
On reading, HEADER, NUM-REFS and REF-META will be automatically bound
to the BAM file metadata i.e. the metadata are read automatically and
the iterator positioned before the first alignment record.
Optionally, iteration may be restricted to a specific reference,
designated by REF-NUM and to alignments that start between reference
positions START and END. Furthermore, a BAM-INDEX object INDEX may be
provided to allow the stream to seek directly to the desired region of
the file.
On writing, HEADER, NUM-REFS and REF-META should be bound to
appropriate values for the BAM file metadata, which will be
automatically written to the underlying stream.
The COMPRESS-HEADER and PAD-HEADER keyword arguments are only
applicable on writing where they control whether the records and
header block should be compressed and whether the header string should
be padded with nulls to allow space for expansion. Writing an
uncompressed, padded header means that a header that fits in the first
BGZF block may be updated without re-writing the entire BAM file. The
BGZF COMPRESSION keyword is also accepted, permitting the Zlib
compression level to be set for the stream.
A list REGIONS may be supplied to limit the returned alignments to
specific references and reference coordinates. REGIONS may be region
objects or region designators in the form of list tuples
;;; (<reference designator> start end)
where a reference designator is either the reference name string or
its identifier number in the BAM file. REGIONS will be normalised
automatically by sorting according to reference position in the BAM
file (according to the BAM metadata) and then by start and
end. Overlapping regions will be merged.
For example:
To count all records in a BAM file:
;;; (with-bam (in () "in.bam")
;;; (loop
;;; while (has-more-p in)
;;; count (next in)))
To copy only records with a mapping quality of >= 30 to another BAM
file:
;;; (with-bam (in (header n ref-meta) "in.bam")
;;; (with-bam (out (header n rer-meta) "out.bam" :direction :output)
;;; (let ((q30 (discarding-if (lambda (x)
;;; (< (mapping-quality x) 30)) in)))
;;; (loop
;;; while (has-more-p q30)
;;; do (consume out (next q30))))))
To count records with mapping quality of >= 30 in a set of genomic
ranges, using an index:
;;; (with-bam-index (index "index.bai")
;;; (with-bam (bam () bam-file :index index
;;; :regions ’((0 1000000 1100000) (1 1000000 1100000)))
;;; (loop
;;; while (has-more-p bam)
;;; count (>= (mapping-quality (next bam)) 30))))
Evaluates BODY with VAR bound to a BAM-INDEX read from file denoted by pathname designator FILESPEC.
sam
.
Executes BODY with VAR bound to a BGZF handle structure created by
opening the file denoted by FILESPEC.
Arguments:
- var (symbol): The symbol to be bound.
- filespec (pathname designator): The file to open.
Rest:
- args: Arguments applicable to bgzf-open.
Returns a copy of HEADER with PG record NEW-RECORD added. If the ID of NEW-RECORD clashes with existing IDs, all IDs are remapped to new, generated sequential integer IDs, starting at 0. PP links are also updated. NEW-RECORD must have its PP field set by the caller.
Returns an integer that indicates the alignment bin to which ALN has been assigned.
Returns the CIGAR record list of the alignment described by
ALN. CIGAR operations are given as a list, each member being a list of
a CIGAR operation keyword and an integer operation length.
Returns a list of the core data described by ALN. The list elements are comprised of reference-id, alignment-position, read-name length, mapping-quality alignment-bin, cigar length, alignment flag, read length, mate reference-id, mate alignment-position and insert length.
Returns the same data as {defun alignment-core} in the form of an alist.
Returns an integer whose bits are flags that describe properties of the ALN. If the VALIDATE key is T (the default) the flag’s bits are checked for internal consistency.
Returns the bitwise flags of ALN in the form of an alist. The primary purpose of this function is debugging.
Returns a new standard generator function which returns pairs of
BAM alignment records.
Arguments:
- reference-id (integer): The BAM reference identifier.
- read-group (string): The read group name.
Key:
- read-length (integer): The read length.
- insert-length (integer): The insert length, defined as the distance
between the inner boundaries of the paired alignments.
- start (integer): The position at which to start generating alignments.
- end (integer): The position at which to stop generating alignments,
expressed in Lisp vector indices (zero-based, half-open), rather
than BAM’s (zero-based, closed).
- step-size (integer): The distance between each successive pair of
alignments.
- mapping-quality (integer): The mapping quality of the alignments.
Returns
- A function.
sam
.
Returns T if ALIGNMENT-RECORD1 sorts before ALIGNMENT-RECORD2 by
read name. Sorting semantics of read names are not fully defined in
the SAM spec; whether you should expect natural order or numeric order
of read name strings is not defined.
This function compares numerically by read name, then by alignment template region for reads paired in sequencing and finally by alignment strand.
sam
.
Returns T if FLAG indicates that the read mapping was not the primary mapping to a reference, or NIL otherwise.
Given an alignment generator function GEN, returns a new function that omits some alignments, yielding orphans. Any alignments for which TEST returns T will be omitted. The default is to omit alternate last fragment alignments.
sam
.
Returns the 0-based sequence coordinate of ALN in the reference sequence of the first base of the clipped read.
Returns T if ALIGNMENT-RECORD1 sorts before
ALIGNMENT-RECORD2. Sorting semantics are not fully defined in the SAM
spec, however, an informal consensus on sequence order sorting seems
to be:
- mapped reads should first be sorted by their reference in the order
in which reference sequences appear in the header
- unmapped reads should sort after mapped reads
- reads mapped to the same reference must appear in ascending order of
their alignment position
This function compares first by reference sequence, then alignment position, by alignment strand and finally by read name. The output is identical to a coordinate sort performed by Picard 1.07.
sam
.
Returns the end position of the alignment on the reference. Requires decoding the CIGAR string.
Returns an alist of tag and values described by ALN.
Closes an open block gzip file.
Arguments:
- bgzf (bgzf structure): The file to close.
Returns:
- T on success.
Returns T if the BGZF stream is terminated by an empty record.
Opens a block gzip file for reading or writing.
Arguments:
- bgzfspec (pathname designator, open stream or bgzf object): The file
to open or an open stream or bgzf object (which is returned unmodified).
The *standard-input* or *standard-ouput* streams may be used.
Key:
- compression (keyword): The zlib compression level (for writing).
Also accepts the keyword arguments applicable to CL:OPEN. However,
an :element-type argument will be ignored as the type is always octet.
Returns:
- A BGZF structure.
Seeks with the file encapsulated by a block gzip file.
Arguments:
- bgzf (bgzf structure): The handle to seek.
- position (integer): The position to seek. Only values previously returned by {defun bgzf-tell} may be used. The most significant 48 bits denote the real file position and the least significant 16 bits the offset within the uncompressed gzip member (see the SAM spec).
Returns:
- The new position.
Returns the current position in the encapsulated file of a block gzip
file.
Arguments:
- bgzf (bgzf structure): The file.
Returns:
- The file position.
Opens a block gzip stream for FILESPEC.
Key:
- direction (symbol): One of :input (the default) or :output
Returns:
- A {defclass bgzip-stream}
sam
.
Returns the chunk number CHUNK-NUM in BIN.
sam
.
sam
.
sam
.
Returns the number of CIGAR operations in ALN.
Returns T if parsed HEADER indicates that the file is sorted by coordinate, or NIL otherwise.
Returns a copy of ALN, optionally setting some fields to new values.
Returns T if BIN contains no chunks, or NIL otherwise.
sam
.
Returns HEADER-RECORD if all mandatory tags are present, or raises a {define-condition malformed-record-error} .
Checks list HEADER-RECORD for tag validity and returns HEADER-RECORD or raises a {define-condition malformed-record-error} if invalid tags are present. Ignores any user tags (lower case tags).
Returns HEADER if its PG records have unique ID tag values and valid PP tag values. A valid PP tag must point to the ID of one of the other PG records in the header.
Returns T if FLAG indicates that the read failed plaform quality control, or NIL otherwise.
Returns the pathname of an index file for BAM-FILESPEC, if the file is present and conforms to the naming convention of either Picard or Samtools. If both are present, the Picard convention is favoured.
sam
.
Returns a list of all the bins for reference REFERENCE-ID in INDEX, between reference positions START and END.
sam
.
Returns T if FLAG indicates that the read was the first in a pair of reads from one template, or NIL otherwise.
sam
.
Returns T if FLAG indicates that the read was the first in a pair of reads from one template, or NIL otherwise.
Returns an integer FLAG that had BAM flag bits named by symbols
BIT-NAMES set.
Arguments:
- flag (unsigned-byte 8): a BAM alignment flag.
Rest:
- bit-names (symbols): Any number of valid bit flag names:
;;; :sequenced-pair
;;; :mapped-proper-pair
;;; :query-mapped , :query-unmapped
;;; :mate-mapped , :mate-unmapped
;;; :query-forward , :query-reverse
;;; :mate-forward , :mate-reverse
;;; :first-in-pair , :second-in-pair
;;; :alignment-primary , :alignment-not-primary
;;; :fails-platform-qc
;;; :pcr/optical-duplicate
Returns:
- An (unsigned-byte 8)
Writes SAM flag counts from BAM-FILESPEC to STREAM.
sam
.
Returns T if FLAG indicates that the read was mapped to the forward strand of a reference, or NIL if it was mapped to the reverse strand.
sam
.
Returns T if FLAG indicates that the read’s mate was mapped to a reference, or NIL otherwise.
sam
.
Returns T if FLAG indicates that the read was mapped to the reverse strand of a reference, or NIL if it was mapped to the forward strand.
sam
.
Returns T if FLAG indicates that the read was not mapped to a reference, or NIL otherwise.
sam
.
Writes a very uniform BAM file to the file denoted by pathname
designator FILESPEC, for testing purposes.
Arguments:
- filespec (pathname designator): The BAM file to be written.
- num-refs (integer): The number of reference sequences in the BAM header.
- read-groups (list of string): The read group names in the BAM header. Each
reference will have a set of reads generated in each read group.
Rest:
- aln-generators (list of function): A list of alignment generator functions created with {defun alignment-generator} function. All of these functions will be called until exhausted, so they should represent finite sequences.
Returns
- filespec.
sam
.
Creates an artificial reference genome Fasta file to accompany a
generated BAM file.
Arguments:
- filespec (pathname designator): The file to create.
- name (string): The name of the reference sequence.
- length (integer): The length of the reference sequence.
Optional:
- fn (function): A function that returns a single base character. The
default randomly returns a, c, g or t in equal proportions.
Returns:
- The filespec.
sam
.
Returns a new HD record.
Returns a list of all records of HEADER-TYPE from HEADER.
Returns an alist of the tag-values of RECORD.
Returns a symbol indicating the header-type of RECORD, being one of :HD , :SQ , :RG or :PG .
Returns the value associated with TAG in RECORD.
Returns a new BAM-INDEX object, given pathname designator FILESPEC.
sam
.
Returns the insert length described by ALN.
Returns T if FLAG indicates that the read was the second in a pair of reads from one template, or NIL otherwise.
sam
.
Returns a list of the PG ID values from HEADER that are the last programs to act on the data. i.e. these are the leaf programs in the previous program tree.
Returns a new alignment record array.
Arguments:
- read-name (string): The read name.
- seq-str (string): The read sequence.
- alignment-flag (integer): The binary alignment flag.
Key:
- reference-id (integer): The reference identifier, defaults to -1
- alignment-pos (integer): The 1-based alignment position, defaults to -1.
- mate-reference-id (integer): The reference identifier of the mate,
defaults to -1.
- mate-alignment-pos (integer): The 1-based alignment position of the mate.
- mapping-quality (integer): The mapping quality, defaults to 0.
- alignment-bin (integer): The alignment bin, defaults to 0.
- insert-length (integer): The insert size, defaults to 0.
- cigar (alist): The cigar represented as an alist of operations e.g.
;;; ’((:M . 9) (:I . 1) (:M . 25))
- quality-str (string): The read quality string.
- tag-values (alist): The alignment tags represented as an alist e.g.
;;; ’((:XT . #U) (:NM . 1) (:X0 . 1) (:X1 . 0)
;;; (:XM . 1) (:XO . 0) (:XG . 0) (:MD . "3T31"))
The tags must have been defined with {defmacro define-alignment-tag} .
Returns:
- A vector of ’(unsigned-byte 8).
Returns a consumer function that accepts an argument of a BAM record and writes it to BAM output stream BAM. The standard consumer interface function CONSUME may be used in operations on the returned consumer.
sam
.
Parses a single SAM header record STR and returns a list. May raise a {define-condition malformed-record-error} or {define-condition malformed-field-error} . SAM tags are converted to keyword symbols.
Given a header record of
;;; "@SQ SN:AL096846 LN:6490 SP:Schizosaccharomyces pombe"
the returned list will be
;;; (:SQ (:SN . "AL096846") (:LN . 6490)
;;; (:SP . "Schizosaccharomyces pombe"))
thus the list’s first element is a keyword describing the record type and the rest of the list is itself an alist of record keys and values.
Returns a hash-table mapping reference identifiers to reference names for the reference data in REF-META-LIST.
Returns a list containing the data in header STR as Lisp
objects. If the header is NIL (there was no header) this function
returns NIL.
Given a header of
;;; "@HD VN:1.0
;;; @SQ SN:AL096846 LN:6490 SP:Schizosaccharomyces pombe
;;; @PG ID:bwa VN:0.4.6 CL:aln -n 0.04 -o 1 -e -1 -i 5 -d 10 -k 2 -M 3 -O 11 -E 4"
the returned list will be
;;; ((:HD (:VN . "1.0"))
;;; (:SQ (:SN . "AL096846") (:LN . 6490)
;;; (:SP . "Schizosaccharomyces pombe"))
;;; (:PG (:ID . "bwa") (:VN . "0.4.6")
;;; (:CL . "aln -n 0.04 -o 1 -e -1 -i 5 -d 10 -k 2 -M 3 -O 11 -E 4"))))
thus each list element is a list whose first element is a keyword
describing the record type. The rest of each list is itself an alist
of record keys and values.
Returns T if FLAG indicates that the read was mapped as a member of a properly oriented read-pair, or NIL otherwise.
Returns the integer mapping quality of ALN.
Returns the 0-based sequence position of the read mate’s alignment described by ALN.
Returns T if FLAG indicates that the read’s mate was mapped to the forward, or NIL if it was mapped to the reverse strand.
Returns T if FLAG indicates that the read’s mate was mapped to a reference, or NIL otherwise.
Returns the integer reference ID of ALN.
Returns T if FLAG indicates that the read’s mate was mapped to the reverse, or NIL if it was mapped to the forward strand.
Returns T if FLAG indicates that the read’s mate was not mapped to a reference, or NIL otherwise.
Returns T if FLAG indicates that the read was sequenced as a non-terminal part of a linear template, or NIL otherwise.
Returns a new header record created by merging the tags of header-records RECORD1 and RECORD2. Records may be safely merged if they have the same header-type and do not contain any conflicting tag values.
Returns a new SAM header that is the result of merging HEADERS. Headers may be safely merged if none of their constituent records contain conflicting tag values once merged.
Returns T if FLAG indicates that the read was sequenced as a member of a pair, or NIL otherwise.
sam
.
Returns T if parsed HEADER indicates that the file is sorted by name, or NIL otherwise.
Returns T if FLAG indicates that the read’s mate was mapped to the reverse, or NIL if it was mapped to the forward strand.
sam
.
Returns T if FLAG indicates that the read’s mate was not mapped to a reference, or NIL otherwise.
sam
.
Returns a new region from a string region designator in
samtools-style format:
<reference name>:<start coordinate>-<end coordinate>
The reference name must be one of those described in the BAM header metadata. The reference sequence coordinates are zero-based, half open with start < end.
sam
.
Returns T if FLAG indicates that the read is a PCR or optical duplicate, or NIL otherwise.
Returns a new PG record.
Returns a list of PG ID values from HEADER that are previous programs with respect to PG ID IDENTITY. The list is ordered with the most recently used program first i.e. reverse chronological order.
Returns T if FLAG indicates that the read was mapped as a member of a properly oriented read-pair, or NIL otherwise.
sam
.
Returns the sequence quality string described by ALN.
Returns T if FLAG indicates that the read was mapped to the forward strand of a reference, or NIL if it was mapped to the reverse strand.
Returns T if FLAG indicates that the read’s mate was mapped to a reference, or NIL otherwise.
Returns T if FLAG indicates that the read was mapped to the reverse strand of a reference, or NIL if it was mapped to the forward strand.
Returns T if FLAG indicates that the read was not mapped to a reference, or NIL otherwise.
Reads one alignment block from handle BGZF, returns it as a Lisp
array of unsigned-byte 8. The handle is advanced to the next
alignment. If no more alignments are available, returns NIL.
This is the preferred function to use for validation. i.e. validate early. A USE-VALUE restart is provided so that an invalid alignment may be modified and re-read without unwinding the stack.
sam
.
Returns the unparsed BAM header from the handle BGZF as a Lisp string.
sam
.
Reads the BAM magic number from the handle BGZF and returns T if it is valid or raises a {define-condition malformed-file-error} if not.
sam
.
Reads all BAM metadata from handle BGZF, leaving the handle pointing at the first alignment record. Returns the header string, the number of references and a list of reference sequence metadata. The list contains one element per reference sequence, each element being a list of reference identifier, reference name and reference length.
sam
.
Reads the EOF from handle BGZF, returning T if it is present, or raising a {define-condition malformed-file-error} otherwise.
sam
.
Returns the length of the read described by ALN.
Returns the read name string described by ALN.
Returns the length in ASCII characters of the read name of ALN.
Returns the number of reference sequences described in the BAM header of handle BGZF.
sam
.
Returns the reference sequence metadata for a single reference sequence described in the BAM header of handle BGZF. Two values are returned, the reference name as a string and the reference length as an integer,
sam
.
Returns the reference index for reference number REFERENCE-ID in BAM-INDEX.
sam
.
Returns the BIN number BIN-NUM in REF-INDEX.
sam
.
sam
.
Returns the reference sequence identifier of ALN. This is an integer locally assigned to a reference sequence within the context of a BAM file.
Returns alignment ALN if it has correct mapped-proper-pair,
query-mapped and mate-mapped flags, or a modified copy with fixed
flags. Also sets the user tag ZF:I:<original flag> if the flags are
changed.
Alignments produced by the BWA aligner have been observed to contain
invalid flags. This is caused by BWA creating mappings that overhang
the end of the reference. The underlying cause is reference
concatenation in the Burrows-Wheeler index.
This function attempts to fix invalid mapped-proper-pair flags in
cases where query-unmapped and/or mate-unmapped flags are set. Such
unmapped reads may also have reference-ids set and good mapping
scores. This function does not correct these other fields.
It is necessary to use this function in order to obtain correct flag counts when using samtools flagstat or {defun flagstat} .
sam
.
Returns a new RG record.
Returns T if FLAG indicates that the read was the second in a pair of reads from one template, or NIL otherwise.
Returns the sequence string described by ALN.
Returns T if FLAG indicates that the read was sequenced as a member of a pair, or NIL otherwise.
Sorts a BAM file by coordinate or by read name.
Arguments:
- in-filespec (pathname designator): The input BAM file.
- out-filespec (pathname designator): The output BAM file.
Key:
- sort-order (symbol): The sort order, either :coordinate
or :queryname .
- buffer-size (fixnum): The maximum number of reads to sort in memory
at any one time, defaulting to 1000000.
Returns:
- The number of alignments sorted.
- The number of files used in the external merge sort.
sam
.
Returns a new SQ record.
Returns a copy of HEADER with any group order tag initially present substituted by symbol ORDER, which must be one of the valid SAM sort orders. If there is no HD record in HEADER, one is added.
Returns a copy of HEADER with any header version tag initially present substituted by string VERSION, defaulting to *SAM-VERSION* .
Returns a copy of HEADER with any sort order tag initially present substituted by symbol ORDER, which must be one of the valid SAM sort orders. If there is no HD record in HEADER, one is added.
Returns T if FLAG indicates that the read was sequenced as part of a non-linear template or as part of a linear template where the position has been lost, or NIL otherwise.
Returns T if the paired-read-specific bits of FLAG are internally consistent.
Returns T if FLAG indicates valid mapping states for a pair of mapped reads, that is both must be mapped, or NIL otherwise.
Returns T if FLAG indicates valid proper mapping states for a pair of mapped reads, that is both must be mapped and on opposite strands, or NIL otherwise.
Returns T if STR is a valid reference sequence name matching the regex [!-)+-<>-~][!-~]* , or NIL otherwise.
Returns T if SAM version string STR matches /^[0-9]+.[0-9]$/, or NIL otherwise.
Writes the contents of binary BAM file BAM-FILESPEC to SAM text file SAM-FILESPEC.
sam
.
Writes one ALIGNMENT-RECORD to handle BGZF and returns the number of bytes written.
sam
.
Writes the BAM header string HEADER to handle BGZF, followed by padding of NULL-PADDING null bytes. This function also writes the header length, including padding, in the 4 bytes preceding the header.
sam
.
Writes the BAM magic number to the handle BGZF.
sam
.
Writes BAM magic number and then all metadata to handle BGZF. The
metadata consist of the HEADER string, number of reference sequences
NUM-REFS and a list reference sequence metadata REF-META. The list
contains one element per reference sequence, each element being a list
of reference identifier, reference name and reference length. Returns
the number of bytes written.
Key:
- compress-header (boolean): Compress the header block if T.
- null-padding (fixnum): A number of null bytes to be appended to the
end of the header string, as allowed by the SAM spec. This is useful
for creating slack space so that BAM headers may be edited in place.
sam
.
Writes alist HEADER-RECORD to STREAM.
sam
.
Writes the number of reference sequences N to handle BGZF.
sam
.
Writes the metadata for a single reference sequence named REF-NAME, of length REF-LENGTH bases, to handle BGZF.
sam
.
Writes ALIGNMENT-RECORD to STREAM as SAM. REF-TABLE is a hash-table created by {defun make-reference-table} .
sam
.
Writes SAM header ALIST as a string to STREAM.
sam
.
Returns the documentation for TAG or NIL if none is available.
sam
.
(eql :xt)
)) ¶(eql :xs)
)) ¶(eql :xo)
)) ¶(eql :xn)
)) ¶(eql :xm)
)) ¶(eql :xg)
)) ¶(eql :xf)
)) ¶(eql :xe)
)) ¶(eql :xc)
)) ¶(eql :xa)
)) ¶(eql :x1)
)) ¶(eql :x0)
)) ¶(eql :zf)
)) ¶(eql :za)
)) ¶(eql :uq)
)) ¶(eql :u2)
)) ¶(eql :tc)
)) ¶(eql :sq)
)) ¶(eql :sm)
)) ¶(eql :s2)
)) ¶(eql :sa)
)) ¶(eql :rt)
)) ¶(eql :rg)
)) ¶(eql :r2)
)) ¶(eql :qt)
)) ¶(eql :q2)
)) ¶(eql :pu)
)) ¶(eql :pt)
)) ¶(eql :pq)
)) ¶(eql :pg)
)) ¶(eql :oq)
)) ¶(eql :op)
)) ¶(eql :oc)
)) ¶(eql :nm)
)) ¶(eql :nh)
)) ¶(eql :mq)
)) ¶(eql :mf)
)) ¶(eql :md)
)) ¶(eql :ih)
)) ¶(eql :hi)
)) ¶(eql :h2)
)) ¶(eql :h1)
)) ¶(eql :h0)
)) ¶(eql :lb)
)) ¶(eql :gq)
)) ¶(eql :gs)
)) ¶(eql :gc)
)) ¶(eql :fz)
)) ¶(eql :fs)
)) ¶(eql :fi)
)) ¶(eql :e2)
)) ¶(eql :ct)
)) ¶(eql :cs)
)) ¶(eql :cq)
)) ¶(eql :cp)
)) ¶(eql :co)
)) ¶(eql :cm)
)) ¶(eql :cc)
)) ¶(eql :bq)
)) ¶(eql :bc)
)) ¶(eql :as)
)) ¶(eql :am)
)) ¶sam
.
samtools-bam-index
) stream) ¶bam-merge-stream
) &key) ¶bam-sort-input-stream
) predicate &key key buffer-size) ¶uk.co.deoxybyte-io
.
samtools-ref-index
) stream) ¶bgzip-stream
) &key abort) ¶uk.co.deoxybyte-io
.
bgzip-stream
)) ¶bgzip-input-stream
) &optional position) ¶sb-gray
.
bam-merge-stream
)) ¶uk.co.deoxybyte-io
.
bgzip-input-stream
)) ¶sb-gray
.
bam-sort-input-stream
)) ¶uk.co.deoxybyte-io
.
bgzip-input-stream
) sequence &optional start end) ¶sb-gray
.
vector
) (stream bam-sort-output-stream
)) ¶uk.co.deoxybyte-io
.
The parent type of all BAM error conditions.
sam
.
error
.
formatted-condition
.
sam
.
(quote nil)
:prev-position
This slot is read-only.
common-lisp
.
(quote nil)
:position
This slot is read-only.
(quote nil)
:prev-reference
This slot is read-only.
(quote nil)
:reference
This slot is read-only.
A condition raised when an error occurs reading from or writing to a BGZF stream.
A BAM file index covering all the reference sequences in a BAM file.
A block gzip file.
- pathname: The file pathname.
- stream: The file stream.
- buffer: A simple-octet-vector used for buffering reads.
- position: The file position component of the BGZF virtual file
offset (most significant 48 bits). This is the position in the
stream at which this member starts.
- offset: The within-member offset component of the BGZF virtual file
offset (least significant 16 bits). This is a position within the
uncompressed data of the member.
- pointer: The buffer index after the last usable data element. i.e.
the index at which new data may be written to the buffer prior to
deflating. Calling (subseq buffer 0 bgzf-pointer) will extract the
current usable bytes.
- util-buffer: a 4 byte buffer used internally to store an integer.
- loaded-p: T if the bgz data has been loaded into the buffer (used
internally in decompression and reading).
- load-seek: On loading the bgz data, proceed immediately to this
offset (used internally in decompression and reading).
- eof: T if the decompression process has reached EOF (used internally
in decompression and reading).
sam
.
structure-object
.
common-lisp
.
common-lisp
.
(integer 0 9)
sam::*default-compression*
uk.co.deoxybyte-utilities:simple-octet-vector
(make-array sam::+bgz-max-payload-length+ :element-type (quote uk.co.deoxybyte-utilities:octet))
common-lisp
.
(unsigned-byte 48)
0
uk.co.deoxybyte-utilities:uint16
0
(integer 0 65536)
0
(simple-array uk.co.deoxybyte-utilities:octet (4))
(make-array 4 :element-type (quote uk.co.deoxybyte-utilities:octet) :initial-element 0)
uk.co.deoxybyte-utilities:uint16
0
A bin within a BAM binning index. A bin is a region on a reference sequence that is identified by a number. The bin location and numbering system used is the UCSC binning scheme by Richard Durbin and Lincoln Stein. A bin contains a vector of chunks.
A chunk within a BAM index bin. Chunks are groups of records that lie within a bin and are close together within the BAM file.
An index for a single reference sequence. An index is composed of a vector of bins (the binning index) and a vector of intervals (the linear index). The bins are sorted by increasing bin number. The binning index is hierarchical, while the linear index is flat, being a projection of reads from all bins onto a single vector.
sam
.
structure-object
.
fixnum
sam::+unknown-reference+
This slot is read-only.
simple-vector
(make-array 0 :initial-element nil)
(simple-array fixnum (*))
(make-array 0 :element-type (quote fixnum))
A stream that reads from a BGZF file.
sam
.
bgzip-stream
.
fundamental-binary-input-stream
.
The Lisp buffer from which data are read.
:buffer
The number of bytes that were read into the buffer from the stream.
0
The offset in the byte buffer from which the next byte is to be read.
0
A BGZF stream capable of reading or writing block compressed data.
sam
.
bgzf-handle-mixin
.
fundamental-binary-stream
.
The size of the BAM alignment size indicator.
The maximium size in bytes of a BGZ member payload. This is dictated by the fact that the SAM spec makes 16 bits are avaliable for addressing positions with the BGZ member.
Buffer size for {defclass bgzip-input-stream} internal buffer.
sam
.
The size in bases of intervals in the linear bin index.
sam
.
The maximum number of bins possible in the BAM indexing scheme.
sam
.
The total number of bytes in the BGZ header.
Extra bin with different semantics added by samtools.
sam
.
The value of the RCF1952 first extra subfield used by BGZ members.
The value of the RCF1952 first extra subfield used by BGZ members.
The value of the RFC1952 subfield length field used by BGZ members.
The value for unavailable quality scores.
The value of the RCF1952 eXtra LENgth field used by BGZ members.
The default bgz compression level (Zlib level 5).
SAMtools version >0.1.5 appends an empty BGZF record to allow detection of truncated BAM files. These 28 bytes constitute such a record.
A mapping that describes the mandatory tags for each SAM header record type.
Valid values for SAM group order tags. Group order is no longer a valid tag in SAM version 1.3.
A mapping that describes the valid tags for each SAM header record type.
A list of valid SAM header types.
Valid values for SAM sort order tags.
If two index chunks are this number of bytes or closer to each other, they should be merged.
sam
.
Defines a tag parsing function NAME that parses tag values for SAM header HEADER-TYPE.
sam
.
Returns T if BAM index CHUNK1 and CHUNK2 are adjacent. In this context this means that they are sequential in a file stream and close enough together for it to be more efficient to continue reading across the intervening bytes, rather than seeking.
sam
.
Returns 7 integer values which are byte-offsets within ALN at which the various core data lie. See the SAM spec.
Returns T if FLAG indicates that the read mapping was the primary mapping to a reference, or NIL otherwise.
Returns the length of the alignment on the read.
Returns the length of the alignment on the reference.
Returns the number of bytes required to encode VALUE.
sam
.
sam
.
Returns the number of bytes occupied by the metadata in the BAM file FILESPEC. Metadata is defined here as the magic number, header and header padding, reference sequence count and reference sequence names and lengths.
sam
.
Returns the compressed offset (most significant bits) component of BGZF virtual offset POSITION.
sam
.
Returns T if all decompressed bytes have been read from the current decompressed BGZ block.
Returns the uncompressed (least significant bits) component of BGZF virtual offset POSITION.
sam
.
Returns an alist of CIGAR operations from NUM-BYTES bytes within ALN, starting at INDEX. The decoding of the = and X operations is not documented in the spec.
Returns a string containing the alignment query sequence of length NUM-BYTES. The sequence must be present in ALN at INDEX. The SAM spec states that quality data are optional, with absence indicated by 0xff. If the first byte of quality data is 0xff, NIL is returned.
Returns a string containing the template/read name of length NUM-BYTES, encoded at byte INDEX in ALN.
Returns a string containing the alignment query sequence of length NUM-BYTES. The sequence must be present in ALN at INDEX.
Returns a list of auxilliary data from ALN at INDEX. The BAM two-letter data keys are transformed to Lisp keywords.
Returns a new orphanizer test that causes alternate last fragments to be omitted.
sam
.
Returns ALN having encoded character VALUE into it, starting at INDEX.
Returns ALN having encoded alist CIGAR into it, starting at INDEX.
Returns ALN having encoded float VALUE into it, starting at INDEX.
Returns ALN having encoded hex string VALUE into it, starting at INDEX.
Returns ALN having encoded integer VALUE into it, starting at INDEX. BAM format is permitted to use more compact integer storage where possible.
Returns the character encoding Phred quality Q.
sam
.
Returns ALN having encoded quality string STR into it, starting at INDEX.
Returns ALN having encoded READ-NAME into it, starting at INDEX.
Returns ALN having encoded STR into it, starting at INDEX.
Returns ALN having encoded string VALUE into it, starting at INDEX.
Returns ALN having encoded N unknown qualities into it, starting at INDEX.
Returns a copy of HEADER that is guaranteed to contain a sort tag for DOMAIN, which must be one of :sort or :group .
Returns a copy of HEADER that is guaranteed to contain a version tag.
Returns HEADER if all records of RECORD-TYPE have unique TAG values, with respect to each other, or raises a {define-condition malformed-field-error} .
Returns STR if it is a valid reference sequence name, or raises a {define-condition malformed-field-error} if not.
Returns REGION if it is a valid region designator, or raises an
{define-condition invalid-argument-error} .
A region designator may be any of the following:
- A list of a string and two integers, being a reference name,
start position and end position, respectively.
- A list of three integers, being a reference identifier, start
position and end position, respectively.
- A region struct.
The start position must be less than, or equal to the end position.
sam
.
Returns a list of duplicate SAM header tags found in RECORD. Each list element contains the tag, followed by a list of the conflicting values.
Returns a list of any duplicate records of HEADER-TYPE in HEADER.
Returns a 3 character string symbolising the read pairing denoted
by FLAG. The left character indicates the query strand, the middle the
alignment pairing and the right the mate strand.
Query mapped forward >
Query mapped reverse <
Query unmapped .
Not paired .
Mapped proper pair =
Mapped pair -
Singleton ~
Mate mapped forward >
Mate mapped reverse <
Mate unmapped .
Raised a {define-condition malformed-field-error} for alignment FLAG in ALN, with MESSAGE.
Returns a hash-table of header-records taken from list RECORDS. The hash-table keys are HEADER-TAG values taken from the records and the hash-table values are lists of header-records that share that HEADER-TAG value.
Returns a new header record of HEADER-TYPE. ARGS are tag values in the same order as the tag returned by {defun valid-header-tags} , which is the same order as they are presented in the SAM spec.
Returns a new ALIGNMENT structure given BAM record ALN.
Returns a list of read chunks from INDEX covering REGION, sorted by increasing chunk start.
sam
.
Returns a generator function that returns BAM alignment records for BAM stream BAM by scanning the entire stream. This to be used in cases where a full scan is necessary, or as a fallback when neither index, nor regions are available. The standard generator interface functions NEXT and HAS-MORE-P may be used in operations on the returned generator.
sam
.
Returns a generator function that returns BAM alignment records for BAM stream BAM by scanning for alignments in the list of REGIONS. Note that REGIONS are zero-based, closed base coordinates. The standard generator interface functions NEXT and HAS-MORE-P may be used in operations on the returned generator.
sam
.
Returns a generator function that returns BAM alignment records for BAM stream BAM by scanning for alignments in the list of REGIONS. Note that REGIONS use zero-based, closed base coordinates. This to be used in cases where a full scan is necessary, or as a fallback when an index is not available. The standard generator interface functions NEXT and HAS-MORE-P may be used in operations on the returned generator.
sam
.
Returns a new SAM header string representing the header data in ALIST.
sam
.
Returns a new comparator function which sorts regions according to the BAM reference metadata REF-META. Ranges are sorted first by the reference order in the BAM file, then by region start and finally by region end. Regions are sorted before they are normalised.
sam
.
sam
.
Returns a list of the mandatory tags for SAM header
HEADER-TYPE. Both HEADER-TYPE. and the returned tags are represented
as symbols.
Returns a new list of BAM index chunks created by merging members of list CHUNKS that are {defun adjacentp} .
sam
.
Returns T if FLAG indicates that the read’s mate was mapped to the forward, or NIL if it was mapped to the reverse strand.
sam
.
Returns T if FLAG indicates that the read’s mate was mapped to a reference, or NIL otherwise.
sam
.
Returns a list of REGIONS, normalised according to the BAM reference metadata REF-META. Reference names in REGIONS are converted to their corresponding reference ID and REGIONS are sorted first by the reference order in the BAM file, then by region start and finally by region end. Overlapping REGIONS are merged.
sam
.
Collects all the header-records in HEADERS by header-type, sorts them and returns 4 values that are lists of the collected :hd , :sq , :rg and :pg header-records, respectively. Does not modify HEADERS.
Partitions a list of normalised REGIONS into lists, each pertaining to a specific reference sequence. The overall order of the REGIONS is maintained.
sam
.
Prints a string representation of BIN to STREAM.
sam
.
Prints a string representation of CHUNK to STREAM.
sam
.
Prints a string representation of REF-INDEX to STREAM.
sam
.
Prints a string representation of RANGE to STREAM.
sam
.
Prints a string representation of REF-INDEX to STREAM.
sam
.
Reads one BGZ member from STREAM, using BUFFER to hold integers as
they are read.
Arguments:
- stream (octet input-stream): An open stream.
- buffer (simple-octet-vector): A re-usable read buffer which must be
able to contain at least 4 bytes.
Returns:
- A BGZ structure, or NIL.
sam
.
Reads NUM-BINS bins from STREAM, returning a vector of bins, sorted by increasing bin number.
sam
.
Reads the BAI magic number from STREAM and returns T if it is valid or raises a {define-condition malformed-file-error} if not.
sam
.
Reads NUM-INTERVALS linear bin intervals from STREAM, returning them in a vector. Identical intervals are run-length compressed.
sam
.
Reads an index for a single reference sequence from STREAM.
sam
.
Reads N characters from handle BGZF and returns them as a Lisp string. The NULL-TERMINATED keyword is used to indicate whether the C string is null-terminated so that the terminator may be consumed.
sam
.
sam
.
Returns a bin number given a 0-based range.
sam
.
Returns a bit vector with the bits for relevant bins set, given a 0-based range. Each bin may span 2^29, 2^26, 2^23, 2^20, 2^17 or 2^14 bp. Bin 0 spans a 512 Mbp region, bins 1-8 span 64 Mbp, 9-72 8 Mbp, 73-584 1 Mbp, 585-4680 128 Kbp and bins 4681-37449 span 16 Kbp regions.
sam
.
Given a coordinate COORD, returns the array index of its interval in the BAM linear index.
sam
.
Returns a run-length encoded list representing INTERVALS, a BGZF linear index. Each element of the list has a car of the run-length and a cdr of the BGZF file position. Used in printing text representations of the index.
sam
.
sam
.
sam
.
sam
.
sam
.
Returns a simplified list of header-records copied from
RECORDS. The RECORDS must all be of the same type. The simplifications
are: removal of perfect duplicates, grouping of header-records by
HEADER-TAG value and subsequent merging of header-records that share
that HEADER-TAG value. RECORDS may be an empty list.
Sorts alignments from block gzip input stream BGZF-IN and writes them to block gzip output stream BGZF-OUT, sorted by PREDICATE. A function KEY may be supplied to transform alignments into arguments for PREDICATE. The BUFFER-SIZE argument declares the maximum number of alignments that will be sorted in memory at any time, defaulting to 1000000.
sam
.
Writes the binary BAM records from BGZF stream BAM to STREAM, in SAM text format.
sam
.
Returns a copy of CURRENT-RECORDS with NEW-RECORD added.
Returns T if TAG is a SAM 1.4 user-defined header tag. User-defined tags are recognised by containing lower case letters.
Returns a list of the valid tags for SAM header HEADER-TYPE. Both HEADER-TYPE and the returned tags are represented as symbols.
Returns T if STR is a valid read name matching the regex [!-?A-~]1,255 , or NIL otherwise. The length limit is implicit in the BAM format, there being 8 bits to store the read name length. This function is not used as it is not clear that this check is accepted by other implementations.
Returns T if BGZF virtual offsets are close enough to save disk seeks. Continuing to read from the current position may be faster than seeking forward a short distance.
sam
.
Writes one BGZ member to STREAM.
Arguments:
- bgz (bgz member): A bgz member to write.
- stream (octet output-stream): An open stream.
- buffer (simple-octet-vector): A re-usable read buffer which must be
able to contain at least 4 bytes.
Returns:
- The number of bytes written.
sam
.
Write N elements from vector BYTES to stream BGZF.
Key:
- compress (boolean): If T, compress at current BGZF compression level
when the current block becomes full. Defaults to T.
- mtime (uint32): The zlib mtime. Defaults to 0.
Returns:
- The number of bytes written.
sam
.
Writes the CIGAR string of ALIGNMENT-RECORD at INDEX as NUM-BYTES bytes, to STREAM.
sam
.
Writes the quality string of ALIGNMENT-RECORD at INDEX as NUM-BYTES, to STREAM.
sam
.
Writes the sequence string of ALIGNMENT-RECORD at INDEX as NUM-BYTES bytes, to STREAM.
sam
.
Writes the auxilliary data of ALIGNMENT-RECORD at INDEX to STREAM.
sam
.
sam
.
bgzf-io-error
)) ¶bgzf
.
sam
.
bam-merge-stream
)) ¶automatically generated reader method
Performs binary encoding of VALUE into VECTOR under TAG at INDEX, returning VECTOR.
sam
.
(eql :xt)
) aln index) ¶(eql :xs)
) aln index) ¶(eql :xo)
) aln index) ¶(eql :xn)
) aln index) ¶(eql :xm)
) aln index) ¶(eql :xg)
) aln index) ¶(eql :xf)
) aln index) ¶(eql :xe)
) aln index) ¶(eql :xc)
) aln index) ¶(eql :xa)
) aln index) ¶(eql :x1)
) aln index) ¶(eql :x0)
) aln index) ¶(eql :zf)
) aln index) ¶(eql :za)
) aln index) ¶(eql :uq)
) aln index) ¶(eql :u2)
) aln index) ¶(eql :tc)
) aln index) ¶(eql :sq)
) aln index) ¶(eql :sm)
) aln index) ¶(eql :s2)
) aln index) ¶(eql :sa)
) aln index) ¶(eql :rt)
) aln index) ¶(eql :rg)
) aln index) ¶(eql :r2)
) aln index) ¶(eql :qt)
) aln index) ¶(eql :q2)
) aln index) ¶(eql :pu)
) aln index) ¶(eql :pt)
) aln index) ¶(eql :pq)
) aln index) ¶(eql :pg)
) aln index) ¶(eql :oq)
) aln index) ¶(eql :op)
) aln index) ¶(eql :oc)
) aln index) ¶(eql :nm)
) aln index) ¶(eql :nh)
) aln index) ¶(eql :mq)
) aln index) ¶(eql :mf)
) aln index) ¶(eql :md)
) aln index) ¶(eql :ih)
) aln index) ¶(eql :hi)
) aln index) ¶(eql :h2)
) aln index) ¶(eql :h1)
) aln index) ¶(eql :h0)
) aln index) ¶(eql :lb)
) aln index) ¶(eql :gq)
) aln index) ¶(eql :gs)
) aln index) ¶(eql :gc)
) aln index) ¶(eql :fz)
) aln index) ¶(eql :fs)
) aln index) ¶(eql :fi)
) aln index) ¶(eql :e2)
) aln index) ¶(eql :ct)
) aln index) ¶(eql :cs)
) aln index) ¶(eql :cq)
) aln index) ¶(eql :cp)
) aln index) ¶(eql :co)
) aln index) ¶(eql :cm)
) aln index) ¶(eql :cc)
) aln index) ¶(eql :bq)
) aln index) ¶(eql :bc)
) aln index) ¶(eql :as)
) aln index) ¶(eql :am)
) aln index) ¶sam
.
bgzf-io-error
)) ¶sam
.
bam-sort-error
)) ¶sam
.
bam-sort-error
)) ¶sam
.
bam-sort-error
)) ¶sam
.
bam-sort-error
)) ¶sam
.
samtools-ref-index
) stream) ¶sam
.
structure-object
.
uk.co.deoxybyte-utilities:uint16
0
uk.co.deoxybyte-utilities:uint16
0
uk.co.deoxybyte-utilities:int32
sam::+unknown-position+
uk.co.deoxybyte-utilities:int32
sam::+unknown-position+
uk.co.deoxybyte-utilities:int32
sam::+unknown-reference+
uk.co.deoxybyte-utilities:int32
sam::+unknown-reference+
fixnum
0
uk.co.deoxybyte-utilities:uint8
0
uk.co.deoxybyte-utilities:int32
0
simple-string
"*"
simple-string
"*"
simple-string
"*"
list
uk.co.deoxybyte-utilities:simple-octet-vector
(make-array 0 :element-type (quote uk.co.deoxybyte-utilities:octet))
A block-gzip data chunk; a gzip member with extensions, as defined
by RFC1952. The extensions are described in RFC1952 and the SAM format
specification.
- sf1: RCF1952 first extra SubField.
- sf2: RCF1952 second extra SubField.
- slen: RFC1952 Subfield LENgth.
- bsize: SAM spec total Block (member) SIZE. The serialized value is (1- bsize).
- udata: Uncompressed DATA.
sam
.
gz-member
.
uk.co.deoxybyte-utilities:uint8
sam::+sf1+
This slot is read-only.
uk.co.deoxybyte-utilities:uint8
sam::+sf2+
This slot is read-only.
uk.co.deoxybyte-utilities:uint16
sam::+slen+
This slot is read-only.
uk.co.deoxybyte-utilities:uint16
0
uk.co.deoxybyte-utilities:simple-octet-vector
(make-array 0 :element-type (quote uk.co.deoxybyte-utilities:octet))
A range of bases over a reference sequence. A region is expressed in zero-based, half-open, interbase coordinates.
A samtools-specific index containing extra, undocumented data: - unassigned: number of unmapped reads not assigned to a reference
A samtools-specific reference index containing extra,
undocumented data:
- start: the start offset of the reference
- end: the end offset of the reference
- mapped: number of reads mapped to the reference
- unmapped: number of unmapped reads assigned to the reference by
magic
sam
.
(unsigned-byte 64)
0
(unsigned-byte 64)
0
(unsigned-byte 64)
0
(unsigned-byte 64)
0
sam
.
merge-stream
.
wrapped-stream-mixin
.
sam
.
bgzf-handle-mixin
.
sort-input-stream
.
sam
.
bgzf-handle-mixin
.
sort-output-stream
.
Jump to: | %
(
A B C D E F G H I L M N P Q R S U V W |
---|
Jump to: | %
(
A B C D E F G H I L M N P Q R S U V W |
---|
Jump to: | *
+
B C E F I L M N O P Q R S U |
---|
Jump to: | *
+
B C E F I L M N O P Q R S U |
---|
Jump to: | A B C E F M P R S T |
---|
Jump to: | A B C E F M P R S T |
---|