Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions docs/Writerside/s.tree
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
<toc-element topic="Automated-Xray-Glycan-Building.topic"/>
<toc-element topic="Automated-EM-Glycan-Building.topic"/>
</toc-element>
<toc-element toc-title="WURCS Functions">
<toc-element topic="Morph-Glycan.topic"/>
<toc-element topic="Find-WURCS.topic"/>
<toc-element topic="Model-Glycan-from-WURCS.topic"/>

</toc-element>
<toc-element toc-title="Utility Functions">
<toc-element topic="Compare-Structures.topic"/>
<toc-element topic="Find-Glycosylation-Sites.topic"/>
Expand Down
2 changes: 1 addition & 1 deletion docs/Writerside/topics/Compare-Structures.topic
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
of Sails.
</p>

<chapter title="Compare Structures" id="compare">
<chapter title="Command" id="compare">
<p>Syntax:</p>

<code-block lang="shell">
Expand Down
4 changes: 2 additions & 2 deletions docs/Writerside/topics/Find-Glycosylation-Sites.topic
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
will output a JSON file with the residues that follow the respective motifs.
</p>

<chapter title="Find Sites" id="find">
<chapter title="Command" id="find">
<p>Syntax:</p>

<code-block lang="shell">
Expand All @@ -21,7 +21,7 @@

<p>Example:</p>
<code-block lang="shell">
sails-find -model built.cif -logout potential_sites.json
sails-find -modelin built.cif -logout potential_sites.json
</code-block>
</chapter>

Expand Down
64 changes: 64 additions & 0 deletions docs/Writerside/topics/Find-WURCS.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Find WURCS Codes" id="Find-WURCS">

<p>
Sails provides a utility tool to find the WURCS code of a glycan in a macromolecule. A single WURCS code can
be generated for a known glycosite or all can be generated. These codes can be used to search glycomics databases.
</p>

<chapter title="Command" id="find">
<p>Syntax:</p>

<code-block lang="shell">
sails-wurcs find [OPTIONS]
</code-block>

<p>Example:</p>
<code-block lang="shell">
sails-wurcs find -modelin structure.cif -chain A -seqid 123
</code-block>

<code-block lang="shell">
sails-wurcs find -modelin structure.cif -all -logout all_wurcs.json
</code-block>
</chapter>

<chapter title="Options" id="options">
<p>Describe what each option is used for:</p>

<deflist type="medium">
<def title="-modelin">
Path to a model.
<p>Formats accepted: CIF or PDB</p>
<b>Required</b>
</def>
<def title="-logout">
Path to output JSON file
<p>Default: wurcs.json </p>
</def>
<def title="--all">
Ignore chain and seqid, and generate WURCS codes for all glycans that can be found for the input model
</def>
<def title="-chain">
Chain name containing the root protein residue
<p>Example: A</p>
</def>
<def title="-seqid">
Sequence Id of the root protein residue of a glycan (e.g. asparagine for an N-glycan)
<p>Example: 123</p>
</def>

<def title="-h, --help">
Displays help.
</def>
</deflist>
</chapter>

<seealso>
<!--Provide links to related how-to guides, overviews, and tutorials.-->
</seealso>
</topic>
4 changes: 2 additions & 2 deletions docs/Writerside/topics/Generate-SNFG-Diagrams.topic
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@
Ignore chain and seqid, and generate all SNFGs that can be found for the input model
</def>
<def title="-chain">
Chain name
Chain name containing the root protein residue
<p>Example: A</p>
</def>
<def title="-seqid">
Sequence Id of desired SNFG root
Sequence Id of desired protein root residue
<p>Example: 123</p>
</def>

Expand Down
58 changes: 58 additions & 0 deletions docs/Writerside/topics/Model-Glycan-from-WURCS.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Model Glycan from WURCS Code" id="Model-Glycan-from-WURCS">

<p>
Sails provides a utility tool to model a glycan into a structure from a known WURCS code and a root residue.
This may be useful to glycosylate predicted models or as a simple starting point for manual model building. The
glycan is placed with the mean torsion angles for a given linkage.
</p>

<chapter title="Command" id="find">
<p>Syntax:</p>

<code-block lang="shell">
sails-wurcs model [OPTIONS]
</code-block>

<p>Example:</p>
<code-block lang="shell">
sails-wurcs model -modelin structure.cif -wurcs "WURCS=2.0/..." -chain A -seqid 123
</code-block>
</chapter>

<chapter title="Options" id="options">
<p>Describe what each option is used for:</p>

<deflist type="medium">
<def title="-modelin">
Path to a model.
<p>Formats accepted: CIF or PDB</p>
<b>Required</b>
</def>
<def title="-modelout">
Path to the glycosylated output model.
<p>Formats accepted: CIF or PDB</p>
<p>Default: sails-model-out.cif </p>
</def>
<def title="-wurcs">
WURCS code of glycan to model.
<p>Must be in standard form without open chains and without circular glycans.</p>
</def>
<def title="-chain">
Chain name containing desired root residue
<p>Example: A</p>
</def>
<def title="-seqid">
Sequence Id of the root residue of the future glycan (e.g. asparagine for an N-glycan)
<p>Example: 123</p>
</def>
<def title="-h, --help">
Displays help.
</def>
</deflist>
</chapter>
</topic>
57 changes: 57 additions & 0 deletions docs/Writerside/topics/Morph-Glycan.topic
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE topic
SYSTEM "https://resources.jetbrains.com/writerside/1.0/xhtml-entities.dtd">
<topic xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://resources.jetbrains.com/writerside/1.0/topic.v2.xsd"
title="Morph Glycan" id="Morph-Glycan">
<p>
Sails provides a utility tool to morph a modelled glycan into another form using a supplied WURCS code. The new
glycan will be superimposed onto the modelled glycan and may be useful to morph a high-mannose N-glycan into a
more processed kind, for example.
</p>

<chapter title="Command" id="find">
<p>Syntax:</p>

<code-block lang="shell">
sails-morph [OPTIONS]
</code-block>

<p>Example:</p>
<code-block lang="shell">
sails-morph -modelin structure.cif -chain A -seqid 123 -wurcs "WURCS=2.0/..."
</code-block>
</chapter>

<chapter title="Options" id="options">
<p>Describe what each option is used for:</p>

<deflist type="medium">
<def title="-modelin">
Path to a model.
<p>Formats accepted: CIF or PDB</p>
<b>Required</b>
</def>
<def title="-modelout">
Path to the morphed output model.
<p>Formats accepted: CIF or PDB</p>
<p>Default: sails-model-out.cif </p>
</def>
<def title="-wurcs">
WURCS code of glycan to model.
<p>Must be in standard form without open chains and without circular glycans.</p>
</def>
<def title="-chain">
Chain name containing the root protein residue
<p>Example: A</p>
</def>
<def title="-seqid">
Sequence Id of the root protein of the glycan (e.g. asparagine for an N-glycan)
<p>Example: 123</p>
</def>
<def title="-h, --help">
Displays help.
</def>
</deflist>
</chapter>
</topic>
67 changes: 67 additions & 0 deletions package/scripts/bump_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import re
import argparse


def bump_version(version, args):
major, minor, patch = map(int, version.split("."))
if args.major:
major += 1

if args.minor:
minor += 1

if args.patch:
patch += 1

return f"{major}.{minor}.{patch}"


def update_version_in_file(file_path, old_version, new_version):
with open(file_path, "r") as file:
content = file.read()

print(old_version, new_version)
updated_content = content.replace(old_version, new_version)

with open(file_path, "w") as file:
file.write(updated_content)


def main():
parser = argparse.ArgumentParser(description="Bump project version.")
parser.add_argument("-major", action=argparse.BooleanOptionalAction)
parser.add_argument("-minor", action=argparse.BooleanOptionalAction)
parser.add_argument("-patch", action=argparse.BooleanOptionalAction)
args = parser.parse_args()

# Update __version__.py
version_file = "src/sails/__version__.py"
version_regex = r"(?:__version__\s*=\s*[\"'])(\d+\.\d+\.\d+)([\"'])"
with open(version_file, "r") as file:
match = re.search(version_regex, file.read())
if not match:
raise ValueError("Current version not found in __version__.py")
current_version = match.group(1)

# Update writerside.cfg
cfg_file = "../docs/Writerside/writerside.cfg"
cfg_version_regex = r'(<instance [^>]*version=")(\d+\.\d+\.\d+)(")'

with open(cfg_file, "r") as file:
match = re.search(cfg_version_regex, file.read())
if not match:
raise ValueError("Current version not found in writerside.cfg")
cfg_current_version = match.group(2)

if current_version != cfg_current_version:
raise RuntimeError("Docs and Python version mismatch")

new_version = bump_version(current_version, args)

print(f"Bumping version {current_version} -> {new_version}")
update_version_in_file(version_file, current_version, new_version)
update_version_in_file(cfg_file, current_version, new_version)


if __name__ == "__main__":
main()
8 changes: 6 additions & 2 deletions package/src/sails/morph.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,15 @@ def parse_args():
parser.add_argument("--version", action="version", version=__version__)
parser.add_argument("-modelin", help="Path to input model", type=str, required=True)
parser.add_argument(
"-modelout", help="Path to output model", type=str, required=False
"-modelout",
help="Path to output model",
type=str,
required=False,
default="sails-model-out.cif",
)
parser.add_argument("-chain", help="Name of target chain", type=str, required=True)
parser.add_argument(
"-res", help="Name of target residue (protein)", type=int, required=True
"-seqid", help="Name of target residue (protein)", type=int, required=True
)
parser.add_argument(
"-wurcs", help="WURCS identifier for new glycan", type=str, required=True
Expand Down
7 changes: 5 additions & 2 deletions package/src/sails/wurcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def parse_args():
"find", parents=[parent], formatter_class=formatter
)
find_parser.add_argument(
"-all",
"--all",
help="Find WURCS identifiers for all glycans",
action=argparse.BooleanOptionalAction,
required=False,
Expand Down Expand Up @@ -59,7 +59,10 @@ def parse_args():
"-chain", help="Name of target chain", type=str, required=True
)
model_parser.add_argument(
"-res", help="Name of target residue (protein)", type=str, required=True
"-seqid",
help="Sequence ID of the root residue (protein)",
type=str,
required=True,
)

return parser.parse_args()
Expand Down