Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNA Graphs] change relative imports #35

Merged
merged 1 commit into from
Dec 31, 2020
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
2 changes: 1 addition & 1 deletion graphein/rna/edges.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Functions to compute edges for an RNA secondary structure graph"""
# %%
# Graphein
# Author: Arian Jamasb <[email protected]>, Emmanuele Rossi
# Author: Arian Jamasb <[email protected]>, Emmanuele Rossi, Eric Ma
# License: MIT
# Project Website: https://github.com/a-r-j/graphein
# Code Repository: https://github.com/a-r-j/graphein
Expand Down
16 changes: 11 additions & 5 deletions graphein/rna/graphs.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Functions for working with RNA Secondary Structure Graphs"""
# %%
# Graphein
# Author: Arian Jamasb <[email protected]>, Emmanuele Rossi
# Author: Arian Jamasb <[email protected]>, Emmanuele Rossi, Eric Ma
# License: MIT
# Project Website: https://github.com/a-r-j/graphein
# Code Repository: https://github.com/a-r-j/graphein
Expand All @@ -10,7 +10,7 @@

import networkx as nx

from ..utils import (
from graphein.utils import (
annotate_edge_metadata,
annotate_graph_metadata,
annotate_node_metadata,
Expand All @@ -37,7 +37,10 @@
# Todo checking of valid base-parings


def validate_rna_sequence(s: str):
def validate_rna_sequence(s: str) -> None:
"""
Validate RNA sequence. This ensures that it only has supported bases
"""
letters_used = set(s)
if not letters_used.issubset(RNA_BASES):
offending_letter = letters_used.difference(RNA_BASES)
Expand All @@ -47,7 +50,10 @@ def validate_rna_sequence(s: str):
)


def validate_lengths(db: str, seq: str):
def validate_lengths(db: str, seq: str) -> None:
"""
Check lengths of dotbracket and sequence match
"""
if len(db) != len(seq):
raise ValueError(
f"Length of dotbracket ({len(db)}) does not match length of sequence ({len(seq)})."
Expand All @@ -57,7 +63,7 @@ def validate_lengths(db: str, seq: str):
def sanitize_dotbracket(db: str) -> str:
"""Sanitize dotbracket string.

This ensures that it only has supported letters.
This ensures that it only has supported symobls.
"""
db = "".join(i if i in SUPPORTED_DOTBRACKET_NOTATION else "." for i in db)
return db
Expand Down