Skip to content

Commit

Permalink
Remove Protein submodule and Zygote extension, torsional -> torsion
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonOresten committed Sep 1, 2024
1 parent b290aa5 commit 0cf7f2b
Show file tree
Hide file tree
Showing 26 changed files with 100 additions and 1,042 deletions.
14 changes: 2 additions & 12 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
name = "Backboner"
uuid = "9ac9c2a2-1cfe-46d3-b3fd-6fa470ea56a7"
authors = ["Anton Oresten <anton.oresten42@gmail.com>"]
version = "0.11.4"
version = "0.12.0"

[deps]
BioStructures = "de9282ab-8554-53be-b2d6-f6c222edabfc"
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
NNlib = "872c559c-99b0-510c-b3b7-b6c96a88d5cd"
PrecompileTools = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"

[weakdeps]
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[extensions]
ZygoteIdealizationExt = ["Zygote"]

[compat]
BioStructures = "4"
LinearAlgebra = "1"
NNlib = "0.9"
PrecompileTools = "1"
Rotations = "1"
StaticArrays = "1"
Zygote = "0.6"
julia = "1"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"

[targets]
test = ["Test", "Zygote"]
test = ["Test"]
55 changes: 16 additions & 39 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ This package offers types and functions for working with molecular *backbones*,

Backbones can be represented with different types:
- `Backbone`: a type containing a 3xN matrix of coordinates
- `ChainedBonds`: a type that holds vectors of bond lengths, bond angles, and dihedral angles
- `ChainedBonds`: a type that holds vectors of bond lengths, bond angles, and torsion angles
- `Frames`: a collection of rotations and translations (e.g. for representing orientations and locations of protein residues)

