mirror of
https://github.com/MillironX/XAM.jl.git
synced 2024-12-23 21:28:18 +00:00
Merge pull request #43 from jakobnissen/flagdocs
Improve documentation of flag function
This commit is contained in:
commit
c7114bce16
6 changed files with 29 additions and 12 deletions
21
src/XAM.jl
21
src/XAM.jl
|
@ -4,6 +4,27 @@ export
|
||||||
SAM,
|
SAM,
|
||||||
BAM
|
BAM
|
||||||
|
|
||||||
|
"""
|
||||||
|
flag(record::Union{SAM.Record, BAM.Record})::UInt16
|
||||||
|
|
||||||
|
Get the bitwise flags of `record`. The returned value is a `UInt16` of each flag
|
||||||
|
being OR'd together. The possible flags are:
|
||||||
|
|
||||||
|
0x0001 template having multiple segments in sequencing
|
||||||
|
0x0002 each segment properly aligned according to the aligner
|
||||||
|
0x0004 segment unmapped
|
||||||
|
0x0008 next segment in the template unmapped
|
||||||
|
0x0010 SEQ being reverse complemented
|
||||||
|
0x0020 SEQ of the next segment in the template being reverse complemented
|
||||||
|
0x0040 the first segment in the template
|
||||||
|
0x0080 the last segment in the template
|
||||||
|
0x0100 secondary alignment
|
||||||
|
0x0200 not passing filters, such as platform/vendor quality controls
|
||||||
|
0x0400 PCR or optical duplicate
|
||||||
|
0x0800 supplementary alignment
|
||||||
|
"""
|
||||||
|
function flag end
|
||||||
|
|
||||||
include("sam/sam.jl")
|
include("sam/sam.jl")
|
||||||
include("bam/bam.jl")
|
include("bam/bam.jl")
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ module BAM
|
||||||
using BioGenerics
|
using BioGenerics
|
||||||
using GenomicFeatures
|
using GenomicFeatures
|
||||||
using XAM.SAM
|
using XAM.SAM
|
||||||
|
import ..XAM: flag
|
||||||
|
|
||||||
import BGZFStreams
|
import BGZFStreams
|
||||||
import BioAlignments
|
import BioAlignments
|
||||||
|
|
|
@ -128,11 +128,6 @@ end
|
||||||
# Accessor Fuctions
|
# Accessor Fuctions
|
||||||
# -----------------
|
# -----------------
|
||||||
|
|
||||||
"""
|
|
||||||
flag(record::Record)::UInt16
|
|
||||||
|
|
||||||
Get the bitwise flag of `record`.
|
|
||||||
"""
|
|
||||||
function flag(record::Record)::UInt16
|
function flag(record::Record)::UInt16
|
||||||
checkfilled(record)
|
checkfilled(record)
|
||||||
return record.flag
|
return record.flag
|
||||||
|
|
|
@ -18,9 +18,13 @@ for (name, bits, doc) in [
|
||||||
(:SUPPLEMENTARY, UInt16(0x800), "supplementary alignment" ),]
|
(:SUPPLEMENTARY, UInt16(0x800), "supplementary alignment" ),]
|
||||||
@assert bits isa UInt16
|
@assert bits isa UInt16
|
||||||
sym = Symbol("FLAG_", name)
|
sym = Symbol("FLAG_", name)
|
||||||
doc = string(@sprintf("0x%04x: ", bits), doc)
|
docstring = """ $sym
|
||||||
|
SAM/BAM flag: $doc
|
||||||
|
|
||||||
|
See also: [`flag`](@ref)
|
||||||
|
"""
|
||||||
@eval begin
|
@eval begin
|
||||||
@doc $(doc) const $(sym) = $(bits)
|
@doc $(docstring) const $(sym) = $(bits)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -150,11 +150,6 @@ end
|
||||||
# Accessor Functions
|
# Accessor Functions
|
||||||
# ------------------
|
# ------------------
|
||||||
|
|
||||||
"""
|
|
||||||
flag(record::Record)::UInt16
|
|
||||||
|
|
||||||
Get the bitwise flag of `record`.
|
|
||||||
"""
|
|
||||||
function flag(record::Record)::UInt16
|
function flag(record::Record)::UInt16
|
||||||
checkfilled(record)
|
checkfilled(record)
|
||||||
return unsafe_parse_decimal(UInt16, record.data, record.flag)
|
return unsafe_parse_decimal(UInt16, record.data, record.flag)
|
||||||
|
|
|
@ -11,6 +11,7 @@ import BioGenerics.Exceptions: missingerror
|
||||||
import BioGenerics.Automa: State
|
import BioGenerics.Automa: State
|
||||||
import BioSequences
|
import BioSequences
|
||||||
import TranscodingStreams: TranscodingStreams, TranscodingStream
|
import TranscodingStreams: TranscodingStreams, TranscodingStream
|
||||||
|
import ..XAM: flag
|
||||||
|
|
||||||
using Printf: @sprintf
|
using Printf: @sprintf
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue