Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobnissen committed Sep 24, 2023
1 parent c2ba935 commit c403439
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
16 changes: 11 additions & 5 deletions docs/src/files.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,18 @@ FASTAReader(GzipDecompressorStream(open("seqs.fna.gz"; lock=false)))
To use rdr `rdr` and `wtr` macros with `do`-syntax, use the `defer` function.
The only purpose of the defer function is to enable `do`-syntax:

```julia
record = FASTARecord("my_header", "TAGAG")
```jldoctest
julia> using CodecZlib # for gzip files
defer(wtr"seqs.fna.gz") do writer
write(writer, record)
end
julia> defer(rdr"../test/data/test.fasta") do reader
println(identifier(first(reader)))
end
abc
julia> defer(wtr"seqs.fna.gz") do writer
write(writer, FASTARecord("my_header", "TAGAG"))
end
17
```

### Validate files
Expand Down
16 changes: 9 additions & 7 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,14 +79,16 @@ For added convenience, you can also use the reader and writer macros `rdr""` and
These macros use the file extensions to determine the biological sequence reader or writer type, and any file compresion.
To use these macros with the `do`-syntax, you can use the `defer` function. Hence, the above code block can also be written in the following equivalent way:

```julia
using CodecZlib
```jldoctest
julia> using CodecZlib
defer(rdr"seqs.fna.gz") do reader
for record in reader
println(identifier(record))
end
end
julia> defer(rdr"../test/data/seqs.fna.gz") do reader
for record in reader
println(identifier(record))
end
end
seqa
seqb
```

### Construct FASTA or FASTQ records from raw parts
Expand Down

0 comments on commit c403439

Please sign in to comment.