示例#1
0
文件: motif.py 项目: bgruening/EDeN
 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
示例#2
0
 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
示例#3
0
文件: subarray.py 项目: smautner/EDeN
 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
示例#4
0
 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