@@ -210,9 +210,8 @@ draw_circular = tz.partial(nx.draw_circular, with_labels=True,
210
210
node_color = ' w' ,
211
211
node_size = 600 )
212
212
reads = generate_reads(seq)
213
- draw = tz.pipe(reads, curried.interpose([' $' ]), # separate the reads
214
- tz.concat, curried.sliding_window(3 ), # get 3-mers
215
- curried.filter(lambda x : ' $' not in x), # discard delims
213
+ draw = tz.pipe(reads, curried.map(curried.sliding_window(3 )), # k-mers
214
+ tz.concat, # join k-mer streams from all reads
216
215
curried.map(' ' .join), # make strings from tup of char
217
216
curried.map(eu.edge_from_kmer), # get k-1-mer tuples
218
217
eu.add_edges(g), # add them as edges to the graph
@@ -234,9 +233,8 @@ def assemble(euler_path):
234
233
235
234
reads = generate_reads(seq)
236
235
g = nx.DiGraph()
237
- inferred = tz.pipe(reads, curried.interpose([' $' ]), # separate the reads
238
- tz.concat, curried.sliding_window(3 ), # get 3-mers
239
- curried.filter(lambda x : ' $' not in x), # discard sep
236
+ inferred = tz.pipe(reads, curried.map(curried.sliding_window(3 )), # k-mers
237
+ tz.concat, # join k-mer streams from all reads
240
238
curried.map(' ' .join), # make string from tup of char
241
239
curried.map(eu.edge_from_kmer), # get k-1-mer tups
242
240
eu.add_edges(g), # add edges to g
0 commit comments