pygfa.dovetail_operations package

Submodules

pygfa.dovetail_operations.iterator module

Iterators used by the GFA graph. This iterators work considering only edges representing dovetails overlaps.

class pygfa.dovetail_operations.iterator.DovetailIterator[source]

Bases: object

dovetails_iter(nbunch=None, keys=False, data=False)[source]

Return an iterator on edges that describe dovetail overlaps with the given node.

Notes:It seems that networkx edges_iter keeps track of edges already seen, so the edge (u,v) is in the results but edge (v,u) is not.
dovetails_linear_path_iter(source, keys=False)[source]

Return an iterator over the linear path whose source node belongs to, starting from one end of the path to another.

Parameters:source – One of the node in the linear path.
dovetails_linear_path_traverse_edges_iter(source, keys=False)[source]

Traverse all nodes adjacent to source node where the right degree and left degree of each node is 1.

Parameters:

source – One of the node in the linear path. It doesn’t matter if it’s one of the end of the linear path.

Notes:

If the source node it’s not one of the end node of the path, the result is not an iterator over the ordered node of the linear path, but an iterator where nodes are returned by their distance from the source node.

If the source node is an isolated node, then this method returns an empty list (no edge is found). Use dovetails_linear_path_traverse_nodes_iter instead.

Same code as _plain_bfs_dovetails_with_edges function.

dovetails_linear_path_traverse_nodes_iter(source)[source]

Traverse all nodes adjacent to source node where the right degree and left degree of each node is 1.

Parameters:

source – One of the node in the linear path. It doesn’t matter if it’s one of the end of the linear path.

Notes:

If the source node it’s not one of the end node of the path, the result is not an iterator over the ordered node of the linear path, but an iterator where nodes are returned by their distance from the source node.

The code is the same as networkx _plain_bfs.

dovetails_nbunch_iter(nbunch=None)[source]

Return an iterator checking that the given nbunch nodes are in the graphs. Consider only nodes involved into a dovetail overlap.

dovetails_neighbors(nbunch=None)[source]

Return a list of all the right and left segments of the given nodes.

dovetails_neighbors_iter(nbunch=None, keys=False, data=False)[source]

Return an iterator over neighbors nodes considering all nodes in nbunch as source node.

Notes:This method is used to check right and left links among sequences, so from_node is needed. If only to_node in neighborhood are need, consider using `dovetails_neighbors’.
left(nbunch=None)[source]

Return all the nodes connected to the left end of the given node sequence.

left_degree(nbunch=None)[source]
left_degree_iter(nbunch=None)[source]
left_end_iter(nbunch=None, keys=False, data=False)[source]

Return an iterator over dovetail edges where left segment-end of the nodes ids given are taken into account in the overlap

right(nbunch=None)[source]

Return all the nodes connected to the right end of the given node sequence.

right_degree(nbunch=None)[source]
right_degree_iter(nbunch=None)[source]
right_end_iter(nbunch, keys=False, data=False)[source]

Return an iterator over dovetail edges where nodes id right-segment end is taken into account in the overlap

pygfa.dovetail_operations.linear_paths module

Module that contain operation to find linearh paths in a GFA graph.

pygfa.dovetail_operations.linear_paths.dovetails_linear_path(gfa_, node_, keys=False)[source]

Return the oriented edges involved in a linear path where that contain the given node.

pygfa.dovetail_operations.linear_paths.dovetails_linear_paths(gfa_, components=False, keys=False)[source]

pygfa.dovetail_operations.operations module

pygfa.dovetail_operations.operations.dovetails_remove_dead_ends(gfa_, min_length, safe_remove=False)[source]

Remove all the nodes where its right degree and its left degree are the following (0,0), (1,0), (1,0) and the length of the sequence is less than the given length. The node to remove mustn’t split its connected component in two.

Parameters:
  • min_length
  • consider_sequence – If set try to get the sequence length where length field is not defined.
  • safe_remove – If set the operation doesn’t remove nodes where is not possible to obtain the length value.
Note:

Using the right and left degree, only dovetails overlaps are considered.

pygfa.dovetail_operations.operations.dovetails_remove_small_components(gfa_, min_length)[source]

Remove all the connected components where the sequences length is less than min_length.

Find all the connected components nodes, for each component obtain the sum of the sequences length. If length is less than the given length remove the connected component nodes.

Parameters:

min_length – An integer describing the required length to keep a connected component.

Note:

When connected components are computed only dovetail overlaps

edges are considered.

pygfa.dovetail_operations.simple_paths module

pygfa.dovetail_operations.simple_paths.dovetails_all_simple_paths(gfa_, source, target, edges=False, keys=False, cutoff=None)[source]

Module contents