前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Julia-BioStructures

Julia-BioStructures

作者头像
DrugScience
发布2021-02-22 14:42:21
2.1K0
发布2021-02-22 14:42:21
举报
文章被收录于专栏:DrugScience

Description

BioStructures提供了读取,写入和操纵大分子结构(蛋白质)的功能。可以将Protein Data Bank(PDB),mmCIF和MMTF格式的文件读入。还提供了访问PDB的功能。

Web

GitHub - BioJulia/BioStructures.jl: A Julia package to read, write and manipulate macromolecular structures (particularly proteins)

Cite

Greener JG, Selvaraj J and Ward BJ. BioStructures.jl: read, write and manipulate macromolecular structures in Julia, Bioinformatics 36(14):4206-4207 (2020) - link - PDF

Language

Julia:https://cn.julialang.org/

Installation:

代码语言:javascript
复制
]
add BioStructures

Usage

代码语言:javascript
复制


Home · BioStructures.jl
# 下载pdb文件
using BioStructures
# 显示当前文件夹
pwd()
# 下载到当前文件夹中
downloadpdb("1EN2")

[ Info: Downloading file from PDB: 1EN2
"path/to/1EN2.pdb"
#将pdb文件解析到一个Structure-Model-Chain-Residue-Atom框架中
struc = read("/path/to/pdb/file.pdb", PDB)
ProteinStructure 1EN2.pdb with 1 models, 2 chains (A,B), 85 residues, 754 atoms
#可以使用read(“ / path / to / cif / file.cif”,MMCIF)将mmCIF文件读入相同的数据结构。
#使用MMCIFDict将mmCIF读入到字典中

julia> mmcif_dict = MMCIFDict("/path/to/cif/file.cif")
mmCIF dictionary with 716 fields

#可以通过类似与字典的方式访问MMCIFDict
julia> mmcif_dict["_entity_src_nat.common_name"]
1-element Array{String,1}:
 "great nettle"

#要将MMCIFDict或MMTFDict转换为Structure-Model-Chain-Residue-Atom框架,
#可以使用ProteinStructure构造函数,例如 蛋白质ProteinStructure(mmcif_dict)

可以按以下方式访问struc的元素:

Command

Returns

Return type

struc[1]

Model 1

Model

struc[1]["A"]

Model 1, chain A

Chain

struc[1]['A']

Shortcut to above if the chain ID is a single character

Chain

struc["A"]

The lowest model (model 1), chain A

Chain

struc["A"]["50"]

Model 1, chain A, residue 50

AbstractResidue

struc["A"][50]

Shortcut to above if it is not a hetero residue and the insertion code is blank

AbstractResidue

struc["A"]["H_90"]

Model 1, chain A, hetero residue 90

AbstractResidue

struc["A"][50]["CA"]

Model 1, chain A, residue 50, atom name CA

AbstractAtom

struc["A"][15]["CG"]['A']

For disordered atoms, access a specific location

Atom

无序原子存储在DisorderedAtom容器,如果对它不感兴趣,则可以忽略无序。

无序残基(即具有不同残基名称的点突变)存储在DisorderedResidue容器中。

例如:

代码语言:javascript
复制
代码语言:javascript
复制
julia> struc[1]
Model 1 with 2 chains (A,B), 85 residues, 754 atoms
 julia> struc[1]["A"]
Chain A with 85 residues, 77 other molecules, 698 atoms
 julia> struc["A"][50]["CA"]
Atom CA with serial 411, coordinates [2.143, -0.866, 34.446]
 julia> x(struc["A"][50]["CA"])
2.143
julia> coords(struc["A"][50]["CA"])
3-element Array{Float64,1}:
  2.143
 -0.866
 34.446
代码语言:javascript
复制

属性

参见:https://biojulia.net/BioStructures.jl/stable/documentation/#Manipulating-structures

可以使用x!, y!, z!来设置原子的坐标。和coords!

操作结构

基本按下图所示

代码语言:javascript
复制
代码语言:javascript
复制
for mod in struc
    for ch in mod
        for res in ch
            for at in res
                # Do something
            end
        end
    end
end
代码语言:javascript
复制

Models按照数字排列;

  • chains按chains ID字符排序,空链为最后;
  • residue 按 residue 编号排序,和插入代码排序,标准残基后带有杂残基;
  • atom 按 atom 序号排序。
  • 如果需要第一个子元素,则可以先使用。例如,first(struc [1])获取模型1中的第一条链。由于定义了元素的顺序,因此可以使用sort函数。例如,sort(res)如上所述对残基列表进行排序,或者sort(res,by = resname)将按残基名称按字母顺序对其进行排序。
  • collect可用于获取子元素数组。收集原子,收集残基,收集链和收集模型从结构元素或元素数组返回特定类型的数组。由于大多数操作使用单个的原子或残基,因此默认情况下不会使用无序原子或者残基,仅存在一个实体。可以通过在collectatoms或collectresidues中将expand_disordered设置为true来更改它。

Selectors 是作为附加参数传递给这些函数的函数。仅保留传递给所有选择器时返回true的元素。例如:

Command

Action

Return type

collect(struc['A'][50])

Collect the sub-elements of an element, e.g. atoms from a residue

Array{AbstractAtom,1}

collectresidues(struc)

Collect the residues of an element

Array{AbstractResidue,1}

collectatoms(struc)

Collect the atoms of an element

Array{AbstractAtom,1}

collectatoms(struc, calphaselector)

Collect the Cα atoms of an element

Array{AbstractAtom,1}

collectatoms(struc, calphaselector, disorderselector)

Collect the disordered Cα atoms of an element

Array{AbstractAtom,1}

code

代码语言:javascript
复制
代码语言:javascript
复制
julia> collect(struc['A'][50])
4-element Array{AbstractAtom,1}:
 Atom N with serial 410, coordinates [3.193, 0.151, 34.344]
 Atom CA with serial 411, coordinates [2.143, -0.866, 34.446]
 Atom C with serial 412, coordinates [0.822, -0.238, 34.87]
 Atom O with serial 413, coordinates [0.703, 0.947, 35.143]
创造一个新的选择子 atomnameselector or resnameselector
cdeltaselector(at::AbstractAtom) = atomnameselector(at, ["CD"])
创造一个选择子,选择X坐标均小于0的原子
julia> xselector(at) = x(at) < 0   
julia> collectatoms(struc, xselector)   
137-element Array{AbstractAtom,1}:  Atom N with serial 9, coordinates [-2.607, 4.673, 13.504]    Atom CA with serial 10, coordinates [-3.091, 6.01, 13.918]    Atom C with serial 11, coordinates [-3.361, 6.101, 15.403]    Atom O with serial 12, coordinates [-3.742, 5.121, 16.05]    Atom CB with serial 13, coordinates [-4.348, 6.395, 13.124]    Atom CG with serial 14, coordinates [-4.11, 6.337, 11.619]    Atom CD with serial 15, coordinates [-4.277, 7.652, 10.942]    Atom NE with serial 16, coordinates [-3.441, 8.73, 11.457]    Atom CZ with serial 17, coordinates [-3.55, 9.979, 10.98]    Atom NH1 with serial 18, coordinates [-4.444, 10.212, 10.022]    Atom NH2 with serial 19, coordinates [-2.804, 10.949, 11.444]    Atom N with serial 20, coordinates [-3.248, 7.317, 15.948]    Atom CA with serial 21, coordinates [-3.419, 7.555, 17.361]    Atom C with serial 22, coordinates [-3.637, 9.026, 17.672]    ?    Atom O with serial 777, coordinates [-1.326, 14.783, 10.991]    Atom O with serial 787, coordinates [-3.992, 5.719, 31.647]    Atom O with serial 788, coordinates [-0.321, 12.255, 8.483]    Atom O with serial 790, coordinates [-3.066, 4.753, 29.076]    Atom O with serial 791, coordinates [-0.945, 1.949, 9.712]    Atom O with serial 792, coordinates [-7.059, 6.398, 16.836]    Atom O with serial 794, coordinates [-6.832, 2.828, 21.276]    Atom O with serial 798, coordinates [-2.996, 7.951, 27.405]    Atom O with serial 799, coordinates [-4.774, 1.179, 18.535]    Atom O with serial 801, coordinates [-8.668, 12.634, 15.67]    Atom O with serial 810, coordinates [-4.389, 3.044, 11.77]    Atom O with serial 814, coordinates [-6.184, 3.543, 26.723]    Atom O with serial 819, coordinates [-0.903, 8.986, 28.883]
代码语言:javascript
复制
  • 得到蛋白的一级序列
代码语言:javascript
复制
julia>  LongAminoAcidSeq(struc['A'], standardselector)
85aa Amino Acid Sequence:
RCGSQGGGSTCPGLRCCSIWGWCGDSEPYCGRTCENKCW…RCGAAVGNPPCGQDRCCSVHGWCGGGNDYCSGGNCQYRC

相关空间计算

一系列的函数用于计算蛋白的空间质量

Command

Returns

distance

Minimum distance between two elements

sqdistance

Minimum square distance between two elements

coordarray

Atomic coordinates in ? of an element as a 2D Array with each column corresponding to one atom

bondangle

Angle between three atoms

dihedralangle

Dihedral angle defined by four atoms

omegaangle

Omega dihedral angle between a residue and the previous residue

phiangle

Phi dihedral angle between a residue and the previous residue

psiangle

Psi dihedral angle between a residue and the next residue

omegaangles

Vector of omega dihedral angles of an element

phiangles

Vector of phi dihedral angles of an element

psiangles

Vector of psi dihedral angles of an element

ramachandranangles

Vectors of phi and psi angles of an element

ContactMap

ContactMap of two elements, or one element with itself

DistanceMap

DistanceMap of two elements, or one element with itself

showcontactmap

Print a representation of a ContactMap to stdout or a specified IO instance

Transformation

The 3D transformation to map one set of coordinates onto another

applytransform!

Modify all coordinates in an element according to a transformation

applytransform

Modify coordinates according to a transformation

superimpose!

Superimpose one element onto another

rmsd

RMSD between two elements, with or without superimposition

displacements

Vector of displacements between two elements, with or without superimposition

MetaGraph

Construct a MetaGraph of contacting elements

omegaangle, phiangle and psiangle函数可以测量一对残基或链和位置。omegaangle and phiangle函数测量给定序号的残基与序号之前的残基之间的角度。psiangle 函数测量给定序号的残基与序号之后的残基之间的角度。

例如:

代码语言:javascript
复制
julia> distance(struc['A'][10], struc['A'][20])
10.782158874733762

julia> rad2deg(bondangle(struc['A'][50]["N"], struc['A'][50]["CA"], struc['A'][50]["C"]))
110.77765846083398

julia> rad2deg(dihedralangle(struc['A'][50]["N"], struc['A'][50]["CA"], struc['A'][50]["C"], struc['A'][51]["N"]))
-177.38288114072924

julia> rad2deg(psiangle(struc['A'][50], struc['A'][51]))
-177.38288114072924

julia> rad2deg(psiangle(struc['A'], 50))
-177.38288114072924
代码语言:javascript
复制

ContactMap 采用结构或列表(如链或 Vector[Atom])作为输入,并返回一个 ContactMap 对象。该对象显示基于指定距离的元素之间的接触。可以给ContactMap两个结构元素作为参数,在这种情况下,将返回一个非对称的2D数组显示接触。可以使用contact.data访问ContactMap的基础BitArray。

代码语言:javascript
复制
julia> contacts = ContactMap(collectatoms(struc['A'], cbetaselector), 8.0)
Contact map of size (85, 85)
julia> using Plots
julia> plot(contacts)
代码语言:javascript
复制
代码语言:javascript
复制
julia> showcontactmap(contacts)

███ ?██▄█▄▄     ▄   ███           ▄▄                                                 
??██████??      ? ▄ █             █?                                                 
█▄█████▄▄         ??█▄            ?                                                  
?███?████▄                                                                           
?██  ??████  ▄  ▄                  ▄▄                                                
 ?      ??█████??     █?            ?                                                
         ▄█████                     ▄                ▄ ▄      ▄                   ██?
          █???███▄    ███   ██▄  ▄ ▄█▄▄                ▄                           ? 
 ??      ??   ?███▄▄████   ▄█   ▄██??                                                
   ?█            ████▄          █??                                                  
██???█          ██?████▄    ▄     ?                                                  
??        █?  ████  ?███▄▄  █▄                                                       
              ??       ███▄▄██                                                     ? 
                 ▄       ██████?▄                                                    
              ██??   ??████████ ?█   ▄▄                  ▄▄                          
               ?          █???████   ???                                             
               ▄▄██?       ?█▄████▄▄▄▄▄▄                                             
 ██??    ▄     ▄█?? ?            ███▄█                                               
         ??  ??█?            ▄▄  █▄███▄▄█             ?█                           ? 
               ?             ?█  █   █████             ??█?                          
                                    ??█████▄ ▄ ▄      ██▄█  ▄       ▄                
                                        ?█████??   ?  ?             ?                
                                         ▄█████▄        ▄          ▄▄▄               
                                         ▄█ ?████ ?█ ▄█▄▄     ▄▄  ███            ▄▄  
                                              ??██████?       ?   ?              ??  
                                          ▄   █▄█████▄▄           ?                  
             ▄                                 ▄██?████                           ▄  
             ▄ ▄                    █▄▄ ██?   ?█?  ???███▄                         ▄ 
                             ▄        █▄▄█   ? ?      ?███▄▄█??     █?             ? 
                             ?        ?                  ████         ▄              
                                         ?              █???██▄▄    ███▄  ██    ▄ ▄█▄
             ?                                 █?       ?    ███▄▄███▄   ▄█    ▄██???
                                                               ████▄          ????   
                                             ▄██? ?           ██?████▄    ▄      ?   
                                         ??  █??        █?  ██?█  ?████▄  █▄         
                                                           ??█      ?███▄███▄        
                                                               ▄      ▄██████  █     
                                                            ██??   ??████████▄ ██   ▄
                                                                       ????██████   █
                                                               ▄█       ▄▄▄▄█████    
                                               ▄▄            ?███ ▄       ??????███?█
            ██▄         ▄           ▄          ??    ? ▄▄   ▄██                 █?███
            ?                                                ??            ???  ?????
julia> contacts.data
85×85 BitArray{2}:
 1  1  1  0  1  1  1  0  1  0  0  0  0  0  0  0  0  0  0  0  1  1  1  …  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  1  1  0  0  1  1  1  1  1  1  0  0  0  0  0  1  0  0  0  1  1  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  1  1  1  1  1  1  1  1  1  0  0  0  0  0  0  1  0  0  0  1  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  1  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  1  0  1  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  0  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  1  1  1  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  1  1  1  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  1  1  0  …  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  1  1  1  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  1  1  1  0  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 1  1  1  0  0  1  1  1  1  1  1  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  1  1  0  0  0  0  1  1  1  1  0  0  1  0  0  1  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  1  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  0  0  0  0  0  1  …  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  0  0  0  0  0  0  0  1     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1
 0  0  0  0  0  0  0  0  0  1  1  1  1  1  1  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  0
 ?              ?              ?              ?              ?        ?        ?              ?              ?              ?           
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  1  1  1  1  1  1  0  0  1  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     1  0  0  0  0  0  0  1  1  1  1  1  1  1  0  0  1  0  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     1  0  0  0  1  1  1  1  1  1  1  1  1  1  0  0  1  1  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  …  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  0  1  1  0  0  0  1
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  1  0  0  0  1
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  1  0  0  0  1
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     0  1  0  0  0  0  0  0  0  0  0  0  0  1  1  1  1  1  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     1  1  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  0  0  0  0
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  …  1  1  0  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  1  1  1
 0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0     1  1  0  1  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  0  1
 0  0  0  0  0  0  0  0  0  0  0  0  1  1  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  1  1
 0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  0  1  0  1  1  1
 0  0  0  0  0  0  0  0  0  0  0  0  1  0  0  0  0  0  0  0  0  0  0     0  0  0  0  0  0  0  0  0  0  0  0  1  1  1  0  0  1  1  1  1  1
dists = DistanceMap(collectatoms(struc['A'], cbetaselector))
using Plots
plot(dists)
代码语言:javascript
复制

基于Kabsch algorithm的序列以及结构比对

代码语言:javascript
复制
# Change the coordinates of element 1 to superimpose it onto element 2
# Do sequence alignment with standard residues and calculate the transformation with Cα atoms (the default)
superimpose!(el1, el2, standardselector)

# The transformation object for the above superimposition
Transformation(el1, el2, standardselector)

# Calculate the transformation with backbone atoms
superimpose!(el1, el2, standardselector, alignatoms=backboneselector)

# Calculate RMSD on Cα atoms (the default) after superimposition
rmsd(el1, el2, standardselector)

# Superimpose based on backbone atoms and calculate RMSD based on Cβ atoms
rmsd(el1, el2, standardselector, alignatoms=backboneselector, rmsdatoms=cbetaselector)

# Do not do a superimposition - assumes the elements are already superimposed
rmsd(el1, el2, standardselector, superimpose=false)
代码语言:javascript
复制

蛋白结构中的接触形成图,可以使用MetaGraph检索该图形。可以使用 LightGraphs.jl.来进行分析

代码语言:javascript
复制
代码语言:javascript
复制
julia> mg = MetaGraph(collectatoms(struc["A"], cbetaselector), 8.0)
{85, 423} undirected Int64 metagraph with Float64 weights defined by :weight (default weight 1.0)

julia> using LightGraphs, MetaGraphs
# Number of vertices
julia> nv(mg)
85
# Number of edges
julia> ne(mg)
423

julia> get_prop(mg, :contactdist)
8.0

julia> mg[10, :element]
Atom CB with serial 71, coordinates [-3.766, 4.031, 23.526]
读取蛋白文件
julia> struc = read("/path/to/1EN2.pdb", PDB)
ProteinStructure 1EN2.pdb with 1 models, 1 chains (A), 85  residues, 754 atoms 
代码语言:javascript
复制

Keyword Argument

Description

structure_name::AbstractString

The name given to the returned ProteinStructure; defaults to the file name

remove_disorder::Bool=false

Whether to remove atoms with alt loc ID not ' ' or 'A'

read_std_atoms::Bool=true

Whether to read standard ATOM records

read_het_atoms::Bool=true

Whether to read HETATOM records

gzip::Bool=false

Whether the file is gzipped (MMTF and mmCIF files only)

结构转化为DataFrame

代码语言:javascript
复制
代码语言:javascript
复制
julia> df = DataFrame(collectatoms(struc));

julia> first(df, 3)
3×17 DataFrame. Omitted printing of 5 columns
│ Row │ ishetero │ serial │ atomname │ altlocid │ resname │ chainid │ resnumber │ inscode │ x       │ y       │ z       │ occupancy │
│     │ Bool     │ Int64  │ String   │ Char     │ String  │ String  │ Int64     │ Char    │ Float64 │ Float64 │ Float64 │ Float64   │
├─────┼──────────┼────────┼──────────┼──────────┼─────────┼─────────┼───────────┼─────────┼─────────┼─────────┼─────────┼───────────┤
│ 1   │ false    │ 1      │ N        │ ' '      │ GLU     │ A       │ 94        │ ' '     │ 15.637  │ -47.066 │ 18.179  │ 1.0       │
│ 2   │ false    │ 2      │ CA       │ ' '      │ GLU     │ A       │ 94        │ ' '     │ 14.439  │ -47.978 │ 18.304  │ 1.0       │
│ 3   │ false    │ 3      │ C        │ ' '      │ GLU     │ A       │ 94        │ ' '     │ 14.141  │ -48.183 │ 19.736  │ 1.0       │

julia> df = DataFrame(collectresidues(struc));

julia> first(df, 3)
3×8 DataFrame
│ Row │ ishetero │ resname │ chainid │ resnumber │ inscode │ countatoms │ modelnumber │ isdisorderedres │
│     │ Bool     │ String  │ String  │ Int64     │ Char    │ Int64      │ Int64       │ Bool            │
├─────┼──────────┼─────────┼─────────┼───────────┼─────────┼────────────┼─────────────┼─────────────────┤
│ 1   │ false    │ GLU     │ A       │ 94        │ ' '     │ 9          │ 1           │ false           │
│ 2   │ false    │ GLU     │ A       │ 95        │ ' '     │ 9          │ 1           │ false           │
│ 3   │ false    │ VAL     │ A       │ 96        │ ' '     │ 7          │ 1           │ false           │

输出蛋白结构

代码语言:javascript
复制
writepdb("1EN2_out.pdb", struc)
# Only backbone atoms are written out
writepdb("1EN2_out.pdb", struc, backboneselector)
writemmcif("1EN2_out.dic", mmcif_dict)
#查看某原子的recordline
julia> pdbline(struc["A"][50]["CA"])
"ATOM    411  CA  GLY A  50       2.143  -0.866  34.446  1.00 18.12           C  "
#产生新行
julia> pdbline(AtomRecord(false, 669, "CA", ' ', "ILE", "A", 90, ' ', [31.743, 33.11, 31.221], 1.00, 25.76, "C", ""))
"ATOM    669  CA  ILE A  90      31.743  33.110  31.221  1.00 25.76           C  "
代码语言:javascript
复制

结构可视化

代码语言:javascript
复制
using Bio3DView
using Blink
viewpdb("1CRN")

几个例子

  • PDB records for all Cα atoms within 5 ? of residue 38绘制蛋白的温度因子
代码语言:javascript
复制
using Plots
calphas = collectatoms(struc, calphaselector)
plot(resnumber.(calphas),
     tempfactor.(calphas),
     xlabel="Residue number",
     ylabel="Temperature factor",
     label="")
  • 展示38位氨基酸附近5A之内的所有的Cα原子
代码语言:javascript
复制
代码语言:javascript
复制
julia> for at in calphas
           if distance(struc['A'][38], at) < 5.0 && resnumber(at) != 38
               println(pdbline(at))
           end
       endATOM    144  CA  CYS A  17       4.659   6.900  21.426  1.00 10.21           C  
ATOM    302  CA  ASN A  37       1.497  10.964  24.209  1.00 12.65           C  
ATOM    319  CA  CYS A  39       6.632  10.077  25.433  1.00 11.58           C  
ATOM    436  CA  ASN A  55       0.391   2.709  32.223  1.00 19.27           C  
ATOM    444  CA  PRO A  56       2.969   5.491  31.927  1.00 13.73           C  
ATOM    451  CA  PRO A  57       5.722   5.426  29.322  1.00 12.65           C
  • 发现蛋白蛋白接触面处的氨基酸
代码语言:javascript
复制
for res_a in collectresidues(struc_2["A"], standardselector)
       for res_b in collectresidues(struc_2["B"], standardselector)
           if distance(res_a, res_b) < 5.0 
              println(resnumber(res_a), "A ", resnumber(res_b), "B")
           end
       end
   end
317A 737B
319A 740B
319A 745B
359A 167B
360A 168B
522A 230B
523A 230B
558A 45B
558A 281B
558A 282B
559A 45B
559A 282B
560A 38B
560A 282B
560A 283B
560A 284B
562A 38B
562A 41B
562A 42B
...
代码语言:javascript
复制
  • 展示蛋白结构的拉氏图
代码语言:javascript
复制
代码语言:javascript
复制
using Plots   
phi_angles, psi_angles = ramachandranangles(struc, standardselector)   
scatter(rad2deg.(phi_angles),rad2deg.(psi_angles),title="Ramachandran plot",xlabel="Phi / degrees",        ylabel="Psi / degrees",        label="",        xticks=[-180, -90, 0, 90, 180],        yticks=[-180, -90, 0, 90, 180],        xlims=(-180, 180),        ylims=(-180, 180))
  • 计算NMR结构中两个模型的重(非氢)原子之间的RMSD和位移:
代码语言:javascript
复制
julia> downloadpdb("1SSU")   
julia> struc_nmr = read("1SSU.pdb", PDB)   
julia> rmsd(struc_nmr[5], struc_nmr[10], superimpose=false, rmsdatoms=heavyatomselector)   
julia> displacements(struc_nmr[5], struc_nmr[10], superimpose=false, rmsdatoms=heavyatomselector)   
4.898672575300373    3.6131684156706565    3.2852496099992163    1.7051043956309546    1.246148466275186    0.6438858594502602    0.24807257002740143    0.5844458914219525    0.4401829165244831    0.2674864482548598    0.6890362835148812    0.8433089588045419    0.616994327364523    0.21171915359740148    ?    0.9053982549132731    1.0637509106929124    2.2037803883327394    3.8408021297640422    2.8143350902122513    6.430908256226332    8.973943893294631    12.156951756094124    13.640643129999406    11.927246916199898    11.46172796745761    10.091456336921842    9.652495273244115
代码语言:javascript
复制
  • 与Julia生态系统中的其他软件包可以实现互操作性。例如,使用NearestNeighbors.jl查找每个残基最近的10个残基:
代码语言:javascript
复制
julia> using NearestNeighbors  
 [ Info: Precompiling NearestNeighbors [b8a86587-4115-5ab1-83bc-aa920d37bbce]
julia> struc = retrievepdb("1AKE")   
[ Info: File exists: 1AKE   ProteinStructure 1AKE.pdb with 1 models, 2 chains (A,B), 428 residues, 3804 atoms
julia> ca = coordarray(struc["A"], cbetaselector)   
3×214 Array{Float64,2}:    24.677  28.653  23.802  25.789  22.088  21.919  19.604  18.092  20.574  …   7.414   9.597  14.144  11.762   9.84   14.508  17.321  15.055    53.31   49.266  48.88   43.561  45.547  39.891  39.512  36.96   38.908     52.565  47.611  50.369  54.334  50.063  47.961  52.16   55.001    39.58   38.349  35.202  33.72   29.675  30.945  26.973  23.169  19.047     33.084  34.097  33.555  36.399  39.295  38.63   38.292  41.318
julia> kdtree = KDTree(ca; leafsize=10)   
KDTree{StaticArrays.SArray{Tuple{3},Float64,1,3},Euclidean,Float64}     Number of points: 214     Dimensions: 3     Metric: Euclidean(0.0)     Reordered: true
julia> idxs, dists = knn(kdtree, ca, 10, true)  
 ([[1, 104, 80, 26, 2, 24, 3, 105, 213, 82], [2, 103, 104, 80, 3, 1, 81, 102, 101, 105], [3, 82, 105, 2, 4, 103, 1, 104, 107, 5], [4, 106, 83, 103, 5, 3, 6, 87, 107, 182], [5, 13, 84, 107, 6, 4, 17, 85, 3, 109], [6, 108, 7, 5, 4, 178, 106, 107, 179, 109], [7, 11, 109, 6, 8, 108, 13, 5, 110, 111], [8, 7, 11, 9, 171, 111, 116, 10, 168, 113], [9, 167, 10, 8, 116, 171, 168, 164, 120, 11], [10, 9, 11, 119, 12, 120, 116, 8, 111, 13]  …  [205, 200, 206, 204, 198, 208, 202, 16, 196, 209], [206, 203, 205, 207, 19, 209, 202, 16, 204, 210], [207, 206, 208, 204, 210, 203, 209, 211, 205, 200], [208, 196, 209, 207, 211, 205, 212, 204, 197, 200], [209, 208, 210, 212, 206, 213, 16, 205, 196, 20], [210, 209, 211, 207, 214, 213, 206, 212, 208, 23], [211, 212, 210, 208, 207, 209, 214, 213, 194, 196], [212, 194, 213, 211, 209, 208, 107, 105, 210, 196], [213, 214, 212, 209, 210, 24, 20, 105, 1, 211], [214, 213, 210, 211, 212, 24, 23, 209, 1, 20]], [[0.0, 5.379302371125837, 5.738340700934371, 5.7471726962046255, 5.803263995373641, 6.2698517526333895, 6.289468101517011, 7.548714526328312, 7.555936738750529, 8.120749534371813], [0.0, 4.112730601437444, 4.943904024149336, 5.153635706954848, 5.79523994326378, 5.803263995373641, 6.113403471062578, 7.130071388141919, 7.529867595117461, 7.635012901102395], [0.0, 4.752253991528648, 4.807276775888826, 5.79523994326378, 5.8682411334232025, 6.1936384298730305, 6.289468101517011, 6.455786938863458, 6.596865998335876, 6.677904910973202], [0.0, 4.598864425051035, 4.772305941575829, 5.235701576675279, 5.831262470511851, 5.8682411334232025, 6.012189700932599, 7.067439352410459, 7.117514243048626, 7.17806303956715], [0.0, 4.32352055621342, 4.971098570738667, 5.5090422942649475, 5.79929280171298, 5.831262470511851, 6.236849685538367, 6.66853724590333, 6.677904910973202, 6.712515698305665], [0.0, 4.563654347121392, 4.612987101651165, 5.79929280171298, 6.012189700932599, 6.03362793019258, 6.042733570165077, 6.561872750975902, 6.675025243397956, 6.7987706241643435], [0.0, 4.347957681486791, 4.607806202521975, 4.612987101651165, 4.823822550633469, 6.0827713256376805, 6.136970343744541, 7.063447104636657, 7.238687311937157, 7.376582270943636], [0.0, 4.823822550633469, 4.923382577050047, 5.190945193314992, 5.333387385142766, 5.667243245176615, 6.284191992611303, 6.472383641287034, 6.722325341725138, 7.02830036353029], [0.0, 4.580603126226939, 4.7337695338915715, 5.190945193314992, 5.764995836945593, 5.866839097844765, 6.010085357130961, 6.305834916963812, 6.804574417257852, 7.284529909335261], [0.0, 4.7337695338915715, 5.0027798272560435, 5.080148619873239, 5.419463718856319, 5.694080874030506, 5.724320483690618, 6.472383641287034, 7.020420642668072, 7.276900782613434]  …  [0.0, 4.965381556335825, 5.244736981012494, 5.438683848138262, 5.488500523822511, 5.873772893124147, 5.905328017985114, 6.101600199947552, 6.106085489083822, 6.533423987466296], [0.0, 5.104430428559095, 5.244736981012494, 5.3089409490029205, 5.337398804661314, 5.835905156871556, 6.200670044438746, 6.580556587402013, 6.831018811275522, 7.084954763440626], [0.0, 5.3089409490029205, 5.507610552680718, 5.565543459537445, 5.746624226448081, 6.446670768699146, 7.0948683567773125, 7.121938008716445, 7.32911195166236, 8.60757654627596], [0.0, 5.000595164577914, 5.345609132736888, 5.507610552680718, 5.752439221756283, 5.873772893124147, 6.692421833686218, 6.798922708782622, 7.116849162375159, 7.172625878992994], [0.0, 5.345609132736888, 5.429869703777433, 5.629083850858862, 5.835905156871556, 5.9783090418612534, 6.092611755232727, 6.533423987466296, 6.574575347503445, 6.866309124995759], [0.0, 5.429869703777433, 5.50657252744391, 5.746624226448081, 5.956953835644519, 6.261965027050219, 7.084954763440626, 7.289239054935711, 7.428671348229108, 7.72148573786159], [0.0, 5.162446416186807, 5.50657252744391, 5.752439221756283, 7.121938008716445, 7.180922781927127, 7.461407239924647, 7.833822757760096, 9.085469828247742, 9.513200775764174], [0.0, 4.845528763716093, 5.0654529906021235, 5.162446416186807, 5.629083850858862, 6.692421833686218, 7.054568307132619, 7.19152146628236, 7.289239054935711, 7.479374171680411], [0.0, 4.72892302749791, 5.0654529906021235, 5.9783090418612534, 6.261965027050219, 6.690919294088076, 7.006122037190048, 7.080867390369627, 7.555936738750529, 7.833822757760096], [0.0, 4.72892302749791, 5.956953835644519, 7.461407239924647, 7.555537902757153, 8.485650240258552, 9.063193752756252, 9.085676309444441, 9.922852865985668, 10.711033236807733]])
代码语言:javascript
复制

Summary

  • 总体来说在蛋白结构方面操作起来比较舒服
  • 但是由于第一次接触Julia还需要熟练
  • 某些安装包还是有些麻烦,例如plots
  • 建议下载julia pro,作为ide,搭配atom使用
  • 可能julia也支持jupyter?这个还需要看下,如果说支持jupyter,我收回上面那句话

本文参与?腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2021-02-05,如有侵权请联系?cloudcommunity@tencent.com 删除

本文分享自 FindKey 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与?腾讯云自媒体同步曝光计划? ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Web
  • Cite
  • Language
  • Installation:
  • Usage
  • 操作结构
  • 相关空间计算
    • 结构转化为DataFrame
    • 结构可视化
    • 几个例子
    • Summary
    相关产品与服务
    容器服务
    腾讯云容器服务(Tencent Kubernetes Engine, TKE)基于原生 kubernetes 提供以容器为核心的、高度可扩展的高性能容器管理服务,覆盖 Serverless、边缘计算、分布式云等多种业务部署场景,业内首创单个集群兼容多种计算节点的容器资源管理模式。同时产品作为云原生 Finops 领先布道者,主导开源项目Crane,全面助力客户实现资源优化、成本控制。
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档
    http://www.vxiaotou.com