예제 #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