Skip to content

Commit

Permalink
Update docs with recipes pages
Browse files Browse the repository at this point in the history
Add a "recipes" page for the documentation, which provide tested examples of
how to use BioSequences.

Remove links to Gitter, and to OpenCollective.
  • Loading branch information
jakobnissen committed Jan 15, 2024
1 parent 1314bbf commit 227ef2a
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 70 deletions.
1 change: 1 addition & 0 deletions docs/Project.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[deps]
BioSequences = "7e6ae17a-c86d-528c-b3b9-7f778a29fe59"
BioSymbols = "3c28c6f8-a34d-59c4-9654-267d177fcfa9"
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"

[compat]
Expand Down
4 changes: 2 additions & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ makedocs(
"Predicates" => "predicates.md",
"Random sequences" => "random.md",
"Pattern matching and searching" => "sequence_search.md",
"Iteration" => "iteration.md",
"Counting" => "counting.md",
"I/O" => "io.md",
"Implementing custom types" => "interfaces.md"
"Implementing custom types" => "interfaces.md",
"Recipes" => "recipes.md",
],
authors = "Sabrina Jaye Ward, Jakob Nissen, D.C.Jones, Kenta Sato, The BioJulia Organisation and other contributors.",
checkdocs = :all,
Expand Down
44 changes: 1 addition & 43 deletions docs/src/index.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
# BioSequences

[![Latest Release](https://img.shields.io/github/release/BioJulia/BioSequences.jl.svg)](https://github.com/BioJulia/BioSequences.jl/releases/latest)
[![MIT license](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/BioJulia/BioSequences.jl/blob/master/LICENSE)
[![Documentation](https://img.shields.io/badge/docs-stable-blue.svg)](https://biojulia.github.io/BioSequences.jl/stable)
[![Pkg Status](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![Chat](https://img.shields.io/gitter/room/BioJulia/BioSequences.svg)](https://gitter.im/BioJulia/BioSequences.jl)


## Description

BioSequences provides data types and methods for common operations with
biological sequences, including DNA, RNA, and amino acid sequences.


## Installation

You can install BioSequences from the julia
REPL. Press `]` to enter pkg mode again, and enter the following:

Expand All @@ -27,7 +23,6 @@ the master branch to try new features before release.


## Testing

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

[![Unit tests](https://github.com/BioJulia/BioSequences.jl/workflows/Unit%20tests/badge.svg?branch=master)](https://github.com/BioJulia/BioSequences.jl/actions?query=workflow%3A%22Unit+tests%22+branch%3Amaster)
Expand All @@ -36,50 +31,13 @@ BioSequences is tested against Julia `1.X` on Linux, OS X, and Windows.


## Contributing

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

Take a look at the [contributing files](https://github.com/BioJulia/Contributing)
detailed contributor and maintainer guidelines, and code of conduct.



### Financial contributions

We also welcome financial contributions in full transparency on our
[open collective](https://opencollective.com/biojulia).
Anyone can file an expense. If the expense makes sense for the development
of the community, it will be "merged" in the ledger of our open collective by
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](https://opencollective.com/biojulia#backer).

[![backers](https://opencollective.com/biojulia/backers.svg?width=890)](https://opencollective.com/biojulia#backers)

Does your company use BioJulia? Help keep BioJulia feature rich and healthy by
[sponsoring the project](https://opencollective.com/biojulia#sponsor)
Your logo will show up here with a link to your website.

[![](https://opencollective.com/biojulia/sponsor/0/avatar.svg)](https://opencollective.com/biojulia/sponsor/0/website)
[![](https://opencollective.com/biojulia/sponsor/1/avatar.svg)](https://opencollective.com/biojulia/sponsor/1/website)
[![](https://opencollective.com/biojulia/sponsor/2/avatar.svg)](https://opencollective.com/biojulia/sponsor/2/website)
[![](https://opencollective.com/biojulia/sponsor/3/avatar.svg)](https://opencollective.com/biojulia/sponsor/3/website)
[![](https://opencollective.com/biojulia/sponsor/4/avatar.svg)](https://opencollective.com/biojulia/sponsor/4/website)
[![](https://opencollective.com/biojulia/sponsor/5/avatar.svg)](https://opencollective.com/biojulia/sponsor/5/website)
[![](https://opencollective.com/biojulia/sponsor/6/avatar.svg)](https://opencollective.com/biojulia/sponsor/6/website)
[![](https://opencollective.com/biojulia/sponsor/7/avatar.svg)](https://opencollective.com/biojulia/sponsor/7/website)
[![](https://opencollective.com/biojulia/sponsor/8/avatar.svg)](https://opencollective.com/biojulia/sponsor/8/website)
[![](https://opencollective.com/biojulia/sponsor/9/avatar.svg)](https://opencollective.com/biojulia/sponsor/9/website)


## Questions?

If you have a question about contributing or using BioJulia software, come
on over and chat to us on [Gitter](https://gitter.im/BioJulia/General), or you can try the
on over and chat to us on [the #biology channel on the Julia SLack](https://julialang.org/slack/), or you can try the
[Bio category of the Julia discourse site](https://discourse.julialang.org/c/domain/bio).
25 changes: 0 additions & 25 deletions docs/src/iteration.md

This file was deleted.

66 changes: 66 additions & 0 deletions docs/src/recipes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
```@meta
CurrentModule = BioSequences
DocTestSetup = quote
using BioSequences
using BioSymbols
end
```

## Recipes
This page provides tested example code to solve various common problems using
BioSequences.

### One-hot encoding biosequences
The types `DNA`, `RNA` and `AminoAcid` expose a binary representation through
the exported function `BioSymbols.compatbits`, which is a one-hot encoding of:

```jldoctest
julia> using BioSymbols
julia> compatbits(DNA_W)
0x09
julia> compatbits(AA_J)
0x00000600
```

Each set bit in the encoding corresponds to a compatible unambiguous symbol.
For example, for `RNA`, the four lower bits encode A, C, G, and U, in order.
Hence, the symbol `D`, which is short for A, G or U, is encoded as
`0x01 | 0x04 | 0x08 == 0x0d`:

```jldoctest
julia> compatbits(RNA_D)
0x0d
julia> compatbits(RNA_A) | compatbits(DNA_G) | compatbits(RNA_U)
0x0d
```

Using this, we can construct a function to one-hot encode sequences - in this
example, nucleic acid sequences:
```jldoctest
function one_hot(s::NucSeq)
M = falses(4, length(s))
for (i, s) in enumerate(s)
bits = compatbits(s)
while !iszero(bits)
M[trailing_zeros(bits) + 1, i] = true
bits &= bits - one(bits) # clear lowest bit
end
end
M
end
one_hot(dna"TGNTKCTW-T")
# output
4×10 BitMatrix:
0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 1 0 0 0 0
0 1 1 0 1 0 0 0 0 0
1 0 1 1 1 0 1 1 0 1
```


0 comments on commit 227ef2a

Please sign in to comment.