def test_ccle55_cuff_noc2l(): '''Locus containing from 55 CCLE samples assembled with Cufflinks''' # pull SpliceGraph out of GTF t_dict, locus = read_single_locus('noc2l_locus.gtf') found_sgraph = False for sgraph in locus.create_splice_graphs(): if (sgraph.chrom == 'chr1' and sgraph.start == 934942 and sgraph.end == 976702 and sgraph.strand == Strand.NEG): found_sgraph = True break assert found_sgraph # examine specific change points trim = False pval = 0.05 fc_cutoff = 0.8 n1 = Exon(934942, 944589) n1_id = sgraph.get_node_id(n1) assert sgraph.G.node[n1_id][SGNode.IS_STOP] cps = sgraph.detect_change_points(pval=pval, fc_cutoff=fc_cutoff) for cp in cps: sgraph.apply_change_point(cp, trim=trim) true_starts = set([964528, 957434, 959316]) true_stops = set([944278]) assert true_starts.issubset(sgraph.start_sites) assert true_stops.issubset(sgraph.stop_sites) # rebuild graph and examine start/stop nodes sgraph.recreate() # get start/stop nodes start_nodes, stop_nodes = sgraph.get_start_stop_nodes() # convert to node intervals start_nodes = set(sgraph.get_node_interval(n_id) for n_id in start_nodes) stop_nodes = set(sgraph.get_node_interval(n_id) for n_id in stop_nodes) assert Exon(959214, 959316) in start_nodes assert Exon(959316, 964528) in start_nodes assert Exon(957273, 957434) in start_nodes assert Exon(944278, 944321) in stop_nodes # ensure best path uses change points config = Config.defaults() config.max_paths = 1 gene_isoforms = assemble_isoforms(sgraph, config) assert len(gene_isoforms) == 1 isoforms = gene_isoforms[0] assert len(isoforms) == 1 isoform = isoforms[0] assert isoform.path[0] == Exon(944321, 944800) assert isoform.path[-1] == Exon(959214, 959316)
def test_ccle55_cuff_noc2l(): '''Locus containing from 55 CCLE samples assembled with Cufflinks''' # pull SpliceGraph out of GTF t_dict, locus = read_single_locus('noc2l_locus.gtf') found_sgraph = False for sgraph in locus.create_splice_graphs(): if (sgraph.chrom == 'chr1' and sgraph.start == 934942 and sgraph.end == 976702 and sgraph.strand == Strand.NEG): found_sgraph = True break assert found_sgraph # examine specific change points trim = False pval = 0.1 fc_cutoff = 0.8 n1 = Exon(934942, 944589) n1_id = sgraph.get_node_id(n1) assert sgraph.G.is_stop[n1_id] cps = sgraph.detect_change_points(pval=pval, fc_cutoff=fc_cutoff) for cp in cps: sgraph.apply_change_point(cp, trim=trim) true_starts = set([964528, 957434, 959316]) true_stops = set([944278]) assert true_starts.issubset(sgraph.start_sites) assert true_stops.issubset(sgraph.stop_sites) # rebuild graph and examine start/stop nodes sgraph.recreate() # get start/stop nodes start_nodes, stop_nodes = sgraph.get_start_stop_nodes() # convert to node intervals start_nodes = set(sgraph.get_node_interval(n_id) for n_id in start_nodes) stop_nodes = set(sgraph.get_node_interval(n_id) for n_id in stop_nodes) assert Exon(959214, 959316) in start_nodes assert Exon(959316, 964528) in start_nodes assert Exon(957273, 957434) in start_nodes assert Exon(944278, 944321) in stop_nodes # ensure best path uses change points config = Config.defaults() config.max_paths = 1 gene_isoforms = assemble_isoforms(sgraph, config) assert len(gene_isoforms) == 1 isoforms = gene_isoforms[0] assert len(isoforms) == 1 isoform = isoforms[0] assert isoform.path[0] == Exon(944321, 944800) assert isoform.path[-1] == Exon(959214, 959316)
def test_empty_graph_bug(): t_dict, locus = read_single_locus('empty_graph_bug.gtf') transfrags = locus.get_transfrags(Strand.POS) sgraph = SpliceGraph.create(transfrags) isoforms = assemble_isoforms(sgraph, Config.defaults()) assert len(isoforms) == 0