From 9ee35af43d718b5543224b14e83a95ca4d71d020 Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Tue, 29 Jun 2021 03:28:28 +0000 Subject: [PATCH] build based on ccc9112 --- dev/assets/documenter.js | 24 ++--- dev/assets/search.js | 14 +-- dev/assets/themes/documenter-dark.css | 73 ++++++++++++---- dev/assets/themes/documenter-light.css | 116 ++++++++++++++++++++----- dev/assets/themeswap.js | 38 ++++++-- dev/assets/warner.js | 49 +++++++++++ dev/index.html | 2 +- dev/man/api/index.html | 6 +- dev/man/hts-files/index.html | 16 ++-- dev/search/index.html | 2 +- dev/search_index.js | 2 +- versions.js | 2 + 12 files changed, 266 insertions(+), 78 deletions(-) create mode 100644 dev/assets/warner.js diff --git a/dev/assets/documenter.js b/dev/assets/documenter.js index 22f0f9a..6d0b785 100644 --- a/dev/assets/documenter.js +++ b/dev/assets/documenter.js @@ -1,15 +1,15 @@ // Generated by Documenter.jl requirejs.config({ paths: { - 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/languages/julia.min', - 'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.10.3/headroom.min', + 'highlight-julia': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/languages/julia.min', + 'headroom': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.12.0/headroom.min', 'jqueryui': 'https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min', - 'katex-auto-render': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/contrib/auto-render.min', - 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min', - 'headroom-jquery': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.10.3/jQuery.headroom.min', - 'katex': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.11.1/katex.min', - 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/highlight.min', - 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.10/languages/julia-repl.min', + 'katex-auto-render': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/contrib/auto-render.min', + 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min', + 'headroom-jquery': 'https://cdnjs.cloudflare.com/ajax/libs/headroom/0.12.0/jQuery.headroom.min', + 'katex': 'https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.13.11/katex.min', + 'highlight': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/highlight.min', + 'highlight-julia-repl': 'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.0.1/languages/julia-repl.min', }, shim: { "highlight-julia": { @@ -65,9 +65,9 @@ $(document).ready(function() { }) //////////////////////////////////////////////////////////////////////////////// -require(['jquery', 'highlight', 'highlight-julia', 'highlight-julia-repl'], function($, hljs) { +require(['jquery', 'highlight', 'highlight-julia', 'highlight-julia-repl'], function($) { $(document).ready(function() { - hljs.initHighlighting(); + hljs.highlightAll(); }) }) @@ -208,6 +208,10 @@ $(document).ready(function() { $('#documenter-themepicker option').each(function(i,e) { e.selected = (e.value === theme); }) + } else { + $('#documenter-themepicker option').each(function(i,e) { + e.selected = $("html").hasClass(`theme--${e.value}`); + }) } } }) diff --git a/dev/assets/search.js b/dev/assets/search.js index e30e907..1a51454 100644 --- a/dev/assets/search.js +++ b/dev/assets/search.js @@ -1,9 +1,9 @@ // Generated by Documenter.jl requirejs.config({ paths: { - 'lunr': 'https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.6/lunr.min', - 'lodash': 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.15/lodash.min', - 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min', + 'lunr': 'https://cdnjs.cloudflare.com/ajax/libs/lunr.js/2.3.9/lunr.min', + 'lodash': 'https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.17.21/lodash.min', + 'jquery': 'https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min', } }); //////////////////////////////////////////////////////////////////////////////// @@ -181,7 +181,7 @@ $(document).ready(function() { var store = {} documenterSearchIndex['docs'].forEach(function(e) { - store[e.location] = {title: e.title, category: e.category} + store[e.location] = {title: e.title, category: e.category, page: e.page} }) $(function(){ @@ -221,7 +221,11 @@ $(document).ready(function() { data = store[result.ref] link = $(''+data.title+'') link.attr('href', documenterBaseURL+'/'+result.ref) - cat = $('('+data.category+')') + if (data.category != "page"){ + cat = $('('+data.category+', '+data.page+')') + } else { + cat = $('('+data.category+')') + } li = $('
  • ').append(link).append(" ").append(cat) searchresults.append(li) }) diff --git a/dev/assets/themes/documenter-dark.css b/dev/assets/themes/documenter-dark.css index 1c370f2..cbeca20 100644 --- a/dev/assets/themes/documenter-dark.css +++ b/dev/assets/themes/documenter-dark.css @@ -753,19 +753,19 @@ a.has-text-danger:hover, a.has-text-danger:focus { font-weight: 700 !important; } .is-family-primary { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-secondary { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-sans-serif { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-monospace { - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } .is-family-code { - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } .is-block { display: block !important; } @@ -1070,9 +1070,13 @@ html.theme--documenter-dark { * * The main container is
    that is identified by id #documenter. */ - /* a11y-dark theme */ - /* Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css */ - /* @author: ericwbailey */ + /*! + Theme: a11y-dark + Author: @ericwbailey + Maintainer: @ericwbailey + + Based on the Tomorrow Night Eighties theme: https://github.com/isagalaev/highlight.js/blob/master/src/styles/tomorrow-night-eighties.css +*/ /* Comment */ /* Red */ /* Orange */ @@ -1103,12 +1107,12 @@ html.theme--documenter-dark { html.theme--documenter-dark input, html.theme--documenter-dark select, html.theme--documenter-dark textarea { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif; } html.theme--documenter-dark code, html.theme--documenter-dark pre { -moz-osx-font-smoothing: auto; -webkit-font-smoothing: auto; - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace; } html.theme--documenter-dark body { color: #fff; font-size: 1em; @@ -7277,6 +7281,30 @@ html.theme--documenter-dark { opacity: 0.2; } html.theme--documenter-dark .docstring > section:hover a.docs-sourcelink { opacity: 1; } + html.theme--documenter-dark .documenter-example-output { + background-color: #1f2424; } + html.theme--documenter-dark .outdated-warning-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + z-index: 999; + background-color: #282f2f; + border-bottom: 3px solid #9e1b0d; + padding: 10px 35px; + text-align: center; + font-size: 15px; } + html.theme--documenter-dark .outdated-warning-overlay .outdated-warning-closer { + position: absolute; + top: calc(50% - 10px); + right: 18px; + cursor: pointer; + width: 12px; } + html.theme--documenter-dark .outdated-warning-overlay a { + color: #1abc9c; } + html.theme--documenter-dark .outdated-warning-overlay a:hover { + color: #1dd2af; } html.theme--documenter-dark .content pre { border: 1px solid #5e6d6f; } html.theme--documenter-dark .content code { @@ -7303,11 +7331,15 @@ html.theme--documenter-dark { html.theme--documenter-dark .katex .katex-mathml { top: 0; right: 0; } + html.theme--documenter-dark .katex-display, html.theme--documenter-dark mjx-container, html.theme--documenter-dark .MathJax_Display { + margin: 0.5em 0 !important; } html.theme--documenter-dark html { -moz-osx-font-smoothing: auto; -webkit-font-smoothing: auto; } html.theme--documenter-dark #documenter .docs-main > article { overflow-wrap: break-word; } + html.theme--documenter-dark #documenter .docs-main > article .math-container { + overflow-x: auto; } @media screen and (min-width: 1056px) { html.theme--documenter-dark #documenter .docs-main { max-width: 52rem; @@ -7379,6 +7411,7 @@ html.theme--documenter-dark { margin-bottom: 0.4em; } html.theme--documenter-dark #documenter .docs-main .docs-footer { display: flex; + flex-wrap: wrap; margin-left: 0; margin-right: 0; border-top: 1px solid #5e6d6f; @@ -7392,6 +7425,13 @@ html.theme--documenter-dark { flex-grow: 1; } html.theme--documenter-dark #documenter .docs-main .docs-footer .docs-footer-nextpage { text-align: right; } + html.theme--documenter-dark #documenter .docs-main .docs-footer .flexbox-break { + flex-basis: 100%; + height: 0; } + html.theme--documenter-dark #documenter .docs-main .docs-footer .footer-message { + font-size: 0.8em; + margin: 0.5em auto 0 auto; + text-align: center; } html.theme--documenter-dark #documenter .docs-sidebar { display: flex; flex-direction: column; @@ -7434,6 +7474,8 @@ html.theme--documenter-dark { padding: 0.5rem 0; } html.theme--documenter-dark #documenter .docs-sidebar .docs-package-name .docs-autofit { max-width: 16.2rem; } + html.theme--documenter-dark #documenter .docs-sidebar .docs-package-name a, html.theme--documenter-dark #documenter .docs-sidebar .docs-package-name a:hover { + color: #fff; } html.theme--documenter-dark #documenter .docs-sidebar .docs-version-selector { border-top: 1px solid #5e6d6f; display: none; @@ -7560,6 +7602,9 @@ html.theme--documenter-dark { overflow-y: scroll; text-rendering: optimizeLegibility; text-size-adjust: 100%; } + html.theme--documenter-dark .hljs { + background: #2b2b2b; + color: #f8f8f2; } html.theme--documenter-dark .hljs-comment, html.theme--documenter-dark .hljs-quote { color: #d4d0ab; } @@ -7574,7 +7619,6 @@ html.theme--documenter-dark { color: #ffa07a; } html.theme--documenter-dark .hljs-number, html.theme--documenter-dark .hljs-built_in, - html.theme--documenter-dark .hljs-builtin-name, html.theme--documenter-dark .hljs-literal, html.theme--documenter-dark .hljs-type, html.theme--documenter-dark .hljs-params, @@ -7594,12 +7638,6 @@ html.theme--documenter-dark { html.theme--documenter-dark .hljs-keyword, html.theme--documenter-dark .hljs-selector-tag { color: #dcc6e0; } - html.theme--documenter-dark .hljs { - display: block; - overflow-x: auto; - background: #2b2b2b; - color: #f8f8f2; - padding: 0.5em; } html.theme--documenter-dark .hljs-emphasis { font-style: italic; } html.theme--documenter-dark .hljs-strong { @@ -7608,7 +7646,6 @@ html.theme--documenter-dark { html.theme--documenter-dark .hljs-addition, html.theme--documenter-dark .hljs-attribute, html.theme--documenter-dark .hljs-built_in, - html.theme--documenter-dark .hljs-builtin-name, html.theme--documenter-dark .hljs-bullet, html.theme--documenter-dark .hljs-comment, html.theme--documenter-dark .hljs-link, diff --git a/dev/assets/themes/documenter-light.css b/dev/assets/themes/documenter-light.css index bfb4e9d..4a928f6 100644 --- a/dev/assets/themes/documenter-light.css +++ b/dev/assets/themes/documenter-light.css @@ -310,13 +310,13 @@ button, input, select, textarea { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif; } code, pre { -moz-osx-font-smoothing: auto; -webkit-font-smoothing: auto; - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace; } body { color: #222222; @@ -853,19 +853,19 @@ a.has-text-danger:hover, a.has-text-danger:focus { font-weight: 700 !important; } .is-family-primary { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-secondary { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-sans-serif { - font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } + font-family: "Lato Medium", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", "Helvetica", "Arial", sans-serif !important; } .is-family-monospace { - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } .is-family-code { - font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } + font-family: "JuliaMono", "SFMono-Regular", "Menlo", "Consolas", "Liberation Mono", "DejaVu Sans Mono", monospace !important; } .is-block { display: block !important; } @@ -7138,7 +7138,7 @@ h1:hover .docs-heading-anchor-permalink, h2:hover .docs-heading-anchor-permalink .admonition.is-default > .admonition-body { color: #fff; } .admonition.is-info { - background-color: #b8dffa; + background-color: #def0fd; border-color: #209cee; } .admonition.is-info > .admonition-header { background-color: #209cee; @@ -7146,7 +7146,7 @@ h1:hover .docs-heading-anchor-permalink, h2:hover .docs-heading-anchor-permalink .admonition.is-info > .admonition-body { color: rgba(0, 0, 0, 0.7); } .admonition.is-success { - background-color: #9beeb8; + background-color: #bdf4d1; border-color: #22c35b; } .admonition.is-success > .admonition-header { background-color: #22c35b; @@ -7162,15 +7162,15 @@ h1:hover .docs-heading-anchor-permalink, h2:hover .docs-heading-anchor-permalink .admonition.is-warning > .admonition-body { color: rgba(0, 0, 0, 0.7); } .admonition.is-danger { - background-color: #ff857e; + background-color: #ffaba7; border-color: #da0b00; } .admonition.is-danger > .admonition-header { background-color: #da0b00; color: #fff; } .admonition.is-danger > .admonition-body { - color: #fff; } + color: rgba(0, 0, 0, 0.7); } .admonition.is-compat { - background-color: #99e6f0; + background-color: #bdeff5; border-color: #1db5c9; } .admonition.is-compat > .admonition-header { background-color: #1db5c9; @@ -7239,6 +7239,33 @@ h1:hover .docs-heading-anchor-permalink, h2:hover .docs-heading-anchor-permalink .docstring > section:hover a.docs-sourcelink { opacity: 1; } +.documenter-example-output { + background-color: white; } + +.outdated-warning-overlay { + position: fixed; + top: 0; + left: 0; + right: 0; + box-shadow: 0 0 10px rgba(0, 0, 0, 0.3); + z-index: 999; + background-color: #ffaba7; + color: rgba(0, 0, 0, 0.7); + border-bottom: 3px solid #da0b00; + padding: 10px 35px; + text-align: center; + font-size: 15px; } + .outdated-warning-overlay .outdated-warning-closer { + position: absolute; + top: calc(50% - 10px); + right: 18px; + cursor: pointer; + width: 12px; } + .outdated-warning-overlay a { + color: #2e63b8; } + .outdated-warning-overlay a:hover { + color: #363636; } + .content pre { border: 1px solid #dbdbdb; } @@ -7274,6 +7301,9 @@ h1:hover .docs-heading-anchor-permalink, h2:hover .docs-heading-anchor-permalink top: 0; right: 0; } +.katex-display, mjx-container, .MathJax_Display { + margin: 0.5em 0 !important; } + html { -moz-osx-font-smoothing: auto; -webkit-font-smoothing: auto; } @@ -7284,6 +7314,8 @@ html { */ #documenter .docs-main > article { overflow-wrap: break-word; } + #documenter .docs-main > article .math-container { + overflow-x: auto; } @media screen and (min-width: 1056px) { #documenter .docs-main { @@ -7360,6 +7392,7 @@ html { #documenter .docs-main .docs-footer { display: flex; + flex-wrap: wrap; margin-left: 0; margin-right: 0; border-top: 1px solid #dbdbdb; @@ -7373,6 +7406,13 @@ html { flex-grow: 1; } #documenter .docs-main .docs-footer .docs-footer-nextpage { text-align: right; } + #documenter .docs-main .docs-footer .flexbox-break { + flex-basis: 100%; + height: 0; } + #documenter .docs-main .docs-footer .footer-message { + font-size: 0.8em; + margin: 0.5em auto 0 auto; + text-align: center; } #documenter .docs-sidebar { display: flex; @@ -7416,6 +7456,8 @@ html { padding: 0.5rem 0; } #documenter .docs-sidebar .docs-package-name .docs-autofit { max-width: 16.2rem; } + #documenter .docs-sidebar .docs-package-name a, #documenter .docs-sidebar .docs-package-name a:hover { + color: #0a0a0a; } #documenter .docs-sidebar .docs-version-selector { border-top: 1px solid #dbdbdb; display: none; @@ -7537,29 +7579,54 @@ html { #documenter .docs-main #documenter-search-results .docs-highlight { background-color: yellow; } -/* - -Original highlight.js style (c) Ivan Sagalaev - +/*! + Theme: Default + Description: Original highlight.js style + Author: (c) Ivan Sagalaev + Maintainer: @highlightjs/core-team + Website: https://highlightjs.org/ + License: see project LICENSE + Touched: 2021 */ -.hljs { +/* +This is left on purpose making default.css the single file that can be lifted +as-is from the repository directly without the need for a build step + +Typically this "required" baseline CSS is added by `makestuff.js` during build. +*/ +pre code.hljs { display: block; overflow-x: auto; - padding: 0.5em; - background: #F0F0F0; } + padding: 1em; } -/* Base color: saturation 0; */ -.hljs, -.hljs-subst { +code.hljs { + padding: 3px 5px; } + +/* end baseline CSS */ +.hljs { + background: #F0F0F0; color: #444; } +/* Base color: saturation 0; */ +.hljs-subst { + /* default */ } + +/* purposely ignored */ .hljs-comment { color: #888888; } +.hljs-tag, +.hljs-punctuation { + color: #444a; } + +.hljs-tag .hljs-name, +.hljs-tag .hljs-attr { + color: #444; } + .hljs-keyword, .hljs-attribute, .hljs-selector-tag, -.hljs-meta-keyword, +.hljs-meta .hljs-keyword, .hljs-doctag, .hljs-name { font-weight: bold; } @@ -7586,6 +7653,7 @@ Original highlight.js style (c) Ivan Sagalaev .hljs-template-variable, .hljs-link, .hljs-selector-attr, +.hljs-operator, .hljs-selector-pseudo { color: #BC6060; } @@ -7603,7 +7671,7 @@ Original highlight.js style (c) Ivan Sagalaev .hljs-meta { color: #1f7199; } -.hljs-meta-string { +.hljs-meta .hljs-string { color: #4d99bf; } /* Misc effects */ diff --git a/dev/assets/themeswap.js b/dev/assets/themeswap.js index d466684..c58e993 100644 --- a/dev/assets/themeswap.js +++ b/dev/assets/themeswap.js @@ -1,10 +1,20 @@ // Small function to quickly swap out themes. Gets put into the tag.. function set_theme_from_local_storage() { - // Browser does not support Web Storage, bail early. - if(typeof(window.localStorage) === "undefined") return; - // Get the user-picked theme from localStorage. May be `null`, which means the default - // theme. - var theme = window.localStorage.getItem("documenter-theme"); + // Intialize the theme to null, which means default + var theme = null; + // If the browser supports the localstorage and is not disabled then try to get the + // documenter theme + if(window.localStorage != null) { + // Get the user-picked theme from localStorage. May be `null`, which means the default + // theme. + theme = window.localStorage.getItem("documenter-theme"); + } + // Check if the browser supports user color preference + var darkPreference = false; + // Check if the users preference is for dark color scheme + if(window.matchMedia('(prefers-color-scheme: dark)').matches === true) { + darkPreference = true; + } // Initialize a few variables for the loop: // // - active: will contain the index of the theme that should be active. Note that there @@ -14,7 +24,7 @@ function set_theme_from_local_storage() { // // - disabled: style sheets that should be disabled (i.e. all the theme style sheets // that are not the currently active theme) - var active = null; var disabled = []; + var active = null; var disabled = []; var darkTheme = null; for (var i = 0; i < document.styleSheets.length; i++) { var ss = document.styleSheets[i]; // The tag of each style sheet is expected to have a data-theme-name attribute @@ -25,8 +35,12 @@ function set_theme_from_local_storage() { // To distinguish the default (primary) theme, it needs to have the data-theme-primary // attribute set. var isprimary = (ss.ownerNode.getAttribute("data-theme-primary") !== null); + // Check if the theme is primary dark theme + var isDarkTheme = (ss.ownerNode.getAttribute("data-theme-primary-dark") !== null); + // If ss is for dark theme then set the value of darkTheme to the name of the theme + if(isDarkTheme) darkTheme = themename; // If we find a matching theme (and it's not the default), we'll set active to non-null - if(!isprimary && themename === theme) active = i; + if(themename === theme) active = i; // Store the style sheets of inactive themes so that we could disable them if(themename !== theme) disabled.push(ss); } @@ -38,5 +52,15 @@ function set_theme_from_local_storage() { ss.disabled = true; }); } + else if(darkTheme !== null && darkPreference === true) { + // If we did find an active theme, we'll (1) add the theme--$(theme) class to + document.getElementsByTagName('html')[0].className = "theme--" + darkTheme; + // and (2) disable all the other theme stylesheets + disabled.forEach(function(ss){ + if (ss.ownerNode.getAttribute("data-theme-name") !== darkTheme) { + ss.disabled = true; + } + }); + } } set_theme_from_local_storage(); diff --git a/dev/assets/warner.js b/dev/assets/warner.js new file mode 100644 index 0000000..e818482 --- /dev/null +++ b/dev/assets/warner.js @@ -0,0 +1,49 @@ +function maybeAddWarning () { + // DOCUMENTER_NEWEST is defined in versions.js, DOCUMENTER_CURRENT_VERSION and DOCUMENTER_STABLE + // in siteinfo.js. + // If either of these are undefined something went horribly wrong, so we abort. + if ( + window.DOCUMENTER_NEWEST === undefined || + window.DOCUMENTER_CURRENT_VERSION === undefined || + window.DOCUMENTER_STABLE === undefined + ) { + return + }; + + // Current version is not a version number, so we can't tell if it's the newest version. Abort. + if (!/v(\d+\.)*\d+/.test(window.DOCUMENTER_CURRENT_VERSION)) { + return + }; + + // Current version is newest version, so no need to add a warning. + if (window.DOCUMENTER_NEWEST === window.DOCUMENTER_CURRENT_VERSION) { + return + }; + + // Add a noindex meta tag (unless one exists) so that search engines don't index this version of the docs. + if (document.body.querySelector('meta[name="robots"]') === null) { + const meta = document.createElement('meta'); + meta.name = 'robots'; + meta.content = 'noindex'; + + document.getElementsByTagName('head')[0].appendChild(meta); + }; + + const div = document.createElement('div'); + div.classList.add('outdated-warning-overlay'); + const closer = document.createElement('button'); + closer.classList.add('outdated-warning-closer', 'delete'); + closer.addEventListener('click', function () { + document.body.removeChild(div); + }); + const href = window.documenterBaseURL + '/../' + window.DOCUMENTER_STABLE; + div.innerHTML = 'This documentation is not for the latest version.
    Go to the latest documentation.'; + div.appendChild(closer); + document.body.appendChild(div); +}; + +if (document.readyState === 'loading') { + document.addEventListener('DOMContentLoaded', maybeAddWarning); +} else { + maybeAddWarning(); +}; diff --git a/dev/index.html b/dev/index.html index 71ba900..7f96643 100644 --- a/dev/index.html +++ b/dev/index.html @@ -1,2 +1,2 @@ -Home · XAM.jl

    XAM.jl

    Project Status: Active – The project has reached a stable, usable state and is being actively developed. Latest Release MIT license Stable documentation Latest documentation Join the chat at https://gitter.im/BioJulia/XAM.jl

    This project follows the semver pro forma and uses the git-flow branching model.

    Description

    The XAM package provides I/O and utilities for manipulating SAM and BAM formatted alignment map files.

    Installation

    You can install the XAM package from the Julia REPL. Press ] to enter pkg mode, then enter the following command:

    add XAM

    If you are interested in the cutting edge of the development, please check out the develop branch to try new features before release.

    Testing

    XAM is tested against Julia 1.X on Linux, OS X, and Windows.

    Latest build status:

    Unit tests Documentation codecov

    Contributing

    We appreciate contributions from users including reporting bugs, fixing issues, improving performance and adding new features.

    Take a look at the contributing files detailed contributor and maintainer guidelines, and code of conduct.

    Financial contributions

    We also welcome financial contributions in full transparency on our open collective. Anyone can file an expense. If the expense makes sense for the development the core contributors and the person who filed the expense will be reimbursed.

    Backers & Sponsors

    Thank you to all our backers and sponsors!

    Love our work and community? Become a backer.

    backers

    Does your company use BioJulia? Help keep BioJulia feature rich and healthy by sponsoring the project. Your logo will show up here with a link to your website.

    Questions?

    If you have a question about contributing or using BioJulia software, come on over and chat to us on Gitter, or you can try the Bio category of the Julia discourse site.

    +Home · XAM.jl

    XAM.jl

    Project Status: Active – The project has reached a stable, usable state and is being actively developed. Latest Release MIT license Stable documentation Latest documentation Join the chat at https://gitter.im/BioJulia/XAM.jl

    This project follows the semver pro forma and uses the git-flow branching model.

    Description

    The XAM package provides I/O and utilities for manipulating SAM and BAM formatted alignment map files.

    Installation

    You can install the XAM package from the Julia REPL. Press ] to enter pkg mode, then enter the following command:

    add XAM

    If you are interested in the cutting edge of the development, please check out the develop branch to try new features before release.

    Testing

    XAM is tested against Julia 1.X on Linux, OS X, and Windows.

    Latest build status:

    Unit tests Documentation codecov

    Contributing

    We appreciate contributions from users including reporting bugs, fixing issues, improving performance and adding new features.

    Take a look at the contributing files detailed contributor and maintainer guidelines, and code of conduct.

    Financial contributions

    We also welcome financial contributions in full transparency on our open collective. Anyone can file an expense. If the expense makes sense for the development the core contributors and the person who filed the expense will be reimbursed.

    Backers & Sponsors

    Thank you to all our backers and sponsors!

    Love our work and community? Become a backer.

    backers

    Does your company use BioJulia? Help keep BioJulia feature rich and healthy by sponsoring the project. Your logo will show up here with a link to your website.

    Questions?

    If you have a question about contributing or using BioJulia software, come on over and chat to us on Gitter, or you can try the Bio category of the Julia discourse site.

    diff --git a/dev/man/api/index.html b/dev/man/api/index.html index 82c7b03..6874641 100644 --- a/dev/man/api/index.html +++ b/dev/man/api/index.html @@ -1,5 +1,5 @@ -API Reference · XAM.jl

    API Reference

    SAM API

    Public

    XAM.SAM.MetaInfoMethod
    MetaInfo(tag::AbstractString, value)

    Create a SAM metainfo with tag and value.

    tag is a two-byte ASCII string. If tag is "CO", value must be a string; otherwise, value is an iterable object with key and value pairs.

    Examples

    julia> SAM.MetaInfo("CO", "some comment")
    +API Reference · XAM.jl

    API Reference

    SAM API

    Public

    XAM.SAM.MetaInfoMethod
    MetaInfo(tag::AbstractString, value)

    Create a SAM metainfo with tag and value.

    tag is a two-byte ASCII string. If tag is "CO", value must be a string; otherwise, value is an iterable object with key and value pairs.

    Examples

    julia> SAM.MetaInfo("CO", "some comment")
     BioAlignments.SAM.MetaInfo:
         tag: CO
       value: some comment
    @@ -13,7 +13,7 @@ BioAlignments.SAM.MetaInfo:
       value: SN=chr1 LN=12345
     
     julia> string(ans)
    -"@SQ	SN:chr1	LN:12345"
    source
    XAM.SAM.MetaInfoMethod
    MetaInfo(str::AbstractString)

    Create a SAM metainfo from str.

    Examples

    julia> SAM.MetaInfo("@CO	some comment")
    +"@SQ	SN:chr1	LN:12345"
    source
    XAM.SAM.MetaInfoMethod
    MetaInfo(str::AbstractString)

    Create a SAM metainfo from str.

    Examples

    julia> SAM.MetaInfo("@CO	some comment")
     BioAlignments.SAM.MetaInfo:
         tag: CO
       value: some comment
    @@ -21,4 +21,4 @@ BioAlignments.SAM.MetaInfo:
     julia> SAM.MetaInfo("@SQ	SN:chr1	LN:12345")
     BioAlignments.SAM.MetaInfo:
         tag: SQ
    -  value: SN=chr1 LN=12345
    source
    XAM.SAM.ReaderMethod
    SAM.Reader(input::IO)

    Create a data reader of the SAM file format.

    Arguments

    • input: data source
    source
    XAM.SAM.RecordMethod
    SAM.Record(str::AbstractString)

    Create a SAM record from str. This function verifies the format and indexes fields for accessors.

    source
    XAM.SAM.RecordMethod
    SAM.Record(data::Vector{UInt8})

    Create a SAM record from data. This function verifies the format and indexes fields for accessors. Note that the ownership of data is transferred to a new record object.

    source
    XAM.SAM.WriterType
    Writer(output::IO, header::Header=Header())

    Create a data writer of the SAM file format.

    Arguments

    • output: data sink
    • header=Header(): SAM header object
    source
    Base.findallMethod
    find(header::Header, key::AbstractString)::Vector{MetaInfo}

    Find metainfo objects satisfying SAM.tag(metainfo) == key.

    source
    Base.read!Method
    read!(rdr::Reader, rec::Record)

    Read a Record into rec; overwriting or adding to existing field values. It is assumed that rec is already initialized or empty.

    source
    XAM.SAM.auxdataMethod
    auxdata(record::Record)::Dict{String,Any}

    Get the auxiliary data (optional fields) of record.

    source
    XAM.SAM.iscommentMethod
    iscomment(metainfo::MetaInfo)::Bool

    Test if metainfo is a comment (i.e. its tag is "CO").

    source
    XAM.SAM.isprimaryMethod
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.SAM.keyvaluesMethod
    keyvalues(metainfo::MetaInfo)::Vector{Pair{String,String}}

    Get the values of metainfo as string pairs.

    source
    XAM.SAM.nextrefnameMethod
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.SAM.positionMethod
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.SAM.qualityMethod
    quality(::Type{String}, record::Record)::String

    Get the ASCII-encoded base quality of record.

    source
    XAM.SAM.qualityMethod
    quality(record::Record)::Vector{UInt8}

    Get the Phred-scaled base quality of record.

    source
    XAM.SAM.refnameMethod
    refname(record::Record)::String

    Get the reference sequence name of record.

    source
    XAM.SAM.sequenceMethod
    sequence(::Type{String}, record::Record)::String

    Get the segment sequence of record as String.

    source
    XAM.SAM.sequenceMethod
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source
    XAM.SAM.valueMethod
    value(metainfo::MetaInfo)::String

    Get the value of metainfo as a string.

    source

    Internal

    BAM API

    Public

    XAM.BAM.BAIMethod
    BAI(filename::AbstractString)

    Load a BAI index from filename.

    source
    XAM.BAM.ReaderType
    BAM.Reader(input::IO; index=nothing)

    Create a data reader of the BAM file format.

    Arguments

    • input: data source
    • index=nothing: filepath to a random access index (currently bai is supported)
    source
    XAM.BAM.WriterType
    BAM.Writer(output::BGZFStream, header::SAM.Header)

    Create a data writer of the BAM file format.

    Arguments

    • output: data sink
    • header: SAM header object
    source
    BioGenerics.headerMethod
    header(reader::Reader; fillSQ::Bool=false)::SAM.Header

    Get the header of reader.

    If fillSQ is true, this function fills missing "SQ" metainfo in the header.

    source
    XAM.BAM.cigarFunction
    cigar(record::Record)::String

    Get the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar_rle.

    source
    XAM.BAM.cigar_rleFunction
    cigar_rle(record::Record, checkCG::Bool = true)::Tuple{Vector{BioAlignments.Operation},Vector{Int}}

    Get a run-length encoded tuple (ops, lens) of the CIGAR string in record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar.

    source
    XAM.BAM.ispositivestrandMethod
    ispositivestrand(record::Record)::Bool

    Test if record is aligned to the positive strand.

    This is equivalent to flag(record) & 0x10 == 0.

    source
    XAM.BAM.isprimaryMethod
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.BAM.n_cigar_opFunction
    n_cigar_op(record::Record, checkCG::Bool = true)

    Return the number of operations in the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the number of operations in the true cigar string, because this is probably what you want, the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to get the number of operations in the cigar field of the BAM record, then set checkCG to false.

    source
    XAM.BAM.nextpositionMethod
    nextposition(record::Record)::Int

    Get the 1-based leftmost mapping position of the next/mate read of record.

    source
    XAM.BAM.nextrefnameMethod
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.BAM.positionMethod
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.BAM.refidMethod
    refid(record::Record)::Int

    Get the reference sequence ID of record.

    The ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.

    See also: BAM.rname

    source
    XAM.BAM.reflenMethod
    reflen(record::Record)::Int

    Get the length of the reference sequence this record applies to.

    source
    XAM.BAM.refnameMethod
    refname(record::Record)::String

    Get the reference sequence name of record.

    See also: BAM.refid

    source
    XAM.BAM.sequenceMethod
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source

    Internal

    + value: SN=chr1 LN=12345
    source
    XAM.SAM.ReaderMethod
    SAM.Reader(input::IO)

    Create a data reader of the SAM file format.

    Arguments

    • input: data source
    source
    XAM.SAM.RecordMethod
    SAM.Record(str::AbstractString)

    Create a SAM record from str. This function verifies the format and indexes fields for accessors.

    source
    XAM.SAM.RecordMethod
    SAM.Record(data::Vector{UInt8})

    Create a SAM record from data. This function verifies the format and indexes fields for accessors. Note that the ownership of data is transferred to a new record object.

    source
    XAM.SAM.WriterType
    Writer(output::IO, header::Header=Header())

    Create a data writer of the SAM file format.

    Arguments

    • output: data sink
    • header=Header(): SAM header object
    source
    Base.findallMethod
    find(header::Header, key::AbstractString)::Vector{MetaInfo}

    Find metainfo objects satisfying SAM.tag(metainfo) == key.

    source
    Base.read!Method
    read!(rdr::Reader, rec::Record)

    Read a Record into rec; overwriting or adding to existing field values. It is assumed that rec is already initialized or empty.

    source
    XAM.SAM.auxdataMethod
    auxdata(record::Record)::Dict{String,Any}

    Get the auxiliary data (optional fields) of record.

    source
    XAM.SAM.iscommentMethod
    iscomment(metainfo::MetaInfo)::Bool

    Test if metainfo is a comment (i.e. its tag is "CO").

    source
    XAM.SAM.isprimaryMethod
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.SAM.keyvaluesMethod
    keyvalues(metainfo::MetaInfo)::Vector{Pair{String,String}}

    Get the values of metainfo as string pairs.

    source
    XAM.SAM.nextrefnameMethod
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.SAM.positionMethod
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.SAM.qualityMethod
    quality(::Type{String}, record::Record)::String

    Get the ASCII-encoded base quality of record.

    source
    XAM.SAM.qualityMethod
    quality(record::Record)::Vector{UInt8}

    Get the Phred-scaled base quality of record.

    source
    XAM.SAM.refnameMethod
    refname(record::Record)::String

    Get the reference sequence name of record.

    source
    XAM.SAM.sequenceMethod
    sequence(::Type{String}, record::Record)::String

    Get the segment sequence of record as String.

    source
    XAM.SAM.sequenceMethod
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source
    XAM.SAM.valueMethod
    value(metainfo::MetaInfo)::String

    Get the value of metainfo as a string.

    source

    Internal

    BAM API

    Public

    XAM.BAM.BAIMethod
    BAI(filename::AbstractString)

    Load a BAI index from filename.

    source
    XAM.BAM.ReaderType
    BAM.Reader(input::IO; index=nothing)

    Create a data reader of the BAM file format.

    Arguments

    • input: data source
    • index=nothing: filepath to a random access index (currently bai is supported)
    source
    XAM.BAM.WriterType
    BAM.Writer(output::BGZFStream, header::SAM.Header)

    Create a data writer of the BAM file format.

    Arguments

    • output: data sink
    • header: SAM header object
    source
    BioGenerics.headerMethod
    header(reader::Reader; fillSQ::Bool=false)::SAM.Header

    Get the header of reader.

    If fillSQ is true, this function fills missing "SQ" metainfo in the header.

    source
    XAM.BAM.cigarFunction
    cigar(record::Record)::String

    Get the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar_rle.

    source
    XAM.BAM.cigar_rleFunction
    cigar_rle(record::Record, checkCG::Bool = true)::Tuple{Vector{BioAlignments.Operation},Vector{Int}}

    Get a run-length encoded tuple (ops, lens) of the CIGAR string in record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar.

    source
    XAM.BAM.ispositivestrandMethod
    ispositivestrand(record::Record)::Bool

    Test if record is aligned to the positive strand.

    This is equivalent to flag(record) & 0x10 == 0.

    source
    XAM.BAM.isprimaryMethod
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.BAM.n_cigar_opFunction
    n_cigar_op(record::Record, checkCG::Bool = true)

    Return the number of operations in the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the number of operations in the true cigar string, because this is probably what you want, the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to get the number of operations in the cigar field of the BAM record, then set checkCG to false.

    source
    XAM.BAM.nextpositionMethod
    nextposition(record::Record)::Int

    Get the 1-based leftmost mapping position of the next/mate read of record.

    source
    XAM.BAM.nextrefnameMethod
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.BAM.positionMethod
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.BAM.refidMethod
    refid(record::Record)::Int

    Get the reference sequence ID of record.

    The ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.

    See also: BAM.rname

    source
    XAM.BAM.reflenMethod
    reflen(record::Record)::Int

    Get the length of the reference sequence this record applies to.

    source
    XAM.BAM.refnameMethod
    refname(record::Record)::String

    Get the reference sequence name of record.

    See also: BAM.refid

    source
    XAM.BAM.sequenceMethod
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source

    Internal

    diff --git a/dev/man/hts-files/index.html b/dev/man/hts-files/index.html index 2d0e3f0..bd5de84 100644 --- a/dev/man/hts-files/index.html +++ b/dev/man/hts-files/index.html @@ -1,12 +1,12 @@ -SAM and BAM · XAM.jl

    SAM and BAM

    Introduction

    The XAM package offers high-performance tools for SAM and BAM file formats, which are the most popular file formats.

    If you have questions about the SAM and BAM formats or any of the terminology used when discussing these formats, see the published specification, which is maintained by the samtools group.

    A very very simple SAM file looks like the following:

    @HD VN:1.6 SO:coordinate
    +SAM and BAM · XAM.jl

    SAM and BAM

    Introduction

    The XAM package offers high-performance tools for SAM and BAM file formats, which are the most popular file formats.

    If you have questions about the SAM and BAM formats or any of the terminology used when discussing these formats, see the published specification, which is maintained by the samtools group.

    A very very simple SAM file looks like the following:

    @HD VN:1.6 SO:coordinate
     @SQ SN:ref LN:45
     r001   99 ref  7 30 8M2I4M1D3M = 37  39 TTAGATAAAGGATACTG *
     r002    0 ref  9 30 3S6M1P1I4M *  0   0 AAAAGATAAGGATA    *
     r003    0 ref  9 30 5S6M       *  0   0 GCCTAAGCTAA       * SA:Z:ref,29,-,6H5M,17,0;
     r004    0 ref 16 30 6M14N5M    *  0   0 ATAGCTTCAGC       *
     r003 2064 ref 29 17 6H5M       *  0   0 TAGGC             * SA:Z:ref,9,+,5S6M,30,1;
    -r001  147 ref 37 30 9M         =  7 -39 CAGCGGCAT         * NM:i:1

    Where the first two lines are part of the "header", and the following lines are "records". Each record describes how a read aligns to some reference sequence. Sometimes one record describes one read, but there are other cases like chimeric reads and split alignments, where multiple records apply to one read. In the example above, r003 is a chimeric read, and r004 is a split alignment, and r001 are mate pair reads. Again, we refer you to the official specification for more details.

    A BAM file stores this same information but in a binary and compressible format that does not make for pretty printing here!

    Reading SAM and BAM files

    A typical script iterating over all records in a file looks like below:

    using XAM
    +r001  147 ref 37 30 9M         =  7 -39 CAGCGGCAT         * NM:i:1

    Where the first two lines are part of the "header", and the following lines are "records". Each record describes how a read aligns to some reference sequence. Sometimes one record describes one read, but there are other cases like chimeric reads and split alignments, where multiple records apply to one read. In the example above, r003 is a chimeric read, and r004 is a split alignment, and r001 are mate pair reads. Again, we refer you to the official specification for more details.

    A BAM file stores this same information but in a binary and compressible format that does not make for pretty printing here!

    Reading SAM and BAM files

    A typical script iterating over all records in a file looks like below:

    using XAM
     
     # Open a BAM file.
     reader = open(BAM.Reader, "data.bam")
    @@ -27,7 +27,7 @@ while !eof(reader)
         empty!(record)
         read!(reader, record)
         # do something
    -end

    SAM and BAM Headers

    Both SAM.Reader and BAM.Reader implement the header function, which returns a SAM.Header object. To extract certain information out of the headers, you can use the find method on the header to extract information according to SAM/BAM tag. Again we refer you to the specification for full details of all the different tags that can occur in headers, and what they mean.

    Below is an example of extracting all the info about the reference sequences from the BAM header. In SAM/BAM, any description of a reference sequence is stored in the header, under a tag denoted SQ (think reference SeQuence!).

    julia> reader = open(SAM.Reader, "data.sam");
    +end

    SAM and BAM Headers

    Both SAM.Reader and BAM.Reader implement the header function, which returns a SAM.Header object. To extract certain information out of the headers, you can use the find method on the header to extract information according to SAM/BAM tag. Again we refer you to the specification for full details of all the different tags that can occur in headers, and what they mean.

    Below is an example of extracting all the info about the reference sequences from the BAM header. In SAM/BAM, any description of a reference sequence is stored in the header, under a tag denoted SQ (think reference SeQuence!).

    julia> reader = open(SAM.Reader, "data.sam");
     
     julia> find(header(reader), "SQ")
     7-element Array{Bio.Align.SAM.MetaInfo,1}:
    @@ -52,17 +52,17 @@ julia> find(header(reader), "SQ")
      Bio.Align.SAM.MetaInfo:
         tag: SQ
       value: SN=mitochondria LN=366924
    -

    In the above we can see there were 7 sequences in the reference: 5 chromosomes, one chloroplast sequence, and one mitochondrial sequence.

    SAM and BAM Records

    SAM.Record

    The XAM package supports the following accessors for SAM.Record types.

    XAM.SAM.flagFunction
    flag(record::Record)::UInt16

    Get the bitwise flag of record.

    source
    XAM.SAM.isprimaryFunction
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.SAM.refnameFunction
    refname(record::Record)::String

    Get the reference sequence name of record.

    source
    XAM.SAM.positionFunction
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.SAM.nextrefnameFunction
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.SAM.sequenceFunction
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source
    sequence(::Type{String}, record::Record)::String

    Get the segment sequence of record as String.

    source
    XAM.SAM.qualityFunction
    quality(record::Record)::Vector{UInt8}

    Get the Phred-scaled base quality of record.

    source
    quality(::Type{String}, record::Record)::String

    Get the ASCII-encoded base quality of record.

    source
    XAM.SAM.auxdataFunction
    auxdata(record::Record)::Dict{String,Any}

    Get the auxiliary data (optional fields) of record.

    source

    BAM.Record

    The XAM package supports the following accessors for BAM.Record types.

    XAM.BAM.flagFunction
    flag(record::Record)::UInt16

    Get the bitwise flag of record.

    source
    XAM.BAM.isprimaryFunction
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.BAM.refidFunction
    refid(record::Record)::Int

    Get the reference sequence ID of record.

    The ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.

    See also: BAM.rname

    source
    XAM.BAM.refnameFunction
    refname(record::Record)::String

    Get the reference sequence name of record.

    See also: BAM.refid

    source
    XAM.BAM.reflenFunction
    reflen(record::Record)::Int

    Get the length of the reference sequence this record applies to.

    source
    XAM.BAM.positionFunction
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.BAM.nextrefidFunction
    nextrefid(record::Record)::Int

    Get the next/mate reference sequence ID of record.

    source
    XAM.BAM.nextrefnameFunction
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.BAM.nextpositionFunction
    nextposition(record::Record)::Int

    Get the 1-based leftmost mapping position of the next/mate read of record.

    source
    XAM.BAM.cigarFunction
    cigar(record::Record)::String

    Get the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar_rle.

    source
    XAM.BAM.sequenceFunction
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source

    Accessing auxiliary data

    SAM and BAM records support the storing of optional data fields associated with tags.

    Tagged auxiliary data follows a format of TAG:TYPE:VALUE. TAG is a two-letter string, and each tag can only appear once per record. TYPE is a single case-sensetive letter which defined the format of VALUE.

    TypeDescription
    'A'Printable character
    'i'Signed integer
    'f'Single-precision floating number
    'Z'Printable string, including space
    'H'Byte array in Hex format
    'B'Integer of numeric array

    For more information about these tags and their types we refer you to the SAM/BAM specification and the additional optional fields specification document.

    There are some tags that are reserved, predefined standard tags, for specific uses.

    To access optional fields stored in tags, you use getindex indexing syntax on the record object. Note that accessing optional tag fields will result in type instability in Julia. This is because the type of the optional data is not known until run-time, as the tag is being read. This can have a significant impact on performance. To limit this, if the user knows the type of a value in advance, specifying it as a type annotation will alleviate the problem:

    Below is an example of looping over records in a bam file and using indexing syntax to get the data stored in the "NM" tag. Note the UInt8 type assertion to alleviate type instability.

    for record in open(BAM.Reader, "data.bam")
    +

    In the above we can see there were 7 sequences in the reference: 5 chromosomes, one chloroplast sequence, and one mitochondrial sequence.

    SAM and BAM Records

    SAM.Record

    The XAM package supports the following accessors for SAM.Record types.

    XAM.SAM.flagFunction
    flag(record::Record)::UInt16

    Get the bitwise flag of record.

    source
    XAM.SAM.isprimaryFunction
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.SAM.refnameFunction
    refname(record::Record)::String

    Get the reference sequence name of record.

    source
    XAM.SAM.positionFunction
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.SAM.nextrefnameFunction
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.SAM.sequenceFunction
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source
    sequence(::Type{String}, record::Record)::String

    Get the segment sequence of record as String.

    source
    XAM.SAM.qualityFunction
    quality(record::Record)::Vector{UInt8}

    Get the Phred-scaled base quality of record.

    source
    quality(::Type{String}, record::Record)::String

    Get the ASCII-encoded base quality of record.

    source
    XAM.SAM.auxdataFunction
    auxdata(record::Record)::Dict{String,Any}

    Get the auxiliary data (optional fields) of record.

    source

    BAM.Record

    The XAM package supports the following accessors for BAM.Record types.

    XAM.BAM.flagFunction
    flag(record::Record)::UInt16

    Get the bitwise flag of record.

    source
    XAM.BAM.isprimaryFunction
    isprimary(record::Record)::Bool

    Test if record is a primary line of the read.

    This is equivalent to flag(record) & 0x900 == 0.

    source
    XAM.BAM.refidFunction
    refid(record::Record)::Int

    Get the reference sequence ID of record.

    The ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.

    See also: BAM.rname

    source
    XAM.BAM.refnameFunction
    refname(record::Record)::String

    Get the reference sequence name of record.

    See also: BAM.refid

    source
    XAM.BAM.reflenFunction
    reflen(record::Record)::Int

    Get the length of the reference sequence this record applies to.

    source
    XAM.BAM.positionFunction
    position(record::Record)::Int

    Get the 1-based leftmost mapping position of record.

    source
    XAM.BAM.nextrefidFunction
    nextrefid(record::Record)::Int

    Get the next/mate reference sequence ID of record.

    source
    XAM.BAM.nextrefnameFunction
    nextrefname(record::Record)::String

    Get the reference name of the mate/next read of record.

    source
    XAM.BAM.nextpositionFunction
    nextposition(record::Record)::Int

    Get the 1-based leftmost mapping position of the next/mate read of record.

    source
    XAM.BAM.cigarFunction
    cigar(record::Record)::String

    Get the CIGAR string of record.

    Note that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.

    Calling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.

    If you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.

    See also BAM.cigar_rle.

    source
    XAM.BAM.sequenceFunction
    sequence(record::Record)::BioSequences.LongDNASeq

    Get the segment sequence of record.

    source

    Accessing auxiliary data

    SAM and BAM records support the storing of optional data fields associated with tags.

    Tagged auxiliary data follows a format of TAG:TYPE:VALUE. TAG is a two-letter string, and each tag can only appear once per record. TYPE is a single case-sensetive letter which defined the format of VALUE.

    TypeDescription
    'A'Printable character
    'i'Signed integer
    'f'Single-precision floating number
    'Z'Printable string, including space
    'H'Byte array in Hex format
    'B'Integer of numeric array

    For more information about these tags and their types we refer you to the SAM/BAM specification and the additional optional fields specification document.

    There are some tags that are reserved, predefined standard tags, for specific uses.

    To access optional fields stored in tags, you use getindex indexing syntax on the record object. Note that accessing optional tag fields will result in type instability in Julia. This is because the type of the optional data is not known until run-time, as the tag is being read. This can have a significant impact on performance. To limit this, if the user knows the type of a value in advance, specifying it as a type annotation will alleviate the problem:

    Below is an example of looping over records in a bam file and using indexing syntax to get the data stored in the "NM" tag. Note the UInt8 type assertion to alleviate type instability.

    for record in open(BAM.Reader, "data.bam")
         nm = record["NM"]::UInt8
         # do something
    -end

    Getting records in a range

    The XAM package supports the BAI index to fetch records in a specific range from a BAM file. Samtools provides index subcommand to create an index file (.bai) from a sorted BAM file.

    $ samtools index -b SRR1238088.sort.bam
    +end

    Getting records in a range

    The XAM package supports the BAI index to fetch records in a specific range from a BAM file. Samtools provides index subcommand to create an index file (.bai) from a sorted BAM file.

    $ samtools index -b SRR1238088.sort.bam
     $ ls SRR1238088.sort.bam*
     SRR1238088.sort.bam     SRR1238088.sort.bam.bai

    The method eachoverlap(reader, chrom, range) returns an iterator of BAM records overlapping the query interval:

    reader = open(BAM.Reader, "SRR1238088.sort.bam", index="SRR1238088.sort.bam.bai")
     for record in eachoverlap(reader, "Chr2", 10000:11000)
         # `record` is a BAM.Record object
         # ...
     end
    -close(reader)

    Getting records overlapping genomic features

    The eachoverlap method also accepts the Interval type defined in GenomicFeatures.jl.

    This allows you to do things like first read in the genomic features from a GFF3 file, and then for each feature, iterate over all the BAM records that overlap with that feature.

    using GenomicFeatures
    +close(reader)

    Getting records overlapping genomic features

    The eachoverlap method also accepts the Interval type defined in GenomicFeatures.jl.

    This allows you to do things like first read in the genomic features from a GFF3 file, and then for each feature, iterate over all the BAM records that overlap with that feature.

    using GenomicFeatures
     using GFF3
     using XAM
     
    @@ -80,7 +80,7 @@ for feature in features
             # ...
         end
     end
    -close(reader)

    Writing files

    In order to write a BAM or SAM file, you must first create a SAM.Header.

    A SAM.Header is constructed from a vector of SAM.MetaInfo objects.

    For example, to create the following simple header:

    @HD VN:1.6 SO:coordinate
    +close(reader)

    Writing files

    In order to write a BAM or SAM file, you must first create a SAM.Header.

    A SAM.Header is constructed from a vector of SAM.MetaInfo objects.

    For example, to create the following simple header:

    @HD VN:1.6 SO:coordinate
     @SQ SN:ref LN:45
    julia> a = SAM.MetaInfo("HD", ["VN" => 1.6, "SO" => "coordinate"])
     SAM.MetaInfo:
         tag: HD
    @@ -104,4 +104,4 @@ SAM.Writer(IOStream(<file my-data.sam>))
     julia> bamw = BAM.Writer(BGZFStream(open("my-data.bam", "w"), "w"))
     BAM.Writer(BGZFStreams.BGZFStream{IOStream}(<mode=write>))
     

    Once you have a BAM or SAM writer, you can use the write method to write BAM.Records or SAM.Records to file:

    julia> write(bamw, rec) # Here rec is a `BAM.Record`
    -330780
    +330780
    diff --git a/dev/search/index.html b/dev/search/index.html index 405da89..32bba25 100644 --- a/dev/search/index.html +++ b/dev/search/index.html @@ -1,2 +1,2 @@ -Search · XAM.jl

    Loading search...

      +Search · XAM.jl

      Loading search...

        diff --git a/dev/search_index.js b/dev/search_index.js index 12865eb..7df950b 100644 --- a/dev/search_index.js +++ b/dev/search_index.js @@ -1,3 +1,3 @@ var documenterSearchIndex = {"docs": -[{"location":"man/hts-files/#SAM-and-BAM-1","page":"SAM and BAM","title":"SAM and BAM","text":"","category":"section"},{"location":"man/hts-files/#Introduction-1","page":"SAM and BAM","title":"Introduction","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package offers high-performance tools for SAM and BAM file formats, which are the most popular file formats.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"If you have questions about the SAM and BAM formats or any of the terminology used when discussing these formats, see the published specification, which is maintained by the samtools group.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"A very very simple SAM file looks like the following:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"@HD VN:1.6 SO:coordinate\n@SQ SN:ref LN:45\nr001 99 ref 7 30 8M2I4M1D3M = 37 39 TTAGATAAAGGATACTG *\nr002 0 ref 9 30 3S6M1P1I4M * 0 0 AAAAGATAAGGATA *\nr003 0 ref 9 30 5S6M * 0 0 GCCTAAGCTAA * SA:Z:ref,29,-,6H5M,17,0;\nr004 0 ref 16 30 6M14N5M * 0 0 ATAGCTTCAGC *\nr003 2064 ref 29 17 6H5M * 0 0 TAGGC * SA:Z:ref,9,+,5S6M,30,1;\nr001 147 ref 37 30 9M = 7 -39 CAGCGGCAT * NM:i:1","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Where the first two lines are part of the \"header\", and the following lines are \"records\". Each record describes how a read aligns to some reference sequence. Sometimes one record describes one read, but there are other cases like chimeric reads and split alignments, where multiple records apply to one read. In the example above, r003 is a chimeric read, and r004 is a split alignment, and r001 are mate pair reads. Again, we refer you to the official specification for more details.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"A BAM file stores this same information but in a binary and compressible format that does not make for pretty printing here!","category":"page"},{"location":"man/hts-files/#Reading-SAM-and-BAM-files-1","page":"SAM and BAM","title":"Reading SAM and BAM files","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"A typical script iterating over all records in a file looks like below:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"using XAM\n\n# Open a BAM file.\nreader = open(BAM.Reader, \"data.bam\")\n\n# Iterate over BAM records.\nfor record in reader\n # `record` is a BAM.Record object.\n if BAM.ismapped(record)\n # Print the mapped position.\n println(BAM.refname(record), ':', BAM.position(record))\n end\nend\n\n# Close the BAM file.\nclose(reader)","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The size of a BAM file is often extremely large. The iterator interface demonstrated above allocates an object for each record and that may be a bottleneck of reading data from a BAM file. In-place reading reuses a pre-allocated object for every record and less memory allocation happens in reading:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"reader = open(BAM.Reader, \"data.bam\")\nrecord = BAM.Record()\nwhile !eof(reader)\n empty!(record)\n read!(reader, record)\n # do something\nend","category":"page"},{"location":"man/hts-files/#SAM-and-BAM-Headers-1","page":"SAM and BAM","title":"SAM and BAM Headers","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Both SAM.Reader and BAM.Reader implement the header function, which returns a SAM.Header object. To extract certain information out of the headers, you can use the find method on the header to extract information according to SAM/BAM tag. Again we refer you to the specification for full details of all the different tags that can occur in headers, and what they mean.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Below is an example of extracting all the info about the reference sequences from the BAM header. In SAM/BAM, any description of a reference sequence is stored in the header, under a tag denoted SQ (think reference SeQuence!).","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"julia> reader = open(SAM.Reader, \"data.sam\");\n\njulia> find(header(reader), \"SQ\")\n7-element Array{Bio.Align.SAM.MetaInfo,1}:\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr1 LN=30427671\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr2 LN=19698289\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr3 LN=23459830\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr4 LN=18585056\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr5 LN=26975502\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=chloroplast LN=154478\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=mitochondria LN=366924\n","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"In the above we can see there were 7 sequences in the reference: 5 chromosomes, one chloroplast sequence, and one mitochondrial sequence.","category":"page"},{"location":"man/hts-files/#SAM-and-BAM-Records-1","page":"SAM and BAM","title":"SAM and BAM Records","text":"","category":"section"},{"location":"man/hts-files/#SAM.Record-1","page":"SAM and BAM","title":"SAM.Record","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the following accessors for SAM.Record types.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"XAM.SAM.flag\nXAM.SAM.ismapped\nXAM.SAM.isprimary\nXAM.SAM.refname\nXAM.SAM.position\nXAM.SAM.rightposition\nXAM.SAM.isnextmapped\nXAM.SAM.nextrefname\nXAM.SAM.nextposition\nXAM.SAM.mappingquality\nXAM.SAM.cigar\nXAM.SAM.alignment\nXAM.SAM.alignlength\nXAM.SAM.tempname\nXAM.SAM.templength\nXAM.SAM.sequence\nXAM.SAM.seqlength\nXAM.SAM.quality\nXAM.SAM.auxdata","category":"page"},{"location":"man/hts-files/#XAM.SAM.flag","page":"SAM and BAM","title":"XAM.SAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.ismapped","page":"SAM and BAM","title":"XAM.SAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.isprimary","page":"SAM and BAM","title":"XAM.SAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.refname","page":"SAM and BAM","title":"XAM.SAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.position","page":"SAM and BAM","title":"XAM.SAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.rightposition","page":"SAM and BAM","title":"XAM.SAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.isnextmapped","page":"SAM and BAM","title":"XAM.SAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.nextrefname","page":"SAM and BAM","title":"XAM.SAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.nextposition","page":"SAM and BAM","title":"XAM.SAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the position of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.mappingquality","page":"SAM and BAM","title":"XAM.SAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.cigar","page":"SAM and BAM","title":"XAM.SAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.alignment","page":"SAM and BAM","title":"XAM.SAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.alignlength","page":"SAM and BAM","title":"XAM.SAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.tempname","page":"SAM and BAM","title":"XAM.SAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.templength","page":"SAM and BAM","title":"XAM.SAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.sequence","page":"SAM and BAM","title":"XAM.SAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\nsequence(::Type{String}, record::Record)::String\n\nGet the segment sequence of record as String.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.seqlength","page":"SAM and BAM","title":"XAM.SAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.quality","page":"SAM and BAM","title":"XAM.SAM.quality","text":"quality(record::Record)::Vector{UInt8}\n\nGet the Phred-scaled base quality of record.\n\n\n\n\n\nquality(::Type{String}, record::Record)::String\n\nGet the ASCII-encoded base quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.auxdata","page":"SAM and BAM","title":"XAM.SAM.auxdata","text":"auxdata(record::Record)::Dict{String,Any}\n\nGet the auxiliary data (optional fields) of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#BAM.Record-1","page":"SAM and BAM","title":"BAM.Record","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the following accessors for BAM.Record types.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"XAM.BAM.flag\nXAM.BAM.ismapped\nXAM.BAM.isprimary\nXAM.BAM.refid\nXAM.BAM.refname\nXAM.BAM.reflen\nXAM.BAM.position\nXAM.BAM.rightposition\nXAM.BAM.isnextmapped\nXAM.BAM.nextrefid\nXAM.BAM.nextrefname\nXAM.BAM.nextposition\nXAM.BAM.mappingquality\nXAM.BAM.cigar\nXAM.BAM.alignment\nXAM.BAM.alignlength\nXAM.BAM.tempname\nXAM.BAM.templength\nXAM.BAM.sequence\nXAM.BAM.seqlength\nXAM.BAM.quality\nXAM.BAM.auxdata","category":"page"},{"location":"man/hts-files/#XAM.BAM.flag","page":"SAM and BAM","title":"XAM.BAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.ismapped","page":"SAM and BAM","title":"XAM.BAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.isprimary","page":"SAM and BAM","title":"XAM.BAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.refid","page":"SAM and BAM","title":"XAM.BAM.refid","text":"refid(record::Record)::Int\n\nGet the reference sequence ID of record.\n\nThe ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.\n\nSee also: BAM.rname\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.refname","page":"SAM and BAM","title":"XAM.BAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\nSee also: BAM.refid\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.reflen","page":"SAM and BAM","title":"XAM.BAM.reflen","text":"reflen(record::Record)::Int\n\nGet the length of the reference sequence this record applies to.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.position","page":"SAM and BAM","title":"XAM.BAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.rightposition","page":"SAM and BAM","title":"XAM.BAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.isnextmapped","page":"SAM and BAM","title":"XAM.BAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextrefid","page":"SAM and BAM","title":"XAM.BAM.nextrefid","text":"nextrefid(record::Record)::Int\n\nGet the next/mate reference sequence ID of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextrefname","page":"SAM and BAM","title":"XAM.BAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextposition","page":"SAM and BAM","title":"XAM.BAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the 1-based leftmost mapping position of the next/mate read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.mappingquality","page":"SAM and BAM","title":"XAM.BAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.cigar","page":"SAM and BAM","title":"XAM.BAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar_rle.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.alignment","page":"SAM and BAM","title":"XAM.BAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.alignlength","page":"SAM and BAM","title":"XAM.BAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.tempname","page":"SAM and BAM","title":"XAM.BAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.templength","page":"SAM and BAM","title":"XAM.BAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.sequence","page":"SAM and BAM","title":"XAM.BAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.seqlength","page":"SAM and BAM","title":"XAM.BAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.quality","page":"SAM and BAM","title":"XAM.BAM.quality","text":"quality(record::Record)\n\nGet the base quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.auxdata","page":"SAM and BAM","title":"XAM.BAM.auxdata","text":"auxdata(record::Record)::BAM.AuxData\n\nGet the auxiliary data of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#Accessing-auxiliary-data-1","page":"SAM and BAM","title":"Accessing auxiliary data","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"SAM and BAM records support the storing of optional data fields associated with tags.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Tagged auxiliary data follows a format of TAG:TYPE:VALUE. TAG is a two-letter string, and each tag can only appear once per record. TYPE is a single case-sensetive letter which defined the format of VALUE.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Type Description\n'A' Printable character\n'i' Signed integer\n'f' Single-precision floating number\n'Z' Printable string, including space\n'H' Byte array in Hex format\n'B' Integer of numeric array","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"For more information about these tags and their types we refer you to the SAM/BAM specification and the additional optional fields specification document.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"There are some tags that are reserved, predefined standard tags, for specific uses.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"To access optional fields stored in tags, you use getindex indexing syntax on the record object. Note that accessing optional tag fields will result in type instability in Julia. This is because the type of the optional data is not known until run-time, as the tag is being read. This can have a significant impact on performance. To limit this, if the user knows the type of a value in advance, specifying it as a type annotation will alleviate the problem:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Below is an example of looping over records in a bam file and using indexing syntax to get the data stored in the \"NM\" tag. Note the UInt8 type assertion to alleviate type instability.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"for record in open(BAM.Reader, \"data.bam\")\n nm = record[\"NM\"]::UInt8\n # do something\nend","category":"page"},{"location":"man/hts-files/#Getting-records-in-a-range-1","page":"SAM and BAM","title":"Getting records in a range","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the BAI index to fetch records in a specific range from a BAM file. Samtools provides index subcommand to create an index file (.bai) from a sorted BAM file.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"$ samtools index -b SRR1238088.sort.bam\n$ ls SRR1238088.sort.bam*\nSRR1238088.sort.bam SRR1238088.sort.bam.bai","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The method eachoverlap(reader, chrom, range) returns an iterator of BAM records overlapping the query interval:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"reader = open(BAM.Reader, \"SRR1238088.sort.bam\", index=\"SRR1238088.sort.bam.bai\")\nfor record in eachoverlap(reader, \"Chr2\", 10000:11000)\n # `record` is a BAM.Record object\n # ...\nend\nclose(reader)","category":"page"},{"location":"man/hts-files/#Getting-records-overlapping-genomic-features-1","page":"SAM and BAM","title":"Getting records overlapping genomic features","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"The eachoverlap method also accepts the Interval type defined in GenomicFeatures.jl.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"This allows you to do things like first read in the genomic features from a GFF3 file, and then for each feature, iterate over all the BAM records that overlap with that feature.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"using GenomicFeatures\nusing GFF3\nusing XAM\n\n# Load genomic features from a GFF3 file.\nfeatures = open(collect, GFF3.Reader, \"TAIR10_GFF3_genes.gff\")\n\n# Keep mRNA features.\nfilter!(x -> GFF3.featuretype(x) == \"mRNA\", features)\n\n# Open a BAM file and iterate over records overlapping mRNA transcripts.\nreader = open(BAM.Reader, \"SRR1238088.sort.bam\", index = \"SRR1238088.sort.bam.bai\")\nfor feature in features\n for record in eachoverlap(reader, feature)\n # `record` overlaps `feature`.\n # ...\n end\nend\nclose(reader)","category":"page"},{"location":"man/hts-files/#Writing-files-1","page":"SAM and BAM","title":"Writing files","text":"","category":"section"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"In order to write a BAM or SAM file, you must first create a SAM.Header.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"A SAM.Header is constructed from a vector of SAM.MetaInfo objects.","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"For example, to create the following simple header:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"@HD VN:1.6 SO:coordinate\n@SQ SN:ref LN:45","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"julia> a = SAM.MetaInfo(\"HD\", [\"VN\" => 1.6, \"SO\" => \"coordinate\"])\nSAM.MetaInfo:\n tag: HD\n value: VN=1.6 SO=coordinate\n\njulia> b = SAM.MetaInfo(\"SQ\", [\"SN\" => \"ref\", \"LN\" => 45])\nSAM.MetaInfo:\n tag: SQ\n value: SN=ref LN=45\n\njulia> h = SAM.Header([a, b])\nSAM.Header(SAM.MetaInfo[SAM.MetaInfo:\n tag: HD\n value: VN=1.6 SO=coordinate, SAM.MetaInfo:\n tag: SQ\n value: SN=ref LN=45])\n","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Then to create the writer for a SAM file, construct a SAM.Writer using the header and an IO type:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"julia> samw = SAM.Writer(open(\"my-data.sam\", \"w\"), h)\nSAM.Writer(IOStream())\n","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"To make a BAM Writer is slightly different, as you need to use a specific stream type from the https://github.com/BioJulia/BGZFStreams.jl package:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"julia> using BGZFStreams\n\njulia> bamw = BAM.Writer(BGZFStream(open(\"my-data.bam\", \"w\"), \"w\"))\nBAM.Writer(BGZFStreams.BGZFStream{IOStream}())\n","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"Once you have a BAM or SAM writer, you can use the write method to write BAM.Records or SAM.Records to file:","category":"page"},{"location":"man/hts-files/#","page":"SAM and BAM","title":"SAM and BAM","text":"julia> write(bamw, rec) # Here rec is a `BAM.Record`\n330780","category":"page"},{"location":"#XAM.jl-1","page":"Home","title":"XAM.jl","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"(Image: Project Status: Active – The project has reached a stable, usable state and is being actively developed.) (Image: Latest Release) (Image: MIT license) (Image: Stable documentation) (Image: Latest documentation) (Image: Join the chat at https://gitter.im/BioJulia/XAM.jl)","category":"page"},{"location":"#","page":"Home","title":"Home","text":"This project follows the semver pro forma and uses the git-flow branching model.","category":"page"},{"location":"#Description-1","page":"Home","title":"Description","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"The XAM package provides I/O and utilities for manipulating SAM and BAM formatted alignment map files.","category":"page"},{"location":"#Installation-1","page":"Home","title":"Installation","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"You can install the XAM package from the Julia REPL. Press ] to enter pkg mode, then enter the following command:","category":"page"},{"location":"#","page":"Home","title":"Home","text":"add XAM","category":"page"},{"location":"#","page":"Home","title":"Home","text":"If you are interested in the cutting edge of the development, please check out the develop branch to try new features before release.","category":"page"},{"location":"#Testing-1","page":"Home","title":"Testing","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"XAM is tested against Julia 1.X on Linux, OS X, and Windows.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Latest build status:","category":"page"},{"location":"#","page":"Home","title":"Home","text":"(Image: Unit tests) (Image: Documentation) (Image: codecov)","category":"page"},{"location":"#Contributing-1","page":"Home","title":"Contributing","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"We appreciate contributions from users including reporting bugs, fixing issues, improving performance and adding new features.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Take a look at the contributing files detailed contributor and maintainer guidelines, and code of conduct.","category":"page"},{"location":"#Financial-contributions-1","page":"Home","title":"Financial contributions","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"We also welcome financial contributions in full transparency on our open collective. Anyone can file an expense. If the expense makes sense for the development the core contributors and the person who filed the expense will be reimbursed.","category":"page"},{"location":"#Backers-and-Sponsors-1","page":"Home","title":"Backers & Sponsors","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"Thank you to all our backers and sponsors!","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Love our work and community? Become a backer.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"(Image: backers)","category":"page"},{"location":"#","page":"Home","title":"Home","text":"Does your company use BioJulia? Help keep BioJulia feature rich and healthy by sponsoring the project. Your logo will show up here with a link to your website.","category":"page"},{"location":"#","page":"Home","title":"Home","text":"(Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: )","category":"page"},{"location":"#Questions?-1","page":"Home","title":"Questions?","text":"","category":"section"},{"location":"#","page":"Home","title":"Home","text":"If you have a question about contributing or using BioJulia software, come on over and chat to us on Gitter, or you can try the Bio category of the Julia discourse site.","category":"page"},{"location":"man/api/#","page":"API Reference","title":"API Reference","text":"CurrentModule = XAM\nDocTestSetup = quote\n using XAM\nend","category":"page"},{"location":"man/api/#API-Reference-1","page":"API Reference","title":"API Reference","text":"","category":"section"},{"location":"man/api/#SAM-API-1","page":"API Reference","title":"SAM API","text":"","category":"section"},{"location":"man/api/#Public-1","page":"API Reference","title":"Public","text":"","category":"section"},{"location":"man/api/#","page":"API Reference","title":"API Reference","text":"Modules = [XAM.SAM]\nprivate = false","category":"page"},{"location":"man/api/#XAM.SAM.FLAG_DUP","page":"API Reference","title":"XAM.SAM.FLAG_DUP","text":"0x0400: optical or PCR duplicate\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_MREVERSE","page":"API Reference","title":"XAM.SAM.FLAG_MREVERSE","text":"0x0020: the mate is mapped to the reverse strand\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_MUNMAP","page":"API Reference","title":"XAM.SAM.FLAG_MUNMAP","text":"0x0008: the mate is unmapped\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_PAIRED","page":"API Reference","title":"XAM.SAM.FLAG_PAIRED","text":"0x0001: the read is paired in sequencing, no matter whether it is mapped in a pair\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_PROPER_PAIR","page":"API Reference","title":"XAM.SAM.FLAG_PROPER_PAIR","text":"0x0002: the read is mapped in a proper pair\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_QCFAIL","page":"API Reference","title":"XAM.SAM.FLAG_QCFAIL","text":"0x0200: QC failure\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_READ1","page":"API Reference","title":"XAM.SAM.FLAG_READ1","text":"0x0040: this is read1\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_READ2","page":"API Reference","title":"XAM.SAM.FLAG_READ2","text":"0x0080: this is read2\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_REVERSE","page":"API Reference","title":"XAM.SAM.FLAG_REVERSE","text":"0x0010: the read is mapped to the reverse strand\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_SECONDARY","page":"API Reference","title":"XAM.SAM.FLAG_SECONDARY","text":"0x0100: not primary alignment\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_SUPPLEMENTARY","page":"API Reference","title":"XAM.SAM.FLAG_SUPPLEMENTARY","text":"0x0800: supplementary alignment\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_UNMAP","page":"API Reference","title":"XAM.SAM.FLAG_UNMAP","text":"0x0004: the read itself is unmapped; conflictive with SAM.FLAGPROPERPAIR\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.Header-Tuple{}","page":"API Reference","title":"XAM.SAM.Header","text":"SAM.Header()\n\nCreate an empty header.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.MetaInfo-Tuple{AbstractString,Any}","page":"API Reference","title":"XAM.SAM.MetaInfo","text":"MetaInfo(tag::AbstractString, value)\n\nCreate a SAM metainfo with tag and value.\n\ntag is a two-byte ASCII string. If tag is \"CO\", value must be a string; otherwise, value is an iterable object with key and value pairs.\n\nExamples\n\njulia> SAM.MetaInfo(\"CO\", \"some comment\")\nBioAlignments.SAM.MetaInfo:\n tag: CO\n value: some comment\n\njulia> string(ans)\n\"@CO\tsome comment\"\n\njulia> SAM.MetaInfo(\"SQ\", [\"SN\" => \"chr1\", \"LN\" => 12345])\nBioAlignments.SAM.MetaInfo:\n tag: SQ\n value: SN=chr1 LN=12345\n\njulia> string(ans)\n\"@SQ\tSN:chr1\tLN:12345\"\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.MetaInfo-Tuple{AbstractString}","page":"API Reference","title":"XAM.SAM.MetaInfo","text":"MetaInfo(str::AbstractString)\n\nCreate a SAM metainfo from str.\n\nExamples\n\njulia> SAM.MetaInfo(\"@CO\tsome comment\")\nBioAlignments.SAM.MetaInfo:\n tag: CO\n value: some comment\n\njulia> SAM.MetaInfo(\"@SQ\tSN:chr1\tLN:12345\")\nBioAlignments.SAM.MetaInfo:\n tag: SQ\n value: SN=chr1 LN=12345\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Reader-Tuple{IO}","page":"API Reference","title":"XAM.SAM.Reader","text":"SAM.Reader(input::IO)\n\nCreate a data reader of the SAM file format.\n\nArguments\n\ninput: data source\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{AbstractString}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record(str::AbstractString)\n\nCreate a SAM record from str. This function verifies the format and indexes fields for accessors.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{Array{UInt8,1}}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record(data::Vector{UInt8})\n\nCreate a SAM record from data. This function verifies the format and indexes fields for accessors. Note that the ownership of data is transferred to a new record object.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record()\n\nCreate an unfilled SAM record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Writer","page":"API Reference","title":"XAM.SAM.Writer","text":"Writer(output::IO, header::Header=Header())\n\nCreate a data writer of the SAM file format.\n\nArguments\n\noutput: data sink\nheader=Header(): SAM header object\n\n\n\n\n\n","category":"type"},{"location":"man/api/#Base.findall-Tuple{XAM.SAM.Header,AbstractString}","page":"API Reference","title":"Base.findall","text":"find(header::Header, key::AbstractString)::Vector{MetaInfo}\n\nFind metainfo objects satisfying SAM.tag(metainfo) == key.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Base.read!-Tuple{XAM.SAM.Reader,XAM.SAM.Record}","page":"API Reference","title":"Base.read!","text":"read!(rdr::Reader, rec::Record)\n\nRead a Record into rec; overwriting or adding to existing field values. It is assumed that rec is already initialized or empty.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#BioGenerics.header-Tuple{XAM.SAM.Reader}","page":"API Reference","title":"BioGenerics.header","text":"header(reader::Reader)::Header\n\nGet the header of reader.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.alignlength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.alignment-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.auxdata-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.auxdata","text":"auxdata(record::Record)::Dict{String,Any}\n\nGet the auxiliary data (optional fields) of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.cigar-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.flag-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.iscomment-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.iscomment","text":"iscomment(metainfo::MetaInfo)::Bool\n\nTest if metainfo is a comment (i.e. its tag is \"CO\").\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.ismapped-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.isnextmapped-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.isprimary-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.keyvalues-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.keyvalues","text":"keyvalues(metainfo::MetaInfo)::Vector{Pair{String,String}}\n\nGet the values of metainfo as string pairs.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.mappingquality-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.nextposition-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the position of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.nextrefname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.position-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.quality-Tuple{Type{String},XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.quality","text":"quality(::Type{String}, record::Record)::String\n\nGet the ASCII-encoded base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.quality-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.quality","text":"quality(record::Record)::Vector{UInt8}\n\nGet the Phred-scaled base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.refname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.rightposition-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.seqlength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.sequence-Tuple{Type{String},XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.sequence","text":"sequence(::Type{String}, record::Record)::String\n\nGet the segment sequence of record as String.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.sequence-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.tag-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.tag","text":"tag(metainfo::MetaInfo)::String\n\nGet the tag of metainfo.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.templength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.tempname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.value-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.value","text":"value(metainfo::MetaInfo)::String\n\nGet the value of metainfo as a string.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Internal-1","page":"API Reference","title":"Internal","text":"","category":"section"},{"location":"man/api/#","page":"API Reference","title":"API Reference","text":"Modules = [XAM.SAM]\npublic = false","category":"page"},{"location":"man/api/#BAM-API-1","page":"API Reference","title":"BAM API","text":"","category":"section"},{"location":"man/api/#Public-2","page":"API Reference","title":"Public","text":"","category":"section"},{"location":"man/api/#","page":"API Reference","title":"API Reference","text":"Modules = [XAM.BAM]\nprivate = false","category":"page"},{"location":"man/api/#XAM.BAM.BAI-Tuple{AbstractString}","page":"API Reference","title":"XAM.BAM.BAI","text":"BAI(filename::AbstractString)\n\nLoad a BAI index from filename.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.BAI-Tuple{IO}","page":"API Reference","title":"XAM.BAM.BAI","text":"BAI(input::IO)\n\nLoad a BAI index from input.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.Reader","page":"API Reference","title":"XAM.BAM.Reader","text":"BAM.Reader(input::IO; index=nothing)\n\nCreate a data reader of the BAM file format.\n\nArguments\n\ninput: data source\nindex=nothing: filepath to a random access index (currently bai is supported)\n\n\n\n\n\n","category":"type"},{"location":"man/api/#XAM.BAM.Record","page":"API Reference","title":"XAM.BAM.Record","text":"BAM.Record()\n\nCreate an unfilled BAM record.\n\n\n\n\n\n","category":"type"},{"location":"man/api/#XAM.BAM.Writer","page":"API Reference","title":"XAM.BAM.Writer","text":"BAM.Writer(output::BGZFStream, header::SAM.Header)\n\nCreate a data writer of the BAM file format.\n\nArguments\n\noutput: data sink\nheader: SAM header object\n\n\n\n\n\n","category":"type"},{"location":"man/api/#BioGenerics.header-Tuple{XAM.BAM.Reader}","page":"API Reference","title":"BioGenerics.header","text":"header(reader::Reader; fillSQ::Bool=false)::SAM.Header\n\nGet the header of reader.\n\nIf fillSQ is true, this function fills missing \"SQ\" metainfo in the header.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.alignlength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.alignment-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.auxdata-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.auxdata","text":"auxdata(record::Record)::BAM.AuxData\n\nGet the auxiliary data of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.cigar","page":"API Reference","title":"XAM.BAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar_rle.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.cigar_rle","page":"API Reference","title":"XAM.BAM.cigar_rle","text":"cigar_rle(record::Record, checkCG::Bool = true)::Tuple{Vector{BioAlignments.Operation},Vector{Int}}\n\nGet a run-length encoded tuple (ops, lens) of the CIGAR string in record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.flag-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.ismapped-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.isnextmapped-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.ispositivestrand-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.ispositivestrand","text":"ispositivestrand(record::Record)::Bool\n\nTest if record is aligned to the positive strand.\n\nThis is equivalent to flag(record) & 0x10 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.isprimary-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.mappingquality-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.n_cigar_op","page":"API Reference","title":"XAM.BAM.n_cigar_op","text":"n_cigar_op(record::Record, checkCG::Bool = true)\n\nReturn the number of operations in the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the number of operations in the true cigar string, because this is probably what you want, the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to get the number of operations in the cigar field of the BAM record, then set checkCG to false.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.nextposition-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the 1-based leftmost mapping position of the next/mate read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.nextrefid-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextrefid","text":"nextrefid(record::Record)::Int\n\nGet the next/mate reference sequence ID of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.nextrefname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.position-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.quality-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.quality","text":"quality(record::Record)\n\nGet the base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.refid-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.refid","text":"refid(record::Record)::Int\n\nGet the reference sequence ID of record.\n\nThe ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.\n\nSee also: BAM.rname\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.reflen-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.reflen","text":"reflen(record::Record)::Int\n\nGet the length of the reference sequence this record applies to.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.refname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\nSee also: BAM.refid\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.rightposition-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.seqlength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.sequence-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.templength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.tempname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Internal-2","page":"API Reference","title":"Internal","text":"","category":"section"},{"location":"man/api/#","page":"API Reference","title":"API Reference","text":"Modules = [XAM.BAM]\npublic = false","category":"page"}] +[{"location":"man/hts-files/#SAM-and-BAM","page":"SAM and BAM","title":"SAM and BAM","text":"","category":"section"},{"location":"man/hts-files/#Introduction","page":"SAM and BAM","title":"Introduction","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package offers high-performance tools for SAM and BAM file formats, which are the most popular file formats.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"If you have questions about the SAM and BAM formats or any of the terminology used when discussing these formats, see the published specification, which is maintained by the samtools group.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"A very very simple SAM file looks like the following:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"@HD VN:1.6 SO:coordinate\n@SQ SN:ref LN:45\nr001 99 ref 7 30 8M2I4M1D3M = 37 39 TTAGATAAAGGATACTG *\nr002 0 ref 9 30 3S6M1P1I4M * 0 0 AAAAGATAAGGATA *\nr003 0 ref 9 30 5S6M * 0 0 GCCTAAGCTAA * SA:Z:ref,29,-,6H5M,17,0;\nr004 0 ref 16 30 6M14N5M * 0 0 ATAGCTTCAGC *\nr003 2064 ref 29 17 6H5M * 0 0 TAGGC * SA:Z:ref,9,+,5S6M,30,1;\nr001 147 ref 37 30 9M = 7 -39 CAGCGGCAT * NM:i:1","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Where the first two lines are part of the \"header\", and the following lines are \"records\". Each record describes how a read aligns to some reference sequence. Sometimes one record describes one read, but there are other cases like chimeric reads and split alignments, where multiple records apply to one read. In the example above, r003 is a chimeric read, and r004 is a split alignment, and r001 are mate pair reads. Again, we refer you to the official specification for more details.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"A BAM file stores this same information but in a binary and compressible format that does not make for pretty printing here!","category":"page"},{"location":"man/hts-files/#Reading-SAM-and-BAM-files","page":"SAM and BAM","title":"Reading SAM and BAM files","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"A typical script iterating over all records in a file looks like below:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"using XAM\n\n# Open a BAM file.\nreader = open(BAM.Reader, \"data.bam\")\n\n# Iterate over BAM records.\nfor record in reader\n # `record` is a BAM.Record object.\n if BAM.ismapped(record)\n # Print the mapped position.\n println(BAM.refname(record), ':', BAM.position(record))\n end\nend\n\n# Close the BAM file.\nclose(reader)","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The size of a BAM file is often extremely large. The iterator interface demonstrated above allocates an object for each record and that may be a bottleneck of reading data from a BAM file. In-place reading reuses a pre-allocated object for every record and less memory allocation happens in reading:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"reader = open(BAM.Reader, \"data.bam\")\nrecord = BAM.Record()\nwhile !eof(reader)\n empty!(record)\n read!(reader, record)\n # do something\nend","category":"page"},{"location":"man/hts-files/#SAM-and-BAM-Headers","page":"SAM and BAM","title":"SAM and BAM Headers","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Both SAM.Reader and BAM.Reader implement the header function, which returns a SAM.Header object. To extract certain information out of the headers, you can use the find method on the header to extract information according to SAM/BAM tag. Again we refer you to the specification for full details of all the different tags that can occur in headers, and what they mean.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Below is an example of extracting all the info about the reference sequences from the BAM header. In SAM/BAM, any description of a reference sequence is stored in the header, under a tag denoted SQ (think reference SeQuence!).","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"julia> reader = open(SAM.Reader, \"data.sam\");\n\njulia> find(header(reader), \"SQ\")\n7-element Array{Bio.Align.SAM.MetaInfo,1}:\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr1 LN=30427671\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr2 LN=19698289\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr3 LN=23459830\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr4 LN=18585056\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=Chr5 LN=26975502\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=chloroplast LN=154478\n Bio.Align.SAM.MetaInfo:\n tag: SQ\n value: SN=mitochondria LN=366924\n","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"In the above we can see there were 7 sequences in the reference: 5 chromosomes, one chloroplast sequence, and one mitochondrial sequence.","category":"page"},{"location":"man/hts-files/#SAM-and-BAM-Records","page":"SAM and BAM","title":"SAM and BAM Records","text":"","category":"section"},{"location":"man/hts-files/#SAM.Record","page":"SAM and BAM","title":"SAM.Record","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the following accessors for SAM.Record types.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"XAM.SAM.flag\nXAM.SAM.ismapped\nXAM.SAM.isprimary\nXAM.SAM.refname\nXAM.SAM.position\nXAM.SAM.rightposition\nXAM.SAM.isnextmapped\nXAM.SAM.nextrefname\nXAM.SAM.nextposition\nXAM.SAM.mappingquality\nXAM.SAM.cigar\nXAM.SAM.alignment\nXAM.SAM.alignlength\nXAM.SAM.tempname\nXAM.SAM.templength\nXAM.SAM.sequence\nXAM.SAM.seqlength\nXAM.SAM.quality\nXAM.SAM.auxdata","category":"page"},{"location":"man/hts-files/#XAM.SAM.flag","page":"SAM and BAM","title":"XAM.SAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.ismapped","page":"SAM and BAM","title":"XAM.SAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.isprimary","page":"SAM and BAM","title":"XAM.SAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.refname","page":"SAM and BAM","title":"XAM.SAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.position","page":"SAM and BAM","title":"XAM.SAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.rightposition","page":"SAM and BAM","title":"XAM.SAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.isnextmapped","page":"SAM and BAM","title":"XAM.SAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.nextrefname","page":"SAM and BAM","title":"XAM.SAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.nextposition","page":"SAM and BAM","title":"XAM.SAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the position of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.mappingquality","page":"SAM and BAM","title":"XAM.SAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.cigar","page":"SAM and BAM","title":"XAM.SAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.alignment","page":"SAM and BAM","title":"XAM.SAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.alignlength","page":"SAM and BAM","title":"XAM.SAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.tempname","page":"SAM and BAM","title":"XAM.SAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.templength","page":"SAM and BAM","title":"XAM.SAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.sequence","page":"SAM and BAM","title":"XAM.SAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\nsequence(::Type{String}, record::Record)::String\n\nGet the segment sequence of record as String.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.seqlength","page":"SAM and BAM","title":"XAM.SAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.quality","page":"SAM and BAM","title":"XAM.SAM.quality","text":"quality(record::Record)::Vector{UInt8}\n\nGet the Phred-scaled base quality of record.\n\n\n\n\n\nquality(::Type{String}, record::Record)::String\n\nGet the ASCII-encoded base quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.SAM.auxdata","page":"SAM and BAM","title":"XAM.SAM.auxdata","text":"auxdata(record::Record)::Dict{String,Any}\n\nGet the auxiliary data (optional fields) of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#BAM.Record","page":"SAM and BAM","title":"BAM.Record","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the following accessors for BAM.Record types.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"XAM.BAM.flag\nXAM.BAM.ismapped\nXAM.BAM.isprimary\nXAM.BAM.refid\nXAM.BAM.refname\nXAM.BAM.reflen\nXAM.BAM.position\nXAM.BAM.rightposition\nXAM.BAM.isnextmapped\nXAM.BAM.nextrefid\nXAM.BAM.nextrefname\nXAM.BAM.nextposition\nXAM.BAM.mappingquality\nXAM.BAM.cigar\nXAM.BAM.alignment\nXAM.BAM.alignlength\nXAM.BAM.tempname\nXAM.BAM.templength\nXAM.BAM.sequence\nXAM.BAM.seqlength\nXAM.BAM.quality\nXAM.BAM.auxdata","category":"page"},{"location":"man/hts-files/#XAM.BAM.flag","page":"SAM and BAM","title":"XAM.BAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.ismapped","page":"SAM and BAM","title":"XAM.BAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.isprimary","page":"SAM and BAM","title":"XAM.BAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.refid","page":"SAM and BAM","title":"XAM.BAM.refid","text":"refid(record::Record)::Int\n\nGet the reference sequence ID of record.\n\nThe ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.\n\nSee also: BAM.rname\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.refname","page":"SAM and BAM","title":"XAM.BAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\nSee also: BAM.refid\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.reflen","page":"SAM and BAM","title":"XAM.BAM.reflen","text":"reflen(record::Record)::Int\n\nGet the length of the reference sequence this record applies to.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.position","page":"SAM and BAM","title":"XAM.BAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.rightposition","page":"SAM and BAM","title":"XAM.BAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.isnextmapped","page":"SAM and BAM","title":"XAM.BAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextrefid","page":"SAM and BAM","title":"XAM.BAM.nextrefid","text":"nextrefid(record::Record)::Int\n\nGet the next/mate reference sequence ID of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextrefname","page":"SAM and BAM","title":"XAM.BAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.nextposition","page":"SAM and BAM","title":"XAM.BAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the 1-based leftmost mapping position of the next/mate read of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.mappingquality","page":"SAM and BAM","title":"XAM.BAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.cigar","page":"SAM and BAM","title":"XAM.BAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar_rle.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.alignment","page":"SAM and BAM","title":"XAM.BAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.alignlength","page":"SAM and BAM","title":"XAM.BAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.tempname","page":"SAM and BAM","title":"XAM.BAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.templength","page":"SAM and BAM","title":"XAM.BAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.sequence","page":"SAM and BAM","title":"XAM.BAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.seqlength","page":"SAM and BAM","title":"XAM.BAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.quality","page":"SAM and BAM","title":"XAM.BAM.quality","text":"quality(record::Record)\n\nGet the base quality of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#XAM.BAM.auxdata","page":"SAM and BAM","title":"XAM.BAM.auxdata","text":"auxdata(record::Record)::BAM.AuxData\n\nGet the auxiliary data of record.\n\n\n\n\n\n","category":"function"},{"location":"man/hts-files/#Accessing-auxiliary-data","page":"SAM and BAM","title":"Accessing auxiliary data","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"SAM and BAM records support the storing of optional data fields associated with tags.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Tagged auxiliary data follows a format of TAG:TYPE:VALUE. TAG is a two-letter string, and each tag can only appear once per record. TYPE is a single case-sensetive letter which defined the format of VALUE.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Type Description\n'A' Printable character\n'i' Signed integer\n'f' Single-precision floating number\n'Z' Printable string, including space\n'H' Byte array in Hex format\n'B' Integer of numeric array","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"For more information about these tags and their types we refer you to the SAM/BAM specification and the additional optional fields specification document.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"There are some tags that are reserved, predefined standard tags, for specific uses.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"To access optional fields stored in tags, you use getindex indexing syntax on the record object. Note that accessing optional tag fields will result in type instability in Julia. This is because the type of the optional data is not known until run-time, as the tag is being read. This can have a significant impact on performance. To limit this, if the user knows the type of a value in advance, specifying it as a type annotation will alleviate the problem:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Below is an example of looping over records in a bam file and using indexing syntax to get the data stored in the \"NM\" tag. Note the UInt8 type assertion to alleviate type instability.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"for record in open(BAM.Reader, \"data.bam\")\n nm = record[\"NM\"]::UInt8\n # do something\nend","category":"page"},{"location":"man/hts-files/#Getting-records-in-a-range","page":"SAM and BAM","title":"Getting records in a range","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The XAM package supports the BAI index to fetch records in a specific range from a BAM file. Samtools provides index subcommand to create an index file (.bai) from a sorted BAM file.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"$ samtools index -b SRR1238088.sort.bam\n$ ls SRR1238088.sort.bam*\nSRR1238088.sort.bam SRR1238088.sort.bam.bai","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The method eachoverlap(reader, chrom, range) returns an iterator of BAM records overlapping the query interval:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"reader = open(BAM.Reader, \"SRR1238088.sort.bam\", index=\"SRR1238088.sort.bam.bai\")\nfor record in eachoverlap(reader, \"Chr2\", 10000:11000)\n # `record` is a BAM.Record object\n # ...\nend\nclose(reader)","category":"page"},{"location":"man/hts-files/#Getting-records-overlapping-genomic-features","page":"SAM and BAM","title":"Getting records overlapping genomic features","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"The eachoverlap method also accepts the Interval type defined in GenomicFeatures.jl.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"This allows you to do things like first read in the genomic features from a GFF3 file, and then for each feature, iterate over all the BAM records that overlap with that feature.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"using GenomicFeatures\nusing GFF3\nusing XAM\n\n# Load genomic features from a GFF3 file.\nfeatures = open(collect, GFF3.Reader, \"TAIR10_GFF3_genes.gff\")\n\n# Keep mRNA features.\nfilter!(x -> GFF3.featuretype(x) == \"mRNA\", features)\n\n# Open a BAM file and iterate over records overlapping mRNA transcripts.\nreader = open(BAM.Reader, \"SRR1238088.sort.bam\", index = \"SRR1238088.sort.bam.bai\")\nfor feature in features\n for record in eachoverlap(reader, feature)\n # `record` overlaps `feature`.\n # ...\n end\nend\nclose(reader)","category":"page"},{"location":"man/hts-files/#Writing-files","page":"SAM and BAM","title":"Writing files","text":"","category":"section"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"In order to write a BAM or SAM file, you must first create a SAM.Header.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"A SAM.Header is constructed from a vector of SAM.MetaInfo objects.","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"For example, to create the following simple header:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"@HD VN:1.6 SO:coordinate\n@SQ SN:ref LN:45","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"julia> a = SAM.MetaInfo(\"HD\", [\"VN\" => 1.6, \"SO\" => \"coordinate\"])\nSAM.MetaInfo:\n tag: HD\n value: VN=1.6 SO=coordinate\n\njulia> b = SAM.MetaInfo(\"SQ\", [\"SN\" => \"ref\", \"LN\" => 45])\nSAM.MetaInfo:\n tag: SQ\n value: SN=ref LN=45\n\njulia> h = SAM.Header([a, b])\nSAM.Header(SAM.MetaInfo[SAM.MetaInfo:\n tag: HD\n value: VN=1.6 SO=coordinate, SAM.MetaInfo:\n tag: SQ\n value: SN=ref LN=45])\n","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Then to create the writer for a SAM file, construct a SAM.Writer using the header and an IO type:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"julia> samw = SAM.Writer(open(\"my-data.sam\", \"w\"), h)\nSAM.Writer(IOStream())\n","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"To make a BAM Writer is slightly different, as you need to use a specific stream type from the https://github.com/BioJulia/BGZFStreams.jl package:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"julia> using BGZFStreams\n\njulia> bamw = BAM.Writer(BGZFStream(open(\"my-data.bam\", \"w\"), \"w\"))\nBAM.Writer(BGZFStreams.BGZFStream{IOStream}())\n","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"Once you have a BAM or SAM writer, you can use the write method to write BAM.Records or SAM.Records to file:","category":"page"},{"location":"man/hts-files/","page":"SAM and BAM","title":"SAM and BAM","text":"julia> write(bamw, rec) # Here rec is a `BAM.Record`\n330780","category":"page"},{"location":"#XAM.jl","page":"Home","title":"XAM.jl","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"(Image: Project Status: Active – The project has reached a stable, usable state and is being actively developed.) (Image: Latest Release) (Image: MIT license) (Image: Stable documentation) (Image: Latest documentation) (Image: Join the chat at https://gitter.im/BioJulia/XAM.jl)","category":"page"},{"location":"","page":"Home","title":"Home","text":"This project follows the semver pro forma and uses the git-flow branching model.","category":"page"},{"location":"#Description","page":"Home","title":"Description","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"The XAM package provides I/O and utilities for manipulating SAM and BAM formatted alignment map files.","category":"page"},{"location":"#Installation","page":"Home","title":"Installation","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"You can install the XAM package from the Julia REPL. Press ] to enter pkg mode, then enter the following command:","category":"page"},{"location":"","page":"Home","title":"Home","text":"add XAM","category":"page"},{"location":"","page":"Home","title":"Home","text":"If you are interested in the cutting edge of the development, please check out the develop branch to try new features before release.","category":"page"},{"location":"#Testing","page":"Home","title":"Testing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"XAM is tested against Julia 1.X on Linux, OS X, and Windows.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Latest build status:","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: Unit tests) (Image: Documentation) (Image: codecov)","category":"page"},{"location":"#Contributing","page":"Home","title":"Contributing","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"We appreciate contributions from users including reporting bugs, fixing issues, improving performance and adding new features.","category":"page"},{"location":"","page":"Home","title":"Home","text":"Take a look at the contributing files detailed contributor and maintainer guidelines, and code of conduct.","category":"page"},{"location":"#Financial-contributions","page":"Home","title":"Financial contributions","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"We also welcome financial contributions in full transparency on our open collective. Anyone can file an expense. If the expense makes sense for the development the core contributors and the person who filed the expense will be reimbursed.","category":"page"},{"location":"#Backers-and-Sponsors","page":"Home","title":"Backers & Sponsors","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"Thank you to all our backers and sponsors!","category":"page"},{"location":"","page":"Home","title":"Home","text":"Love our work and community? Become a backer.","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: backers)","category":"page"},{"location":"","page":"Home","title":"Home","text":"Does your company use BioJulia? Help keep BioJulia feature rich and healthy by sponsoring the project. Your logo will show up here with a link to your website.","category":"page"},{"location":"","page":"Home","title":"Home","text":"(Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: ) (Image: )","category":"page"},{"location":"#Questions?","page":"Home","title":"Questions?","text":"","category":"section"},{"location":"","page":"Home","title":"Home","text":"If you have a question about contributing or using BioJulia software, come on over and chat to us on Gitter, or you can try the Bio category of the Julia discourse site.","category":"page"},{"location":"man/api/","page":"API Reference","title":"API Reference","text":"CurrentModule = XAM\nDocTestSetup = quote\n using XAM\nend","category":"page"},{"location":"man/api/#API-Reference","page":"API Reference","title":"API Reference","text":"","category":"section"},{"location":"man/api/#SAM-API","page":"API Reference","title":"SAM API","text":"","category":"section"},{"location":"man/api/#Public","page":"API Reference","title":"Public","text":"","category":"section"},{"location":"man/api/","page":"API Reference","title":"API Reference","text":"Modules = [XAM.SAM]\nprivate = false","category":"page"},{"location":"man/api/#XAM.SAM.FLAG_DUP","page":"API Reference","title":"XAM.SAM.FLAG_DUP","text":"0x0400: optical or PCR duplicate\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_MREVERSE","page":"API Reference","title":"XAM.SAM.FLAG_MREVERSE","text":"0x0020: the mate is mapped to the reverse strand\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_MUNMAP","page":"API Reference","title":"XAM.SAM.FLAG_MUNMAP","text":"0x0008: the mate is unmapped\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_PAIRED","page":"API Reference","title":"XAM.SAM.FLAG_PAIRED","text":"0x0001: the read is paired in sequencing, no matter whether it is mapped in a pair\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_PROPER_PAIR","page":"API Reference","title":"XAM.SAM.FLAG_PROPER_PAIR","text":"0x0002: the read is mapped in a proper pair\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_QCFAIL","page":"API Reference","title":"XAM.SAM.FLAG_QCFAIL","text":"0x0200: QC failure\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_READ1","page":"API Reference","title":"XAM.SAM.FLAG_READ1","text":"0x0040: this is read1\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_READ2","page":"API Reference","title":"XAM.SAM.FLAG_READ2","text":"0x0080: this is read2\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_REVERSE","page":"API Reference","title":"XAM.SAM.FLAG_REVERSE","text":"0x0010: the read is mapped to the reverse strand\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_SECONDARY","page":"API Reference","title":"XAM.SAM.FLAG_SECONDARY","text":"0x0100: not primary alignment\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_SUPPLEMENTARY","page":"API Reference","title":"XAM.SAM.FLAG_SUPPLEMENTARY","text":"0x0800: supplementary alignment\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.FLAG_UNMAP","page":"API Reference","title":"XAM.SAM.FLAG_UNMAP","text":"0x0004: the read itself is unmapped; conflictive with SAM.FLAGPROPERPAIR\n\n\n\n\n\n","category":"constant"},{"location":"man/api/#XAM.SAM.Header-Tuple{}","page":"API Reference","title":"XAM.SAM.Header","text":"SAM.Header()\n\nCreate an empty header.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.MetaInfo-Tuple{AbstractString, Any}","page":"API Reference","title":"XAM.SAM.MetaInfo","text":"MetaInfo(tag::AbstractString, value)\n\nCreate a SAM metainfo with tag and value.\n\ntag is a two-byte ASCII string. If tag is \"CO\", value must be a string; otherwise, value is an iterable object with key and value pairs.\n\nExamples\n\njulia> SAM.MetaInfo(\"CO\", \"some comment\")\nBioAlignments.SAM.MetaInfo:\n tag: CO\n value: some comment\n\njulia> string(ans)\n\"@CO\tsome comment\"\n\njulia> SAM.MetaInfo(\"SQ\", [\"SN\" => \"chr1\", \"LN\" => 12345])\nBioAlignments.SAM.MetaInfo:\n tag: SQ\n value: SN=chr1 LN=12345\n\njulia> string(ans)\n\"@SQ\tSN:chr1\tLN:12345\"\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.MetaInfo-Tuple{AbstractString}","page":"API Reference","title":"XAM.SAM.MetaInfo","text":"MetaInfo(str::AbstractString)\n\nCreate a SAM metainfo from str.\n\nExamples\n\njulia> SAM.MetaInfo(\"@CO\tsome comment\")\nBioAlignments.SAM.MetaInfo:\n tag: CO\n value: some comment\n\njulia> SAM.MetaInfo(\"@SQ\tSN:chr1\tLN:12345\")\nBioAlignments.SAM.MetaInfo:\n tag: SQ\n value: SN=chr1 LN=12345\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Reader-Tuple{IO}","page":"API Reference","title":"XAM.SAM.Reader","text":"SAM.Reader(input::IO)\n\nCreate a data reader of the SAM file format.\n\nArguments\n\ninput: data source\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{AbstractString}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record(str::AbstractString)\n\nCreate a SAM record from str. This function verifies the format and indexes fields for accessors.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{Vector{UInt8}}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record(data::Vector{UInt8})\n\nCreate a SAM record from data. This function verifies the format and indexes fields for accessors. Note that the ownership of data is transferred to a new record object.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Record-Tuple{}","page":"API Reference","title":"XAM.SAM.Record","text":"SAM.Record()\n\nCreate an unfilled SAM record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.Writer","page":"API Reference","title":"XAM.SAM.Writer","text":"Writer(output::IO, header::Header=Header())\n\nCreate a data writer of the SAM file format.\n\nArguments\n\noutput: data sink\nheader=Header(): SAM header object\n\n\n\n\n\n","category":"type"},{"location":"man/api/#Base.findall-Tuple{XAM.SAM.Header, AbstractString}","page":"API Reference","title":"Base.findall","text":"find(header::Header, key::AbstractString)::Vector{MetaInfo}\n\nFind metainfo objects satisfying SAM.tag(metainfo) == key.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Base.read!-Tuple{XAM.SAM.Reader, XAM.SAM.Record}","page":"API Reference","title":"Base.read!","text":"read!(rdr::Reader, rec::Record)\n\nRead a Record into rec; overwriting or adding to existing field values. It is assumed that rec is already initialized or empty.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#BioGenerics.header-Tuple{XAM.SAM.Reader}","page":"API Reference","title":"BioGenerics.header","text":"header(reader::Reader)::Header\n\nGet the header of reader.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.alignlength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.alignment-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.auxdata-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.auxdata","text":"auxdata(record::Record)::Dict{String,Any}\n\nGet the auxiliary data (optional fields) of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.cigar-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.flag-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.iscomment-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.iscomment","text":"iscomment(metainfo::MetaInfo)::Bool\n\nTest if metainfo is a comment (i.e. its tag is \"CO\").\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.ismapped-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.isnextmapped-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.isprimary-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.keyvalues-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.keyvalues","text":"keyvalues(metainfo::MetaInfo)::Vector{Pair{String,String}}\n\nGet the values of metainfo as string pairs.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.mappingquality-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.nextposition-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the position of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.nextrefname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.position-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.quality-Tuple{Type{String}, XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.quality","text":"quality(::Type{String}, record::Record)::String\n\nGet the ASCII-encoded base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.quality-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.quality","text":"quality(record::Record)::Vector{UInt8}\n\nGet the Phred-scaled base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.refname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.rightposition-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.seqlength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.sequence-Tuple{Type{String}, XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.sequence","text":"sequence(::Type{String}, record::Record)::String\n\nGet the segment sequence of record as String.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.sequence-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.tag-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.tag","text":"tag(metainfo::MetaInfo)::String\n\nGet the tag of metainfo.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.templength-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.tempname-Tuple{XAM.SAM.Record}","page":"API Reference","title":"XAM.SAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.SAM.value-Tuple{XAM.SAM.MetaInfo}","page":"API Reference","title":"XAM.SAM.value","text":"value(metainfo::MetaInfo)::String\n\nGet the value of metainfo as a string.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Internal","page":"API Reference","title":"Internal","text":"","category":"section"},{"location":"man/api/","page":"API Reference","title":"API Reference","text":"Modules = [XAM.SAM]\npublic = false","category":"page"},{"location":"man/api/#BAM-API","page":"API Reference","title":"BAM API","text":"","category":"section"},{"location":"man/api/#Public-2","page":"API Reference","title":"Public","text":"","category":"section"},{"location":"man/api/","page":"API Reference","title":"API Reference","text":"Modules = [XAM.BAM]\nprivate = false","category":"page"},{"location":"man/api/#XAM.BAM.BAI-Tuple{AbstractString}","page":"API Reference","title":"XAM.BAM.BAI","text":"BAI(filename::AbstractString)\n\nLoad a BAI index from filename.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.BAI-Tuple{IO}","page":"API Reference","title":"XAM.BAM.BAI","text":"BAI(input::IO)\n\nLoad a BAI index from input.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.Reader","page":"API Reference","title":"XAM.BAM.Reader","text":"BAM.Reader(input::IO; index=nothing)\n\nCreate a data reader of the BAM file format.\n\nArguments\n\ninput: data source\nindex=nothing: filepath to a random access index (currently bai is supported)\n\n\n\n\n\n","category":"type"},{"location":"man/api/#XAM.BAM.Record","page":"API Reference","title":"XAM.BAM.Record","text":"BAM.Record()\n\nCreate an unfilled BAM record.\n\n\n\n\n\n","category":"type"},{"location":"man/api/#XAM.BAM.Writer","page":"API Reference","title":"XAM.BAM.Writer","text":"BAM.Writer(output::BGZFStream, header::SAM.Header)\n\nCreate a data writer of the BAM file format.\n\nArguments\n\noutput: data sink\nheader: SAM header object\n\n\n\n\n\n","category":"type"},{"location":"man/api/#BioGenerics.header-Tuple{XAM.BAM.Reader}","page":"API Reference","title":"BioGenerics.header","text":"header(reader::Reader; fillSQ::Bool=false)::SAM.Header\n\nGet the header of reader.\n\nIf fillSQ is true, this function fills missing \"SQ\" metainfo in the header.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.alignlength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.alignlength","text":"alignlength(record::Record)::Int\n\nGet the alignment length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.alignment-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.alignment","text":"alignment(record::Record)::BioAlignments.Alignment\n\nGet the alignment of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.auxdata-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.auxdata","text":"auxdata(record::Record)::BAM.AuxData\n\nGet the auxiliary data of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.cigar","page":"API Reference","title":"XAM.BAM.cigar","text":"cigar(record::Record)::String\n\nGet the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar_rle.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.cigar_rle","page":"API Reference","title":"XAM.BAM.cigar_rle","text":"cigar_rle(record::Record, checkCG::Bool = true)::Tuple{Vector{BioAlignments.Operation},Vector{Int}}\n\nGet a run-length encoded tuple (ops, lens) of the CIGAR string in record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the true cigar string, because this is probably what you want the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to access the pseudo-cigar that is stored in the cigar field of the BAM record, then you can set checkCG to false.\n\nSee also BAM.cigar.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.flag-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.flag","text":"flag(record::Record)::UInt16\n\nGet the bitwise flag of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.ismapped-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.ismapped","text":"ismapped(record::Record)::Bool\n\nTest if record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.isnextmapped-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.isnextmapped","text":"isnextmapped(record::Record)::Bool\n\nTest if the mate/next read of record is mapped.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.ispositivestrand-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.ispositivestrand","text":"ispositivestrand(record::Record)::Bool\n\nTest if record is aligned to the positive strand.\n\nThis is equivalent to flag(record) & 0x10 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.isprimary-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.isprimary","text":"isprimary(record::Record)::Bool\n\nTest if record is a primary line of the read.\n\nThis is equivalent to flag(record) & 0x900 == 0.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.mappingquality-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.mappingquality","text":"mappingquality(record::Record)::UInt8\n\nGet the mapping quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.n_cigar_op","page":"API Reference","title":"XAM.BAM.n_cigar_op","text":"n_cigar_op(record::Record, checkCG::Bool = true)\n\nReturn the number of operations in the CIGAR string of record.\n\nNote that in the BAM specification, the field called cigar typically stores the cigar string of the record. However, this is not always true, sometimes the true cigar is very long, and due to some constraints of the BAM format, the actual cigar string is stored in an extra tag: CG:B,I, and the cigar field stores a pseudo-cigar string.\n\nCalling this method with checkCG set to true (default) this method will always yield the number of operations in the true cigar string, because this is probably what you want, the vast majority of the time.\n\nIf you have a record that stores the true cigar in a CG:B,I tag, but you still want to get the number of operations in the cigar field of the BAM record, then set checkCG to false.\n\n\n\n\n\n","category":"function"},{"location":"man/api/#XAM.BAM.nextposition-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextposition","text":"nextposition(record::Record)::Int\n\nGet the 1-based leftmost mapping position of the next/mate read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.nextrefid-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextrefid","text":"nextrefid(record::Record)::Int\n\nGet the next/mate reference sequence ID of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.nextrefname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.nextrefname","text":"nextrefname(record::Record)::String\n\nGet the reference name of the mate/next read of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.position-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.position","text":"position(record::Record)::Int\n\nGet the 1-based leftmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.quality-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.quality","text":"quality(record::Record)\n\nGet the base quality of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.refid-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.refid","text":"refid(record::Record)::Int\n\nGet the reference sequence ID of record.\n\nThe ID is 1-based (i.e. the first sequence is 1) and is 0 for a record without a mapping position.\n\nSee also: BAM.rname\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.reflen-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.reflen","text":"reflen(record::Record)::Int\n\nGet the length of the reference sequence this record applies to.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.refname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.refname","text":"refname(record::Record)::String\n\nGet the reference sequence name of record.\n\nSee also: BAM.refid\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.rightposition-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.rightposition","text":"rightposition(record::Record)::Int\n\nGet the 1-based rightmost mapping position of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.seqlength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.seqlength","text":"seqlength(record::Record)::Int\n\nGet the sequence length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.sequence-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.sequence","text":"sequence(record::Record)::BioSequences.LongDNASeq\n\nGet the segment sequence of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.templength-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.templength","text":"templength(record::Record)::Int\n\nGet the template length of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#XAM.BAM.tempname-Tuple{XAM.BAM.Record}","page":"API Reference","title":"XAM.BAM.tempname","text":"tempname(record::Record)::String\n\nGet the query template name of record.\n\n\n\n\n\n","category":"method"},{"location":"man/api/#Internal-2","page":"API Reference","title":"Internal","text":"","category":"section"},{"location":"man/api/","page":"API Reference","title":"API Reference","text":"Modules = [XAM.BAM]\npublic = false","category":"page"}] } diff --git a/versions.js b/versions.js index 1509ad6..b6228d4 100644 --- a/versions.js +++ b/versions.js @@ -3,3 +3,5 @@ var DOC_VERSIONS = [ "v0.2", "dev", ]; +var DOCUMENTER_NEWEST = "v0.2.7"; +var DOCUMENTER_STABLE = "stable";