예제 #1
0
def binary_classification_dataset_setup(iterable_seq=None, negative_shuffle_ratio=None, shuffle_order=None):

    iter1, iter2 = tee(iterable_seq)
    iterable_graph = rnafold_to_eden(iter1)
    iter3 = seq_to_seq(iter2, modifier=shuffle_modifier,
                       times=negative_shuffle_ratio, order=shuffle_order)
    iterable_graph_neg = rnafold_to_eden(iter3)
    return iterable_graph, iterable_graph_neg
예제 #2
0
 def transform(self, seqs=None, mfe=False):
     if mfe is False:
         graphs = rnashapes_to_eden(seqs,
                                    shape_type=self.shape_type,
                                    energy_range=self.energy_range,
                                    max_num=self.max_num,
                                    split_components=self.split_components)
     else:
         graphs = rnafold_to_eden(seqs)
     return graphs
예제 #3
0
 def transform(self, seqs=None, mfe=False):
     if mfe is False:
         graphs = rnashapes_to_eden(seqs,
                                    shape_type=self.shape_type,
                                    energy_range=self.energy_range,
                                    max_num=self.max_num,
                                    split_components=self.split_components)
     else:
         graphs = rnafold_to_eden(seqs)
     return graphs
예제 #4
0
 def rna_refold(self, digraph=None, seq=None, vectorizer=None):
     """
     :param digraph:
     :param seq:
     :return: will extract a sequence, RNAfold it and create a abstract graph
     """
     # get a sequence no matter what :)
     if not seq:
         seq = get_sequence(digraph)
     # print 'seq:',seq
     graph = rnafold_to_eden([("emptyheader", seq)], shape_type=5, energy_range=30, max_num=3).next()
     expanded_graph = self.vectorizer._edge_to_vertex_transform(graph)
     ex_di_graph = graphlearn.minor.rnaabstract.expanded_rna_graph_to_digraph(expanded_graph)
     ex_di_graph.graph["sequence"] = seq
     # abstract_graph = directedgraphtools.direct_abstraction_wrapper(graph,0)
     return ex_di_graph
예제 #5
0
def get_graphs(rfam_id = '../example/RF00005',size=9999):
    seqs = fasta_to_sequence(rfam_uri(rfam_id))
    graphs = islice( clean(rnafold_to_eden(seqs, shape_type=5, energy_range=30, max_num=3)), size)
    return graphs
예제 #6
0
def get_graphs(rfam_id='../example/RF00005', size=9999):
    seqs = fasta_to_sequence(rfam_uri(rfam_id))
    graphs = islice(
        clean(rnafold_to_eden(seqs, shape_type=5, energy_range=30, max_num=3)),
        size)
    return graphs
예제 #7
0
def pre_processor_rnafold(seqs):
    graphs = rnafold_to_eden(seqs)

    #from eden.modifier.graph import structure
    #graphs = structure.basepair_to_nesting(graphs)
    return graphs