The `Protein` submodule contains utilities for working specifically with proteins. A protein can be loaded from a PDB file using the `Backboner.Protein.readpdb` function, which returns a `Vector{Backboner.Protein.Chain}`. Conversely, a `Vector{Backboner.Protein.Chain}` instance can be written to a PDB file using the `writepdb` function.
Most functions are implemented especially with differentiability in mind, and can be used in combination with automatic differentiation packages like [Zygote.jl](https://github.com/FluxML/Zygote.jl).

## Installation

Expand All @@ -26,48 +26,25 @@ add Backboner
## Example usage

```julia
julia> using Backboner, Backboner.Protein

julia> chains = readpdb("test/data/1ZAK.pdb")
2-element Vector{Chain}:
Chain A with 220 residues
Chain B with 220 residues

julia> backbone = chains[1].backbone
660-element Backbone{Float64, Matrix{Float64}}:
[22.346, 17.547, 23.294]
[22.901, 18.031, 21.993]
[23.227, 16.793, 21.163]
[24.115, 16.923, 20.175]
[24.478, 15.779, 19.336]
[21.480, 14.668, 4.974]
[22.041, 14.866, 3.569]
[21.808, 13.861, 2.734]
[22.263, 13.862, 1.355]
[21.085, 14.233, 0.446]
julia> using Backboner

julia> backbone = Backbone(rand(Float32, 3, 9))
10-element Backbone{Float32, Matrix{Float32}}:
[0.48967552, 0.91008425, 0.5339774]
[0.2951318, 0.38963223, 0.8952989]
[0.83763623, 0.5279301, 0.3407849]
[0.88848716, 0.643387, 0.76827604]
[0.697279, 0.63588345, 0.0889622]
[0.08590478, 0.6086006, 0.6478121]
[0.06308746, 0.6704904, 0.55852276]
[0.46147835, 0.56259614, 0.7884294]
[0.9694153, 0.052023113, 0.08127427]

julia> ChainedBonds(backbone)
ChainedBonds{Float64, Vector{Float64}} with 659 bonds, 658 angles, and 657 dihedrals
ChainedBonds{Float32, Vector{Float32}} with 8 bond lengths, 7 bond angles, and 6 torsion angles

julia> is_knotted(backbone)
false

julia> import Zygote # unlock the `idealize` method for backbones

julia> idealize(backbone, Float64[1.46, 1.52, 1.33], Float64[1.94, 2.04, 2.13])
660-element Backbone{Float64, Matrix{Float64}}:
[22.348574, 17.582397, 23.289886]
[22.90583, 17.977451, 21.999538]
[23.216103, 16.762234, 21.140835]
[24.204561, 16.88515, 20.259508]
[24.52946, 15.827013, 19.307465]
[21.501173, 14.705252, 4.9825864]
[22.007494, 14.864742, 3.5582967]
[21.822643, 13.836198, 2.7356021]
[22.24875, 13.874594, 1.3396943]
[21.091076, 14.233609, 0.42247167]
```

[^1]: In some contexts, the term *backbone* may be used more loosely, and allow for atoms that are not part of the main continuous chain of atoms. This package does not support storing e.g. oxygen and beta-carbon atoms in the matrix of coordinates, as they are not part of the continuous chain of atoms.
3 changes: 1 addition & 2 deletions docs/make.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ makedocs(;
doctest = false,
pages = [
"Overview" => "index.md",
"Backboner API" => "backboner.md",
"Protein API" => "protein.md",
"API Reference" => "API.md",
],
authors = "Anton Oresten",
checkdocs = :all,
Expand Down
File renamed without changes.
59 changes: 19 additions & 40 deletions docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,14 @@ end
[![Build Status](https://github.com/MurrellGroup/Backboner.jl/actions/workflows/CI.yml/badge.svg?branch=main)](https://github.com/MurrellGroup/Backboner.jl/actions/workflows/CI.yml?query=branch%3Amain)
[![Coverage](https://codecov.io/gh/MurrellGroup/Backboner.jl/branch/main/graph/badge.svg)](https://codecov.io/gh/MurrellGroup/Backboner.jl)

Backboner is a Julia package that offers a set of types and functions for working with molecular *backbones*: defined here as continuous chains of bonded atoms.[^1] The package provides a few different types for representing backbones:
This package offers types and functions for working with molecular *backbones*, defined here as continuous chains of bonded atoms.[^1]

Backbones can be represented with different types:
- `Backbone`: a type containing a 3xN matrix of coordinates
- `ChainedBonds`: a type that holds vectors of bond lengths, bond angles, and dihedral angles
- `ChainedBonds`: a type that holds vectors of bond lengths, bond angles, and torsion angles
- `Frames`: a collection of rotations and translations (e.g. for representing orientations and locations of protein residues)

The `Protein` submodule contains functions and types for working specifically with proteins. A protein can be loaded from a PDB file using the `Backboner.Protein.readpdb` function, which returns a `Vector{Backboner.Protein.Chain}`. Conversely, a `Vector{Backboner.Protein.Chain}` instance can be written to a PDB file using the `writepdb` function.
Most functions are implemented especially with differentiability in mind, and can be used in combination with automatic differentiation packages like [Zygote.jl](https://github.com/FluxML/Zygote.jl).

[View the source code on GitHub](https://github.com/MurrellGroup/Backboner.jl) (licensed under MIT).

Expand All @@ -33,48 +35,25 @@ add Backboner
## Example usage

```julia
julia> using Backboner, Backboner.Protein

julia> chains = readpdb("test/data/1ZAK.pdb")
2-element Vector{Chain}:
Chain A with 220 residues
Chain B with 220 residues

julia> backbone = chains[1].backbone
660-element Backbone{Float64, Matrix{Float64}}:
[22.346, 17.547, 23.294]
[22.901, 18.031, 21.993]
[23.227, 16.793, 21.163]
[24.115, 16.923, 20.175]
[24.478, 15.779, 19.336]
[21.48, 14.668, 4.974]
[22.041, 14.866, 3.569]
[21.808, 13.861, 2.734]
[22.263, 13.862, 1.355]
[21.085, 14.233, 0.446]
julia> using Backboner

julia> backbone = Backbone(rand(Float32, 3, 9))
10-element Backbone{Float32, Matrix{Float32}}:
[0.48967552, 0.91008425, 0.5339774]
[0.2951318, 0.38963223, 0.8952989]
[0.83763623, 0.5279301, 0.3407849]
[0.88848716, 0.643387, 0.76827604]
[0.697279, 0.63588345, 0.0889622]
[0.08590478, 0.6086006, 0.6478121]
[0.06308746, 0.6704904, 0.55852276]
[0.46147835, 0.56259614, 0.7884294]
[0.9694153, 0.052023113, 0.08127427]

julia> ChainedBonds(backbone)
ChainedBonds{Float64, Vector{Float64}} with 659 bonds, 658 angles, and 657 dihedrals
ChainedBonds{Float32, Vector{Float32}} with 8 bond lengths, 7 bond angles, and 6 torsion angles

julia> is_knotted(backbone)
false

julia> import Zygote # unlock the `idealize` method for backbones

julia> idealize(backbone, Float64[1.46, 1.52, 1.33], Float64[1.94, 2.04, 2.13])
660-element Backbone{Float64, Matrix{Float64}}:
[22.348574, 17.582397, 23.289886]
[22.90583, 17.977451, 21.999538]
[23.216103, 16.762234, 21.140835]
[24.204561, 16.88515, 20.259508]
[24.52946, 15.827013, 19.307465]
[21.501173, 14.705252, 4.9825864]
[22.007494, 14.864742, 3.5582967]
[21.822643, 13.836198, 2.7356021]
[22.24875, 13.874594, 1.3396943]
[21.091076, 14.233609, 0.42247167]
```

[^1]: In some contexts, the term *backbone* may be used more loosely, and allow for atoms that are not part of the main continuous chain of atoms. This package does not support storing e.g. oxygen and beta-carbon atoms in the matrix of coordinates, as they are not part of the continuous chain of atoms.
7 changes: 0 additions & 7 deletions docs/src/protein.md

This file was deleted.

95 changes: 0 additions & 95 deletions ext/ZygoteIdealizationExt.jl

This file was deleted.

13 changes: 4 additions & 9 deletions src/Backboner.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,16 @@ export prepend_bonds!, prepend_bonds
export get_bond_vectors
export get_bond_lengths
export get_bond_angles
export get_torsional_angles
export get_torsion_angles

export Frames

export is_knotted

export idealize

export Protein

include("backbone.jl")
include("bonds.jl")
include("frames.jl")
include("knots.jl")
include("idealization.jl")
include("protein/protein.jl")

using PrecompileTools

Expand All @@ -33,8 +27,9 @@ using PrecompileTools
bonds = ChainedBonds(backbone)
Backbone(bonds)

frames = Frames(backbone, Protein.STANDARD_TRIANGLE_ANGSTROM)
Backbone(frames, Protein.STANDARD_TRIANGLE_ANGSTROM)
standard = randn(3,3)
frames = Frames(backbone, standard)
Backbone(frames, standard)

is_knotted(backbone)
end
Expand Down
Loading

0 comments on commit 0cf7f2b

Please sign in to comment.