Represent linear or circularized nucleotides.
Classes
|
Makes a sequence binding position. |
|
An annotation for a sequence. |
|
Represents a biological nucleotide. |
|
Represents a biological sequence as a double linked list. |
Constants/Flags for sequences. |
jdna.sequence.
BindPos
(template_bounds: Tuple[Nucleotide, Nucleotide], query_bounds: Tuple[Nucleotide, Nucleotide], template: jdna.sequence.Sequence, query: jdna.sequence.Sequence, direction: int, strand=<SequenceFlags.FORWARD: 1>)[source]¶Bases: jdna.linked_list.LinkedListMatch
Makes a sequence binding position.
template_bounds_list (template DoubleLinkedList) – list of 2 len tuples containing starts and ends from a template
query_bounds_list (query DoubleLinkedList) – list of 2 len tuples containing starts and ends from a query
template (DoubleLinkedList) – the template
query (DoubleLinkedList) – the query
direction (int) – If SequenceFlags.FORWARD, the binding position indicates binding forward, to the bottom strand of a dsDNA sequence.
strand (int) – If SequenceFlags.BOTTOM, then the query is assumed to be the reverse_complement of the original query
batch_create
(template_bounds_list: List[Tuple[jdna.linked_list.Node, jdna.linked_list.Node]], query_bounds_list: List[Tuple[jdna.linked_list.Node, jdna.linked_list.Node]], template: jdna.linked_list.DoubleLinkedList, query: jdna.linked_list.DoubleLinkedList) → List[jdna.linked_list.LinkedListMatch]¶Efficiently create several LinkedListMatches from lists of template starts/ends and query starts/ends.
template_bounds_list (template DoubleLinkedList) – list of 2 len tuples containing starts and ends from a template
query_bounds_list (query DoubleLinkedList) – list of 2 len tuples containing starts and ends from a query
template (DoubleLinkedList) – the template
query (DoubleLinkedList) – the query
matchese
list of LinkedListMatch
from_match
(linked_list_match, template, query, direction, strand=<SequenceFlags.FORWARD: 1>)[source]¶Return a binding pos.
linked_list_match (LinkedListMatch) – the linked list match
jdna.sequence.
Feature
(name, type=None, strand=None, color=None)[source]¶Bases: object
An annotation for a sequence.
jdna.sequence.
Nucleotide
(base, alphabet=<jdna.alphabet.Alphabet object>)[source]¶Bases: jdna.linked_list.Node
Represents a biological nucleotide.
Serves a Node
in teh Sequence
object.
Nucleotide constructor.
base (basestring) – base as a single character string
_break_connections
()¶Break connections in this node.
_complete_match
(node: jdna.linked_list.Node, next_method: Callable) → bool¶Return whether the longest match between two nodes is equivalent.
node (Node) – the node to compare
next_method (callable) – how to obtain the next node
whether the longest match between two nodes is equivalent
bool
add_next
(data)¶Create a new node and add to next.
data (any) – any data
the new node
add_prev
(data)¶Create a new node and add to previous.
data (any) – any data
the new node
cut_prev
()[source]¶Cut the previous node, return the cut node.
the cut (previous) node
find_first
() → jdna.linked_list.Node¶Find the head node.
find_last
() → jdna.linked_list.Node¶Find the tail node.
fwd
(stop_node: Optional[jdna.linked_list.Node] = None, stop_criteria: Callable = None) → Generator¶Propogates forwards until stop node is visited or stop criteria is reached.
stop_node –
stop_criteria –
longest_match
(node: jdna.linked_list.Node, next_method: Callable = None) → Tuple[jdna.linked_list.Node, jdna.linked_list.Node]¶Find the longest match between two linked_lists.
node (Node) – the node to compare
next_method (callable) – how to obtain the next node
list of tuples containing matching nodes
list
remove
()¶Remove node from linked list, connecting the previous and next nodes together.
None
None
rev
(stop_node: Optional[jdna.linked_list.Node] = None, stop_criteria: Callable = None) → Generator[jdna.linked_list.Node, None, None]¶Propogates backwards until stop node is visited or stop criteria is reached.
stop_node –
stop_criteria –
swap
()¶Swap the previous and next nodes.
None
None
jdna.sequence.
Sequence
(sequence: Sequence[Any] = None, first: jdna.sequence.Nucleotide = None, name: str = None, description: str = '', metadata: dict = None, cyclic: bool = False, alphabet=<jdna.alphabet.Alphabet object>)[source]¶Bases: jdna.linked_list.DoubleLinkedList
Represents a biological sequence as a double linked list.
Can be annotated with features.
sequence (basestring) – sequence string
first (Nucleotide) – optional first Nucleotide to use as the ‘head’ to this Sequence
name (basestring) – optional name of the sequence
description (basestring) – optional description of the sequence
metadata (dict) – additional sequence metadata
cyclic (bool) – whether to make the sequence circular
alphabet (jdna.alphabet.Alphabet) – the base pair alphabet of this sequence which used for complementary and comparisons (default: AmbiguousDNA)
Direction
¶Bases: enum.IntFlag
An enumeration.
NODE_CLASS
¶alias of Nucleotide
add_multipart_feature
(positions, feature)[source]¶Add a multi-part feature (i.e. a disjointed feature)
anneal
(ssDNA, min_bases=13, depth=None)[source]¶Simulate annealing a single stranded piece of DNA to a double_stranded template.
anneal_forward
(other, min_bases=13, depth=None)[source]¶Anneal a sequence in the forward direction.
anneal_reverse
(other, min_bases=13, depth=None)[source]¶Anneal a sequence in the reverse direction.
annotate
(start, end, name, feature_type=None, color=None, strand=None)[source]¶Annotate a regions.
start (int) – start
end (end) – end (inclusive)
name (basestring) – feature name
feature_type (basestring) – feature type (default=misc)
color (basestring) – optional feature color
new feature
circular
¶Alias for cyclic.
collect_nodes
(nodes)¶Return all visisted nodes and return an unordered set of nodes.
all visited nodes
set
compare
(other: jdna.linked_list.DoubleLinkedList) → bool¶Compares two linked lists. If both are cyclic, will attempt to reindex.
other (DoubleLinkedList) – other linked list
whether sequence data is equivalent
bool
copy_slice
(start: jdna.linked_list.Node, end: jdna.linked_list.Node) → jdna.linked_list.DoubleLinkedList¶Return a copy of the sequence between ‘start’ and ‘end’ nodes.
If start is None, return the slice copy from head to end. If end is None, return copy from start to tail. If both start and end are None return None.
digest
(enzymes, as_names=False)[source]¶Supply either a Bio.RestrictionSite or a tuple of (seq, cut1, cut2)
e.g. (‘GTTTAAAC’, 4, -4)
enzymes (list (of tuple|Bio.RestrictionSite)) – either a Bio.RestrictionSite or a tuple of (seq, cut1, cut2)
list of sequences
list
dsanneal
(dsDNA, min_bases=13, depth=None)[source]¶Simulate annealing a double stranded piece of DNA to a double_stranded template.
features
¶Return a list of feature positions.
with_nodes (bool) – if True, will return a tuple composed of a feature to position dictionary and a feature to start and end node. If False, will just return a feature to position dictionary
feature positions dictionary OR tuple of feature positions dictionary and feature node dictionary
tuple
features_list
¶Returns set of features contained in sequence.
set of features in this sequence
set
find_ends
(nodes)¶Efficiently finds the head and tails from a group of nodes.
find_feature_by_name
(name)[source]¶Find features by name.
name (basestring) – feature name
list of features
list
find_iter
(query: jdna.linked_list.DoubleLinkedList, min_query_length: int = None, direction: int = <Direction.FORWARD: 1>, protocol: Callable = None, depth: int = None)¶Iteratively finds positions that match the query.
query (DoubleLinkedList) – query list to find
min_query_length (inst) – the minimum number of matches to return. If None, find_iter will only return complete matches
direction (int or tuple) – If Direction.FORWARD (+1), find iter will search from the query head and search forward, potentially leaving a ‘tail’ overhang on the query. If Direction.REVERSE (-1), find iter will search from the query tail and search reverse, potentially leaving a ‘head’ overhang on the query. If a tuple, the template_direction and query_direction are set respectively.
protocol (callable) – the callable taking two parameters (as Node) to compare during find. If None, defaults to ‘equivalent’
list of LinkedListMatches
list
inclusive_range
(i: int, j: int) → Generator[jdna.linked_list.Node, None, None]¶Return generator for inclusive nodes between index i and j.
If i is None, assume i is the head node.
new_slice
(start: jdna.linked_list.Node, end: jdna.linked_list.Node) → jdna.linked_list.DoubleLinkedList¶Return a copy of the sequence between ‘start’ and ‘end’ nodes)
node_range
(start: jdna.linked_list.Node, end: jdna.linked_list.Node) → Generator[jdna.linked_list.Node, None, None]¶Iterate between ‘start’ to ‘end’ nodes (inclusive)
print
(indent=None, width=None, spacer=None, complement=False, features=True, **kwargs)[source]¶Create and print a SequenceViewer
instance from this
sequence. Printing the view object with annotations and complement will
produce an output similar to the following:
> "Unnamed" (550bp)
----------------GFP----------------
|<START
---- -----------RFP-----------
0 CCCAGGACTAGCGACTTTCCGTAACGCGACCTAACACCGGCCGTTCCTTCGAGCCAGGCAAATGTTACGTCACTTCCTTAGATTT
GGGTCCTGATCGCTGAAAGGCATTGCGCTGGATTGTGGCCGGCAAGGAAGCTCGGTCCGTTTACAATGCAGTGAAGGAATCTAAA
------GFP------
-----------------------------------------RFP-----------------------------------------
85 TGAACAGCGCCGTACCCCGATATGATATTTAGATATATAGCAGTTACACTTGGGGTTGCTATGGACTTAGATCTGCTGTATGTTT
ACTTGTCGCGGCATGGGGCTATACTATAAATCTATATATCGTCAATGTGAACCCCAACGATACCTGAATCTAGACGACATACAAA
-----------------------------------------RFP-----------------------------------------
170 TCTTACCTTCCGCATCAGGGGACAATTCGCCAGTAGAATTCAGTTTGTGCGTGAGAACATAAGATTGAATCCCACGCAGGCACAA
AGAATGGAAGGCGTAGTCCCCTGTTAAGCGGTCATCTTAAGTCAAACACGCACTCTTGTATTCTAACTTAGGGTGCGTCCGTGTT
---------------------RFP----------------------
255 GCAGGGCGGGCAGACTCTATAGGTCCTAAGACCCTGAGACTGCGTCCTCAAGATACAGGTTAACAATCCCCGTATGGAGCCGTTC
CGTCCCGCCCGTCTGAGATATCCAGGATTCTGGGACTCTGACGCAGGAGTTCTATGTCCAATTGTTAGGGGCATACCTCGGCAAG
340 TTAGCATGACCCGACAGGTGGGCTTGGCTCGCGTAAGTTGAGTGTTGCAGATACCTGCTGCTGCGCGGTCTAGGGGGAATCGCCG
AATCGTACTGGGCTGTCCACCCGAACCGAGCGCATTCAACTCACAACGTCTATGGACGACGACGCGCCAGATCCCCCTTAGCGGC
425 ATTTTGACGTAGGATCGGTAATGGGCAGTAAACCCGCAACTATTTTCAGCACCAGATGCAAGTTTCCCTAGAAAGCGTCATGGTT
TAAAACTGCATCCTAGCCATTACCCGTCATTTGGGCGTTGATAAAAGTCGTGGTCTACGTTCAAAGGGATCTTTCGCAGTACCAA
510 TGCAATCTCCTTAGGTCACAGCAAACATAGCAGCCCCTGT
ACGTTAGAGGAATCCAGTGTCGTTTGTATCGTCGGGGACA
indent (int) – indent between left column and base pairs view windo
width (int) – width of the view window
spacer (basestring) – string to intersperse between sequence rows (default is newline)
complement (bool) – whether to include the complementary strand in the view
include_annotations (bool) – whether to include annotations/features in the view instance
the viewer object
range
(i: int, j: int) → Generator[jdna.linked_list.Node, None, None]¶Returns an iterator from node at ‘i’ to node at ‘j-1’.
tm
()[source]¶Calculate the Tm of this sequence using primer3 defaults.
the tm of the sequence
float
view
(indent=10, width=85, spacer=None, complement=False, features=True, **kwargs)[source]¶Create a SequenceViewer
instance from this sequence.
Printing the view object with annotations and complement will produce
an output similar to the following:
> "Unnamed" (550bp)
----------------GFP----------------
|<START
---- -----------RFP-----------
0 CCCAGGACTAGCGACTTTCCGTAACGCGACCTAACACCGGCCGTTCCTTCGAGCCAGGCAAATGTTACGTCACTTCCTTAGATTT
GGGTCCTGATCGCTGAAAGGCATTGCGCTGGATTGTGGCCGGCAAGGAAGCTCGGTCCGTTTACAATGCAGTGAAGGAATCTAAA
------GFP------
-----------------------------------------RFP-----------------------------------------
85 TGAACAGCGCCGTACCCCGATATGATATTTAGATATATAGCAGTTACACTTGGGGTTGCTATGGACTTAGATCTGCTGTATGTTT
ACTTGTCGCGGCATGGGGCTATACTATAAATCTATATATCGTCAATGTGAACCCCAACGATACCTGAATCTAGACGACATACAAA
-----------------------------------------RFP-----------------------------------------
170 TCTTACCTTCCGCATCAGGGGACAATTCGCCAGTAGAATTCAGTTTGTGCGTGAGAACATAAGATTGAATCCCACGCAGGCACAA
AGAATGGAAGGCGTAGTCCCCTGTTAAGCGGTCATCTTAAGTCAAACACGCACTCTTGTATTCTAACTTAGGGTGCGTCCGTGTT
---------------------RFP----------------------
255 GCAGGGCGGGCAGACTCTATAGGTCCTAAGACCCTGAGACTGCGTCCTCAAGATACAGGTTAACAATCCCCGTATGGAGCCGTTC
CGTCCCGCCCGTCTGAGATATCCAGGATTCTGGGACTCTGACGCAGGAGTTCTATGTCCAATTGTTAGGGGCATACCTCGGCAAG
340 TTAGCATGACCCGACAGGTGGGCTTGGCTCGCGTAAGTTGAGTGTTGCAGATACCTGCTGCTGCGCGGTCTAGGGGGAATCGCCG
AATCGTACTGGGCTGTCCACCCGAACCGAGCGCATTCAACTCACAACGTCTATGGACGACGACGCGCCAGATCCCCCTTAGCGGC
425 ATTTTGACGTAGGATCGGTAATGGGCAGTAAACCCGCAACTATTTTCAGCACCAGATGCAAGTTTCCCTAGAAAGCGTCATGGTT
TAAAACTGCATCCTAGCCATTACCCGTCATTTGGGCGTTGATAAAAGTCGTGGTCTACGTTCAAAGGGATCTTTCGCAGTACCAA
510 TGCAATCTCCTTAGGTCACAGCAAACATAGCAGCCCCTGT
ACGTTAGAGGAATCCAGTGTCGTTTGTATCGTCGGGGACA
indent (int) – indent between left column and base pairs view windo
width (int) – width of the view window
spacer (basestring) – string to intersperse between sequence rows (default is newline)
complement (bool) – whether to include the complementary strand in the view
features (bool) – whether to include annotations/features in the view instance
the viewer object