From 7f23990e51b4dfcdf6db6214629c3948a27fb0a3 Mon Sep 17 00:00:00 2001 From: Karl Dyrhage Date: Fri, 22 Nov 2024 19:30:36 +0100 Subject: [PATCH] Allow AbstractVector{Record}s as arguments to write --- src/EMBL/writer.jl | 6 ++++++ src/GFF/writer.jl | 6 ++++++ src/GTF/writer.jl | 6 ++++++ src/GenBank/writer.jl | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/src/EMBL/writer.jl b/src/EMBL/writer.jl index 15f1f00..73f7311 100644 --- a/src/EMBL/writer.jl +++ b/src/EMBL/writer.jl @@ -31,6 +31,12 @@ function Base.write(writer::Writer, record::Record, header = Dict()) printembl(writer.output, record, header) end +function Base.write(writer::Writer, records::AbstractVector{Record}, header = Dict()) + for record in records + printembl(writer.output, record, header) + end +end + """ printgbk(io::IO, chr) printgbk(path::AbstractString, chr) diff --git a/src/GFF/writer.jl b/src/GFF/writer.jl index 7defb66..160ecf2 100644 --- a/src/GFF/writer.jl +++ b/src/GFF/writer.jl @@ -31,6 +31,12 @@ function Base.write(writer::Writer, record::Record) printgff(writer.output, record) end +function Base.write(writer::Writer, records::AbstractVector{Record}) + for record in records + printgff(writer.output, record) + end +end + function gffstring(gene::Gene) buf = IOBuffer() diff --git a/src/GTF/writer.jl b/src/GTF/writer.jl index e08974e..3d40783 100644 --- a/src/GTF/writer.jl +++ b/src/GTF/writer.jl @@ -31,6 +31,12 @@ function Base.write(writer::Writer, record::Record) printgtf(writer.output, record) end +function Base.write(writer::Writer, records::AbstractVector{Record}) + for record in records + printgtf(writer.output, record) + end +end + function gtfstring(gene::Gene) buf = IOBuffer() diff --git a/src/GenBank/writer.jl b/src/GenBank/writer.jl index 894017a..4b47c00 100644 --- a/src/GenBank/writer.jl +++ b/src/GenBank/writer.jl @@ -31,6 +31,12 @@ function Base.write(writer::Writer, record::Record) printgbk(writer.output, record) end +function Base.write(writer::Writer, records::AbstractVector{Record}) + for record in records + printgbk(writer.output, record) + end +end + """ printgbk(io::IO, chr) printgbk(path::AbstractString, chr)