Skip to content

Commit

Permalink
Renamed ismultilocus to iscompound
Browse files Browse the repository at this point in the history
  • Loading branch information
kdyrhage committed Nov 21, 2024
1 parent 21899a9 commit 9f30598
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/GFF/GFF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/GFF/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/GTF/GTF.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
2 changes: 1 addition & 1 deletion src/GTF/writer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/GenomicAnnotations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions src/record.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
14 changes: 7 additions & 7 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

2 comments on commit 9f30598

@kdyrhage
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Iterating over an AbstractLocus now yields the locus itself for simple loci, or the constituent loci for a compound locus (i.e. a Join or an Order). A compound locus wrapped in Complement will yield the constituent loci, individually wrapped in Complement, in reverse order. iscompound(locus) can be used to check whether locus is a compound locus or not. To get the pre-v0.4.3 behaviour of iterating over the individual positions, use eachposition(locus).

Adds GTF support, as well as readgtf(input) and readembl(input).

Adds genedata(gene) and attributes(gene) to make it easier to access the data associated with gene, either as a DataFrameRow referencing the original data in the case of the former, or as a NamedTuple containing copies of the data for the latter.

Adds feature!(gene, f), which can be used to change the feature of a gene.

Various bug fixes.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/119908

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.4.3 -m "<description of version>" 9f30598d5832659a8ecc8d5ea5f9ba654828ad42
git push origin v0.4.3

Please sign in to comment.