diff --git a/src/GFF/GFF.jl b/src/GFF/GFF.jl index 71a1e6e..f8a7e1a 100644 --- a/src/GFF/GFF.jl +++ b/src/GFF/GFF.jl @@ -8,7 +8,7 @@ using CodecZlib import ..GenomicAnnotations: Record, Gene, AbstractGene, GeneDataView, Locus, Join, Order import ..GenomicAnnotations: SpanLocus, ClosedSpan, Complement -import ..GenomicAnnotations: sequence, iscomplement, iscomplete, addgene!, pushproperty!, feature, index, locus, oneline, ismultilocus +import ..GenomicAnnotations: sequence, iscomplement, iscomplete, addgene!, pushproperty!, feature, index, locus, oneline, iscompound export sequence, iscomplement, iscomplete, feature, index, locus include("reader.jl") diff --git a/src/GFF/writer.jl b/src/GFF/writer.jl index 288df31..7defb66 100644 --- a/src/GFF/writer.jl +++ b/src/GFF/writer.jl @@ -55,7 +55,7 @@ function gffstring(gene::Gene) end end end - if ismultilocus(gene) + if iscompound(gene) s = String(take!(buf)) res = IOBuffer() for loc in locus(gene) diff --git a/src/GTF/GTF.jl b/src/GTF/GTF.jl index 04b251c..22658cc 100644 --- a/src/GTF/GTF.jl +++ b/src/GTF/GTF.jl @@ -8,7 +8,7 @@ using CodecZlib import ..GenomicAnnotations: Record, Gene, AbstractGene, GeneDataView, Locus, Join, Order import ..GenomicAnnotations: SpanLocus, ClosedSpan, Complement -import ..GenomicAnnotations: sequence, iscomplement, iscomplete, addgene!, pushproperty!, feature, index, locus, oneline, ismultilocus +import ..GenomicAnnotations: sequence, iscomplement, iscomplete, addgene!, pushproperty!, feature, index, locus, oneline, iscompound export sequence, iscomplement, iscomplete, feature, index, locus include("reader.jl") diff --git a/src/GTF/writer.jl b/src/GTF/writer.jl index 7cfaa42..e08974e 100644 --- a/src/GTF/writer.jl +++ b/src/GTF/writer.jl @@ -54,7 +54,7 @@ function gtfstring(gene::Gene) end end end - if ismultilocus(gene) + if iscompound(gene) s = String(take!(buf)) res = IOBuffer() for loc in locus(gene) diff --git a/src/GenomicAnnotations.jl b/src/GenomicAnnotations.jl index 9113768..3ab6d6e 100644 --- a/src/GenomicAnnotations.jl +++ b/src/GenomicAnnotations.jl @@ -7,7 +7,7 @@ using BioSequences export GenBank, GFF, GTF, EMBL export Gene, AbstractGene, GeneDataView -export sequence, iscomplement, iscomplete, ismultilocus, addgene!, pushproperty! +export sequence, iscomplement, iscomplete, iscompound, addgene!, pushproperty! export feature, feature!, index, locus, locus!, position, attributes, genedata export AbstractLocus diff --git a/src/record.jl b/src/record.jl index f9ed814..a1328b0 100644 --- a/src/record.jl +++ b/src/record.jl @@ -360,15 +360,15 @@ iscomplete(loci::Join) = all(iscomplete, loci.loc) iscomplete(loci::Order) = all(iscomplete, loci.loc) """ - ismultilocus(gene::AbstractGene) - ismultilocus(loc::AbstractLocus) + iscompound(gene::AbstractGene) + iscompound(loc::AbstractLocus) Return `true` if `loc` is a `Join`, `Order`, or either wrapping in `Complement`. """ -ismultilocus(gene::AbstractGene) = ismultilocus(locus(gene)) -ismultilocus(locus::Union{SpanLocus, PointLocus}) = false -ismultilocus(locus::Union{Join, Order}) = true -ismultilocus(locus::Complement{T}) where T <: AbstractLocus = ismultilocus(locus.loc) +iscompound(gene::AbstractGene) = iscompound(locus(gene)) +iscompound(locus::Union{SpanLocus, PointLocus}) = false +iscompound(locus::Union{Join, Order}) = true +iscompound(locus::Complement{T}) where T <: AbstractLocus = iscompound(locus.loc) function appendstring(field, v::Bool) return "\n" * join(fill(' ', 21)) * "/$field" diff --git a/test/runtests.jl b/test/runtests.jl index 83d5840..d4aed09 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -148,13 +148,13 @@ using Test @test sequence(chr.sequence, Locus("join(complement(1..3),complement(11..13))")) == dna"ttttat" @test sequence(chr.sequence, Locus("order(complement(1..3),complement(11..13))")) == [dna"ttt", dna"tat"] - @test ismultilocus(Locus("join(1..3,7..9)")) == true - @test ismultilocus(Locus("order(1..3,7..9)")) == true - @test ismultilocus(Locus("complement(join(1..3,7..9))")) == true - @test ismultilocus(Locus("join(complement(1..3),complement(7..9))")) == true - @test ismultilocus(Locus("1..10")) == false - @test ismultilocus(Locus("<1..>10")) == false - @test ismultilocus(Locus("1^2")) == false + @test iscompound(Locus("join(1..3,7..9)")) == true + @test iscompound(Locus("order(1..3,7..9)")) == true + @test iscompound(Locus("complement(join(1..3,7..9))")) == true + @test iscompound(Locus("join(complement(1..3),complement(7..9))")) == true + @test iscompound(Locus("1..10")) == false + @test iscompound(Locus("<1..>10")) == false + @test iscompound(Locus("1^2")) == false end seq = dna"atgtccatatacaacggtatctccacctcaggtttagatctcaacaacggaaccattgccgacatgagacagttaggtatcgtcgagagttacaagctaaaacgagcagtagtcagctctgcatctgaagccgctgaagttctactaagggtggataacatcatccgtgcaagaccaagaaccgccaatagacaacatatgtaa"