|
39 | 39 | defaultresname, |
40 | 40 | defaultresidue, |
41 | 41 | resnames, |
| 42 | + sscode, |
| 43 | + sscode!, |
42 | 44 | chain, |
43 | 45 | chainid, |
44 | 46 | chainid!, |
@@ -72,7 +74,14 @@ export |
72 | 74 | pdbextension, |
73 | 75 | generatechainid, |
74 | 76 | MMTFDict, |
75 | | - writemmtf |
| 77 | + writemmtf, |
| 78 | + helixsscodes, |
| 79 | + sheetsscodes, |
| 80 | + coilsscodes, |
| 81 | + rundssp!, |
| 82 | + rundssp, |
| 83 | + runstride!, |
| 84 | + runstride |
76 | 85 |
|
77 | 86 | "A macromolecular structural element." |
78 | 87 | abstract type StructuralElement end |
@@ -806,6 +815,39 @@ function DisorderedResidue(dis_res::DisorderedResidue, default::AbstractString) |
806 | 815 | return DisorderedResidue(dis_res.names, default) |
807 | 816 | end |
808 | 817 |
|
| 818 | +const ss_code_unassigned = '-' |
| 819 | + |
| 820 | +""" |
| 821 | + sscode(res) |
| 822 | + sscode(at) |
| 823 | +
|
| 824 | +Get the secondary structure code of an `AbstractResidue` or `AbstractAtom` as a `Char`. |
| 825 | +
|
| 826 | +`'$ss_code_unassigned'` represents unassigned secondary structure. |
| 827 | +Secondary structure can be assigned using `rundssp!` or `runstride!`. |
| 828 | +""" |
| 829 | +sscode(res::Residue) = res.ss_code |
| 830 | +sscode(dis_res::DisorderedResidue) = sscode(defaultresidue(dis_res)) |
| 831 | +sscode(at::Atom) = sscode(residue(at)) |
| 832 | +sscode(dis_at::DisorderedAtom) = sscode(defaultatom(dis_at)) |
| 833 | + |
| 834 | +""" |
| 835 | + sscode!(res, ss_code) |
| 836 | +
|
| 837 | +Set the secondary structure code of an `AbstractResidue` to a `Char`. |
| 838 | +""" |
| 839 | +function sscode!(res::Residue, ss_code) |
| 840 | + res.ss_code = ss_code |
| 841 | + return res |
| 842 | +end |
| 843 | + |
| 844 | +function sscode!(dis_res::DisorderedResidue, ss_code) |
| 845 | + for res_name in resnames(dis_res) |
| 846 | + sscode!(disorderedres(dis_res, res_name), ss_code) |
| 847 | + end |
| 848 | + return dis_res |
| 849 | +end |
| 850 | + |
809 | 851 | """ |
810 | 852 | chain(at) |
811 | 853 | chain(res) |
@@ -1643,6 +1685,8 @@ function generatechainid(entity_id::Integer) |
1643 | 1685 | return out_string |
1644 | 1686 | end |
1645 | 1687 |
|
| 1688 | +# MMTF functions |
| 1689 | + |
1646 | 1690 | """ |
1647 | 1691 | MMTFDict(filepath; gzip=false) |
1648 | 1692 | MMTFDict(io; gzip=false) |
@@ -1680,6 +1724,66 @@ gzipped. |
1680 | 1724 | """ |
1681 | 1725 | function writemmtf end |
1682 | 1726 |
|
| 1727 | +# Secondary structure |
| 1728 | + |
| 1729 | +"`Set` of secondary structure codes corresponding to an α-helix." |
| 1730 | +const helixsscodes = Set(['G', 'H', 'I', 'P']) |
| 1731 | + |
| 1732 | +"`Set` of secondary structure codes corresponding to a β-sheet." |
| 1733 | +const sheetsscodes = Set(['E', 'B']) |
| 1734 | + |
| 1735 | +"`Set` of secondary structure codes corresponding to a coil." |
| 1736 | +const coilsscodes = Set(['C', 'T', 'S', ' ']) |
| 1737 | + |
| 1738 | +""" |
| 1739 | + rundssp!(struc) |
| 1740 | + rundssp!(model) |
| 1741 | +
|
| 1742 | +Run DSSP (Define Secondary Structure of Proteins) on the given structural element |
| 1743 | +to assign secondary structure. |
| 1744 | +
|
| 1745 | +Requires the DSSP_jll.jl package to be imported. |
| 1746 | +A temporary PDB file is written, so this will fail if the structural element cannot |
| 1747 | +be written to a PDB file, for example if there are two-letter chain IDs. |
| 1748 | +""" |
| 1749 | +function rundssp! end |
| 1750 | + |
| 1751 | +""" |
| 1752 | + rundssp(struc) |
| 1753 | + rundssp(model) |
| 1754 | + rundssp(filepath_in, dssp_filepath_out) |
| 1755 | +
|
| 1756 | +Return a copy of the structural element with DSSP (Define Secondary Structure of Proteins) |
| 1757 | +run to assign secondary structure, or run DSSP directly on a PDB or mmCIF file. |
| 1758 | +
|
| 1759 | +Requires the DSSP_jll.jl package to be imported. |
| 1760 | +""" |
| 1761 | +function rundssp end |
| 1762 | + |
| 1763 | +""" |
| 1764 | + runstride!(struc) |
| 1765 | + runstride!(model) |
| 1766 | +
|
| 1767 | +Run STRIDE on the given structural element to assign secondary structure. |
| 1768 | +
|
| 1769 | +Requires the STRIDE_jll.jl package to be imported. |
| 1770 | +A temporary PDB file is written, so this will fail if the structural element cannot |
| 1771 | +be written to a PDB file, for example if there are two-letter chain IDs. |
| 1772 | +""" |
| 1773 | +function runstride! end |
| 1774 | + |
| 1775 | +""" |
| 1776 | + runstride(struc) |
| 1777 | + runstride(model) |
| 1778 | + runstride(filepath_in, stride_filepath_out) |
| 1779 | +
|
| 1780 | +Return a copy of the structural element with STRIDE |
| 1781 | +run to assign secondary structure, or run STRIDE directly on a PDB file. |
| 1782 | +
|
| 1783 | +Requires the STRIDE_jll.jl package to be imported. |
| 1784 | +""" |
| 1785 | +function runstride end |
| 1786 | + |
1683 | 1787 | # Descriptive showing of elements on a single line |
1684 | 1788 |
|
1685 | 1789 | Base.show(io::IO, struc::MolecularStructure) = print(io, |
|
0 commit comments