def test_frags_from_map(): filename = "../data/chip_seq_datasets/ArcA_park_et_al/SRR835423/SRR835423.map" reads = read_map(filename) num_frags = 10000 frags = frags_from_map(filename,num_frags,mfl=250) plot_reads(reads) plot_reads(map(lambda (start,stop):('+',start,stop),frags))
def sanity_check(): G = 10000 config = [G/2] mfl = 250 lamb = 1.0/mfl num_frags = 10000 frags = concat([chip(G,config,mfl) for i in xrange(num_frags)]) min_seq_length = 75 sequenced_frags = filter(lambda (start,stop):stop - start > min_seq_length,frags) fd_frags,bk_frags = separate(lambda x:random.random() < 0.5,sequenced_frags) fd_reads = [('+',start,start+min_seq_length) for (start,stop) in fd_frags] bk_reads = [('-',stop-min_seq_length,stop) for (start,stop) in bk_frags] reads = fd_reads + bk_reads inferred_frags = exp_reconstruction(reads,lamb,G) plot_reads(reads,G=G) plt.plot(frag_density(frags,G=G),label="all frags") plt.plot(frag_density(sequenced_frags,G=G),label="seq frags") plt.plot((inferred_frags),label="inferred frags") plt.legend()