# Molecular mass of proteins and peptides

**URL:** <https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439>\
**Category:** Biology, Health, and Medicine\
**Created:** [February 14, 2022, 2:54pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439 "2022-02-14T14:54:37Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [February 14, 2022, 2:54pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/1 "2022-02-14T14:54:37Z")

</div>

Is there a package that can compute the molecular mass based on an amino acid sequence?  
[MolecularGraph](https://github.com/mojaie/MolecularGraph.jl) has the machinery, but that appears to be focused on small molecules.  
I can’t find a method in [BioSequences](https://github.com/BioJulia/BioSequences.jl)

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [February 14, 2022, 3:06pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/2 "2022-02-14T15:06:16Z")

</div>

Probably not what you want, but from the PDB file you can do this:

```julia
julia> using PDBTools

julia> pdb = wget("1LBD")
   Array{Atoms,1} with 1870 atoms with fields:
   index name resname chain resnum residue x y z beta occup model segname index_pdb
       1 N SER A 225 1 45.228 84.358 70.638 67.05 1.00 1 - 1
       2 CA SER A 225 1 46.080 83.165 70.327 68.73 1.00 1 - 2
       3 C SER A 225 1 45.257 81.872 70.236 67.90 1.00 1 - 3
                                                       ⋮ 
    1868 OG1 THR A 462 238 -27.462 74.325 48.885 79.98 1.00 1 - 1868
    1869 CG2 THR A 462 238 -27.063 71.965 49.222 78.62 1.00 1 - 1869
    1870 OXT THR A 462 238 -25.379 71.816 51.613 84.35 1.00 1 - 1870

julia> mass(pdb)
24719.768399999957

julia> formula(pdb)
C₁₁₉₂N₃₂₀O₃₄₆S₁₂

```

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [February 14, 2022, 3:13pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/3 "2022-02-14T15:13:20Z")

</div>

Thanks for the link. I was not aware of PDBTools. I looked in BioStructures.jl, but did not find anything,  
I love the formula 😄  
I don’t normally have a PDB-file, but now we have alphafold, so maybe 😉

---

<div class="post-metadata">

**Author:** ![jgreener64](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jgreener64/32/2483_2.png) [@jgreener64](https://discourse.julialang.org/u/jgreener64)\
**Post date:** [February 14, 2022, 3:15pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/4 "2022-02-14T15:15:13Z")

</div>

It’s not in BioStructures.jl - PRs welcome of course.

---

<div class="post-metadata">

**Author:** ![lmiq](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/lmiq/32/18314_2.png) [@lmiq](https://discourse.julialang.org/u/lmiq)\
**Post date:** [February 14, 2022, 5:08pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/5 "2022-02-14T17:08:33Z")

</div>

Well, that was really easy (not surprisingly) to implement in PDBTools. Now you can do (with version 0.12.12, which will be available at any moment):

```julia
julia> using PDBTools

julia> seq = "ATVR"
"ATVR"

julia> mass(Sequence(seq))
427.4986

julia> seq = ["ARG", "THR", "GLU"]
3-element Vector{String}:
 "ARG"
 "THR"
 "GLU"

julia> mass(Sequence(seq))
386.4036

```

It does not handle terminals in any sense, it is just the sum of the average mass (isopically speaking) of the amino acid residues in the sequence.

---

<div class="post-metadata">

**Author:** ![tp2750](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/tp2750/32/207806_2.png) [@tp2750](https://discourse.julialang.org/u/tp2750)\
**Post date:** [February 14, 2022, 5:10pm UTC](https://discourse.julialang.org/t/molecular-mass-of-proteins-and-peptides/76439/6 "2022-02-14T17:10:53Z")

</div>

Thank you so much @lmiq . This is exactly what I need!

How I just love this community!
