From 5da7dc8869f78dd5f8d49f23fb3ad0524838ec5a Mon Sep 17 00:00:00 2001 From: "Documenter.jl" Date: Fri, 22 Nov 2024 18:15:59 +0000 Subject: [PATCH] build based on d393965 --- dev/.documenter-siteinfo.json | 2 +- dev/accessing/index.html | 14 +++++++------- dev/examples/index.html | 2 +- dev/genes/index.html | 2 +- dev/index.html | 2 +- dev/io/index.html | 6 +++--- dev/loci/index.html | 2 +- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/dev/.documenter-siteinfo.json b/dev/.documenter-siteinfo.json index ccd3048..c3b3908 100644 --- a/dev/.documenter-siteinfo.json +++ b/dev/.documenter-siteinfo.json @@ -1 +1 @@ -{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-22T08:29:09","documenter_version":"1.8.0"}} \ No newline at end of file +{"documenter":{"julia_version":"1.11.1","generation_timestamp":"2024-11-22T18:15:55","documenter_version":"1.8.0"}} \ No newline at end of file diff --git a/dev/accessing/index.html b/dev/accessing/index.html index 1fa0071..53a2526 100644 --- a/dev/accessing/index.html +++ b/dev/accessing/index.html @@ -1,6 +1,6 @@ -Accessing and modifying annotations · GenomicAnnotations.jl

Accessing and modifying annotations

Features

The following functions can be used to read and modify the data associated with a gene:

GenomicAnnotations.locus!Function
locus!(gene::AbstractGene, loc)
-locus!(gene::AbstractGene, loc::AbstractLocus)

Replace gene with a new Gene with loc as its Locus. If loc is not an AbstractLocus, it is parsed with Locus(loc).

source
GenomicAnnotations.feature!Function
feature!(g::Gene, f::Symbol)

Change the feature of g to f, returning a new instance of Gene. Since Genes are immutable, feature! only mutates the parent of g and not g itself. Thus, in the first example below the original unmodified g is printed, not the updated version:

# This will not work as expected:
+Accessing and modifying annotations · GenomicAnnotations.jl

Accessing and modifying annotations

Features

The following functions can be used to read and modify the data associated with a gene:

GenomicAnnotations.locus!Function
locus!(gene::AbstractGene, loc)
+locus!(gene::AbstractGene, loc::AbstractLocus)

Replace gene with a new Gene with loc as its Locus. If loc is not an AbstractLocus, it is parsed with Locus(loc).

source
GenomicAnnotations.feature!Function
feature!(g::Gene, f::Symbol)

Change the feature of g to f, returning a new instance of Gene. Since Genes are immutable, feature! only mutates the parent of g and not g itself. Thus, in the first example below the original unmodified g is printed, not the updated version:

# This will not work as expected:
 for source in @genes(chr, source)
     feature!(source, :region)
     println(source)
@@ -9,10 +9,10 @@
 # But this will:
 for source in @genes(chr, source)
     source = feature!(source, :region)
-    println(source)
source
Base.parentMethod
parent(g::Gene)
-parent(gs::AbstractVector{Gene})

Return the parent Record of g. Errors for AbstractVector{Gene}s if the genes do not come from the same parent.

source
GenomicAnnotations.attributesFunction
attributes(g::Gene)

Return an immutable NamedTuple containing copies of all annotated attributes of g. Missing attributes are excluded. See genedata for a non-allocating way to access the gene data directly.

source

Features (genes) can be added using addgene!. A feature must have a feature name and a locus (position), and can have any number of additional qualifiers associated with it (see next section).

GenomicAnnotations.addgene!Function
addgene!(chr::Record, feature, locus; kw...)

Add gene to chr. locus can be an AbstractLocus, a String, a UnitRange, or a StepRange (for decreasing ranges, which will be annotated on the complementary strand).

Example

addgene!(chr, "CDS", 1:756;
+    println(source)
source
Base.parentMethod
parent(g::Gene)
+parent(gs::AbstractVector{Gene})

Return the parent Record of g. Errors for AbstractVector{Gene}s if the genes do not come from the same parent.

source
GenomicAnnotations.attributesFunction
attributes(g::Gene)

Return an immutable NamedTuple containing copies of all annotated attributes of g. Missing attributes are excluded. See genedata for a non-allocating way to access the gene data directly.

source

Features (genes) can be added using addgene!. A feature must have a feature name and a locus (position), and can have any number of additional qualifiers associated with it (see next section).

GenomicAnnotations.addgene!Function
addgene!(chr::Record, feature, locus; kw...)

Add gene to chr. locus can be an AbstractLocus, a String, a UnitRange, or a StepRange (for decreasing ranges, which will be annotated on the complementary strand).

Example

addgene!(chr, "CDS", 1:756;
     locus_tag = "gene0001",
-    product = "Chromosomal replication initiator protein dnaA")
source

After adding a new feature, sort!(chr) can be used to make sure that the annotations are stored (and printed) in the order in which they occur on the chromosome.

Existing features can be removed using delete!:

Base.delete!Method
delete!(gene::AbstractGene)

Delete gene from parent(gene). Warning: does not work when broadcasted! Use delete!(::AbstractVector{Gene}) instead.

source
Base.delete!Method
delete!(genes::AbstractArray{Gene, 1})

Delete all genes in genes from parent(genes[1]).

Example

delete!(@genes(chr, length(gene) <= 60))
source

Qualifiers

Features can have multiple attributes/qualifiers, which can be modified using Julia's property syntax:

# Remove newspace from gene product descriptions
+    product = "Chromosomal replication initiator protein dnaA")
source

After adding a new feature, sort!(chr) can be used to make sure that the annotations are stored (and printed) in the order in which they occur on the chromosome.

Existing features can be removed using delete!:

Base.delete!Method
delete!(gene::AbstractGene)

Delete gene from parent(gene). Warning: does not work when broadcasted! Use delete!(::AbstractVector{Gene}) instead.

source
Base.delete!Method
delete!(genes::AbstractArray{Gene, 1})

Delete all genes in genes from parent(genes[1]).

Example

delete!(@genes(chr, length(gene) <= 60))
source

Qualifiers

Features can have multiple attributes/qualifiers, which can be modified using Julia's property syntax:

# Remove newspace from gene product descriptions
 for gene in @genes(chr, CDS)
     replace!(gene.product, '\n' => ' ')
 end

Properties also work on views of genes, typically generated using @genes:

interestinggenes = readlines("/path/to/list/of/interesting/genes.txt")
@@ -28,7 +28,7 @@
  "EC:4.3.2.1"
 
 julia> eltype(chr.genedata[!, :EC_number])
-Union{Missing, Array{String,1}}
source

Accessing properties that haven't been stored will return missing. For this reason, it often makes more sense to use get() than to access the property directly.

# chr.genes[2].pseudo returns missing, so this will throw an error
+Union{Missing, Array{String,1}}
source

Accessing properties that haven't been stored will return missing. For this reason, it often makes more sense to use get() than to access the property directly.

# chr.genes[2].pseudo returns missing, so this will throw an error
 if chr.genes[2].pseudo
     println("Gene 2 is a pseudogene")
 end
@@ -36,4 +36,4 @@
 # ... but this works:
 if get(chr.genes[2], :pseudo, false)
     println("Gene 2 is a pseudogene")
-end

Sequences

The sequence of a Chromosome chr is stored in chr.sequence. Sequences of individual features can be read with sequence:

GenomicAnnotations.sequenceMethod
sequence(gene::AbstractGene; translate = false, preserve_alternate_start = false)

Return genomic sequence for gene. If translate is true, the sequence will be translated to a LongAA, excluding the stop, otherwise it will be returned as a LongDNA{4} (including the stop codon). If preserve_alternate_start is set to false, alternate start codons will be assumed to code for methionine. ```

source
+end

Sequences

The sequence of a Chromosome chr is stored in chr.sequence. Sequences of individual features can be read with sequence:

GenomicAnnotations.sequenceMethod
sequence(gene::AbstractGene; translate = false, preserve_alternate_start = false)

Return genomic sequence for gene. If translate is true, the sequence will be translated to a LongAA, excluding the stop, otherwise it will be returned as a LongDNA{4} (including the stop codon). If preserve_alternate_start is set to false, alternate start codons will be assumed to code for methionine. ```

source
diff --git a/dev/examples/index.html b/dev/examples/index.html index 073a5b1..98184c3 100644 --- a/dev/examples/index.html +++ b/dev/examples/index.html @@ -79,4 +79,4 @@ end write(w, chr) end -end +end diff --git a/dev/genes/index.html b/dev/genes/index.html index 55679c9..550be1e 100644 --- a/dev/genes/index.html +++ b/dev/genes/index.html @@ -28,4 +28,4 @@ @genes(chr, :locus_tag in d[$:category1]) gene = chr.genes[5] -@genes(chr, gene == $gene)source +@genes(chr, gene == $gene)source diff --git a/dev/index.html b/dev/index.html index d2b5909..733afe2 100644 --- a/dev/index.html +++ b/dev/index.html @@ -36,4 +36,4 @@ open(GenBank.Writer, "updated.gbk") do w write(w, chr) -end +end diff --git a/dev/io/index.html b/dev/io/index.html index 1f630e6..08c66f1 100644 --- a/dev/io/index.html +++ b/dev/io/index.html @@ -7,8 +7,8 @@ for record in record print(record) end -endsource
GenomicAnnotations.GFF.ReaderType
GFF.Reader(input::IO)

Create a data reader of the GFF3 file format.

source

Output

Annotations can be printed with GenBank formatting using GenBank.Writer, and as GFF3 with GFF.Writer. Headers are not automatically converted between formats; GFF.Writer only prints the header of the first Record, and only if it starts with a #, while GenBank.Writer prints a default header if the stored one starts with #.

GenomicAnnotations.GenBank.WriterType
GenBank.Writer(output::IO; width=70)

Create a data writer of the GenBank file format.

open(GenBank.Writer, outfile) do writer
+end
source
GenomicAnnotations.GFF.ReaderType
GFF.Reader(input::IO)

Create a data reader of the GFF3 file format.

source

Output

Annotations can be printed with GenBank formatting using GenBank.Writer, and as GFF3 with GFF.Writer. Headers are not automatically converted between formats; GFF.Writer only prints the header of the first Record, and only if it starts with a #, while GenBank.Writer prints a default header if the stored one starts with #.

GenomicAnnotations.GenBank.WriterType
GenBank.Writer(output::IO; width=70)

Create a data writer of the GenBank file format.

open(GenBank.Writer, outfile) do writer
     write(writer, genome)
-end
source
GenomicAnnotations.GFF.WriterType
GFF.Writer(output::IO; width=70)

Create a data writer of the GFF file format.

open(GFF.Writer, outfile) do writer
+end
source
GenomicAnnotations.GFF.WriterType
GFF.Writer(output::IO; width=70)

Create a data writer of the GFF file format.

open(GFF.Writer, outfile) do writer
     write(writer, genome)
-end
source

In the REPL, instances of Gene are displayed as they would be in the annotation file.

+endsource

In the REPL, instances of Gene are displayed as they would be in the annotation file.

diff --git a/dev/loci/index.html b/dev/loci/index.html index 7c8d1b7..442a1f3 100644 --- a/dev/loci/index.html +++ b/dev/loci/index.html @@ -6,4 +6,4 @@ complement(1..3)

The eachposition(locus) function is provided for iterating over the individual genomic positions in the locus. Note that this ignores any metadata such as strandedness.

julia> for p in eachposition(Locus("complement(join(1..3,7..9))"))
            print(p)
        end
-987321
+987321