Amino acids and proteins¶
Open this tutorial as a notebook
Protein sequences are represented by ProteinSeq, and individual residues by
the AminoAcid enum.
Create a protein sequence from its single-letter codes:
MKQHKAMIVALIVICITAVVAALVTRKDLCEVHIRTGQTEVAVF
Length: 44
Alanine count: 6
Residue properties¶
Amino acids are prefixed with aa below to keep them clear of the NUC
constants, whose single-letter names overlap.
Ala
Trp
Every residue ordered by molecular weight:
aa.values().asSequence()
.sortedBy { it.weight }
.forEach { println("${it.name3letter}($it) weighs ${it.weight}") }
Gly(G) weighs 75.0666
Ala(A) weighs 89.0932
Ser(S) weighs 105.0926
Pro(P) weighs 115.1305
Val(V) weighs 117.1463
Thr(T) weighs 119.1192
Cys(C) weighs 121.1582
Ile(I) weighs 131.1729
Leu(L) weighs 131.1729
Asn(N) weighs 132.1179
Asp(D) weighs 133.1027
Gln(Q) weighs 146.1445
Lys(K) weighs 146.1876
Glu(E) weighs 147.1293
Met(M) weighs 149.2113
His(H) weighs 155.1546
Phe(F) weighs 165.1891
Arg(R) weighs 174.201
Tyr(Y) weighs 181.1885
Trp(W) weighs 204.2252
Xaa(X) weighs NaN
Asx(B) weighs NaN
Glx(Z) weighs NaN
Stp(STOP) weighs NaN
Gap(GAP) weighs NaN
Slicing and mass¶
Indexing with a single integer returns an AminoAcid, so the residue
properties are available directly from a sequence.
var mass = 0.0
for (index in 0 until mySeq.size()) {
mass += mySeq[index].weight
}
println("The mass of the peptide is $mass daltons")
The mass of the peptide is 5595.5086 daltons