Skip to content

Commit c403439

Browse files
committed
Update docs
1 parent c2ba935 commit c403439

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

docs/src/files.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,12 +133,18 @@ FASTAReader(GzipDecompressorStream(open("seqs.fna.gz"; lock=false)))
133133
To use rdr `rdr` and `wtr` macros with `do`-syntax, use the `defer` function.
134134
The only purpose of the defer function is to enable `do`-syntax:
135135

136-
```julia
137-
record = FASTARecord("my_header", "TAGAG")
136+
```jldoctest
137+
julia> using CodecZlib # for gzip files
138138
139-
defer(wtr"seqs.fna.gz") do writer
140-
write(writer, record)
141-
end
139+
julia> defer(rdr"../test/data/test.fasta") do reader
140+
println(identifier(first(reader)))
141+
end
142+
abc
143+
144+
julia> defer(wtr"seqs.fna.gz") do writer
145+
write(writer, FASTARecord("my_header", "TAGAG"))
146+
end
147+
17
142148
```
143149

144150
### Validate files

docs/src/index.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,16 @@ For added convenience, you can also use the reader and writer macros `rdr""` and
7979
These macros use the file extensions to determine the biological sequence reader or writer type, and any file compresion.
8080
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:
8181

82-
```julia
83-
using CodecZlib
82+
```jldoctest
83+
julia> using CodecZlib
8484
85-
defer(rdr"seqs.fna.gz") do reader
86-
for record in reader
87-
println(identifier(record))
88-
end
89-
end
85+
julia> defer(rdr"../test/data/seqs.fna.gz") do reader
86+
for record in reader
87+
println(identifier(record))
88+
end
89+
end
90+
seqa
91+
seqb
9092
```
9193

9294
### Construct FASTA or FASTQ records from raw parts

0 commit comments

Comments
 (0)