https://github.com/murrellgroup/proteinchains.jl
https://github.com/murrellgroup/proteinchains.jl
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/murrellgroup/proteinchains.jl
- Owner: MurrellGroup
- License: mit
- Created: 2024-08-16T10:39:27.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2025-03-09T20:02:20.000Z (about 1 year ago)
- Last Synced: 2025-03-09T20:27:55.162Z (about 1 year ago)
- Language: Julia
- Homepage:
- Size: 718 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ProteinChains
[](https://MurrellGroup.github.io/ProteinChains.jl/stable/)
[](https://MurrellGroup.github.io/ProteinChains.jl/dev/)
[](https://github.com/MurrellGroup/ProteinChains.jl/actions/workflows/CI.yml?query=branch%3Amain)
[](https://codecov.io/gh/MurrellGroup/ProteinChains.jl)
This Julia package implements the `ProteinChain` type: a chain-level structure-of-arrays type representation of proteins, with support for dynamic properties and indexing by residue indices.
## Installation
```julia
using Pkg
Pkg.add("ProteinChains")
```
## Quickstart
The `ProteinChain` type is meant to only store a basic set of fields, from which some other properties might be derived.
```julia
julia> using ProteinChains
julia> structure = pdb"1EYE" # string macro to fetch proteins from the PDB
[ Info: File exists: 1EYE
1-element ProteinStructure "1EYE.cif":
256-residue ProteinChain{Float64} (A)
julia> chain = structure["A"]
256-residue ProteinChain{Float64} (A)
julia> propertynames(chain)
(:id, :atoms, :sequence, :numbering, :ins_codes)
```
To store additional properties, simply set them like you would set a field of a mutable struct:
```julia
julia> chain.taxid = 83332
83332
```
For chain-wise properties, the values can be wrapped with `Indexable` to index the last dimension of the array when the chain gets indexed:
```julia
julia> chain.rand3 = Indexable(rand(3,256)) # last dimension matches chain length
Indexable wrapping a Matrix{Float64} (get value with `unwrap(x)`)
julia> chain[1:100].rand3 |> unwrap
3×100 view(::Matrix{Float64}, :, 1:100) with eltype Float64:
0.273545 0.639173 0.92708 … 0.459441 0.196407 0.880034
0.981498 0.70263 0.279264 0.552049 0.89274 0.0328866
0.169268 0.117848 0.732741 0.301921 0.187094 0.281187
julia> propertynames(chain)
(:id, :atoms, :sequence, :numbering, :ins_codes, :taxid, :rand3)
```
## See also
- [BioStructures.jl](https://github.com/BioJulia/BioStructures.jl)
- [Backboner.jl](https://github.com/MurrellGroup/Backboner.jl)
- [PDBTools.jl](https://github.com/m3g/PDBTools.jl)