def _serial_graph_motif(self, seqs, placeholder=None): # make graphs iterable = sequence_to_eden(seqs) # use node importance and 'position' attribute to identify max_subarrays of a specific size graphs = self.vectorizer.annotate(iterable, estimator=self.estimator) # use compute_max_subarrays to return an iterator over motives motives = [] for graph in graphs: subarrays = compute_max_subarrays(graph=graph, min_subarray_size=self.min_subarray_size, max_subarray_size=self.max_subarray_size) for subarray in subarrays: motives.append(subarray['subarray_string']) return motives
def _split(self, graph): graphs_list_out = [] subarrays = compute_max_subarrays( graph=graph, min_subarray_size=self.min_subarray_size, max_subarray_size=self.max_subarray_size, output='non_minimal', margin=1) for subarray in subarrays: ids = range(subarray['begin'], subarray['end']) subgraph = nx.Graph(graph.subgraph(ids)) graphs_list_out.append(subgraph) return graphs_list_out
def _split(self, graph): graphs_list_out = [] subarrays = compute_max_subarrays( graph=graph, min_subarray_size=self.min_subarray_size, max_subarray_size=self.max_subarray_size, output="non_minimal", margin=1, ) for subarray in subarrays: ids = range(subarray["begin"], subarray["end"]) subgraph = nx.Graph(graph.subgraph(ids)) graphs_list_out.append(subgraph) return graphs_list_out
def _serial_graph_motif(self, seqs, placeholder=None): # make graphs iterable = sequence_to_eden(seqs) # use node importance and 'position' attribute to identify max_subarrays of a specific size graphs = self.vectorizer.annotate(iterable, estimator=self.estimator) # use compute_max_subarrays to return an iterator over motives motives = [] for graph in graphs: subarrays = compute_max_subarrays( graph=graph, min_subarray_size=self.min_subarray_size, max_subarray_size=self.max_subarray_size) for subarray in subarrays: motives.append(subarray['subarray_string']) return motives