diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json
index bc5344f..78bed5b 100644
--- a/dev/.documenter-siteinfo.json
+++ b/dev/.documenter-siteinfo.json
@@ -1 +1 @@
-{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-25T15:33:35","documenter_version":"1.7.0"}}
\ No newline at end of file
+{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-10-25T15:34:24","documenter_version":"1.7.0"}}
\ No newline at end of file
diff --git a/dev/alignments/index.html b/dev/alignments/index.html
index 47c599c..2bcdcea 100644
--- a/dev/alignments/index.html
+++ b/dev/alignments/index.html
@@ -20,9 +20,9 @@
1 3 10 11 16 11 4 15 7 17 5 5 5 3 10 10 18 3 1
14 3 5 15 14 12 4 2 7 14 5 2 17 3 7 21 8 3 10
1 3 21 19 7 16 13 5 7 21 15 5 17 3 5 2 16 3 1
- 9 3 12 11 14 10 4 18 7 18 15 5 2 3 5 2 19 3 2julia> size(A) # length and number of sequences
(53, 100)
When reading from FASTA, the choice of the alphabet is made by reading the first five sequences, and comparing the observed characters with the list of default alphabets (see The Alphabet
type). If they fit one of the defaults, it will be used. Otherwise, an alphabet will be created ad hoc:
julia> A = read_fasta("../../example/strange_characters.fasta"); # warning produced because no default alphabet was found
┌ Warning: Could not find a default alphabet for characters ['!', '-', '/', '0', '9', '@', 'A', 'C', 'G', 'T'] -│ Using Alphabet{Char,Int64}: ['!', '-', '/', '0', '9', '@', 'A', 'C', 'G', 'T'] -└ @ BioSequenceMappings ~/work/BioSequenceMappings.jl/BioSequenceMappings.jl/src/IO.jl:62
julia> A.alphabet |> symbols |> prod
"!-/09@ACGT"
Writing to a FASTA file is just as easy:
julia> write("new_fasta_file.fasta", A) # or...
julia> open("new_fasta_file.fasta", "w") do io + 9 3 12 11 14 10 4 18 7 18 15 5 2 3 5 2 19 3 2
julia> size(A) # length and number of sequences
(53, 100)
When reading from FASTA, the choice of the alphabet is made by reading the first five sequences, and comparing the observed characters with the list of default alphabets (see The Alphabet
type). If they fit one of the defaults, it will be used. Otherwise, an alphabet will be created ad hoc:
julia> A = read_fasta("../../example/strange_characters.fasta"); # warning produced because no default alphabet was found
┌ Warning: Could not find a default alphabet for characters ['!', '-', '/', '0', '9', '@', 'A', 'C', 'G', 'T'] +│ Using Alphabet{Char,Int64}: ['!', '-', '/', '0', '9', '@', 'A', 'C', 'G', 'T'] +└ @ BioSequenceMappings ~/work/BioSequenceMappings.jl/BioSequenceMappings.jl/src/IO.jl:62
julia> A.alphabet |> symbols |> prod
"!-/09@ACGT"
Writing to a FASTA file is just as easy:
julia> write("new_fasta_file.fasta", A) # or...
julia> open("new_fasta_file.fasta", "w") do io write(io, A) end
Sequences can be accessed by indexing. Indexing using a range will return a view in the underlying data
matrix.
julia> A[1] # the first sequence of the alignment
53-element view(::Matrix{Int64}, :, 1) with eltype Int64: 1 @@ -84,16 +84,16 @@ 4 3 5 3 3 5 5 3 5 1 2 3 2 5 3 2 4 3 2 4
julia> B[1][1] = 5
5
julia> A[1][1] # A remains unchanged
5
With subsample_random
, it is also possible to create a random subalignment by picking sequences from the original one. For now, this is only possible without replacement, i.e. the same sequence cannot be picked twice. To just pick one sequence at random without creating a new alignment object, just call rand
.
julia> subsample_random(A, 3) # new alignment using three random sequences from A
Alignment of M=3 sequences of length L=10 - Shown as `MxL` matrix 3×10 adjoint(::Matrix{Int64}) with eltype Int64: - 4 3 5 3 3 5 5 3 5 1 + 2 3 2 5 3 2 4 3 2 4 2 4 4 1 4 2 3 2 2 3 - 2 3 2 5 3 2 4 3 2 4
julia> subsample_random(A, 12) # sampling without replacement: this will error since size(A, 1) < 12
ERROR: AssertionError: Cannot take 12 different sequences from alignment of size 5
julia> rand(A) # one random sequence from A (returns a view)
10-element view(::Matrix{Int64}, :, 4) with eltype Int64: - 3 - 3 + 3 3 5 2 2 1 5 3 1 2
julia> subsample_random(A, 12) # sampling without replacement: this will error since size(A, 1) < 12
ERROR: AssertionError: Cannot take 12 different sequences from alignment of size 5
julia> rand(A) # one random sequence from A (returns a view)
10-element view(::Matrix{Int64}, :, 1) with eltype Int64: 5 + 3 + 4 2 - 2 + 4 1 5 - 3 1 - 2
TBA
Settings
This document was generated with Documenter.jl version 1.7.0 on Friday 25 October 2024. Using Julia version 1.11.1.