Skip to content

Commit 29a5114

Browse files
committed
Improve assembly example
1 parent edbb37f commit 29a5114

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

notes.markdown

+4-6
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,8 @@ draw_circular = tz.partial(nx.draw_circular, with_labels=True,
210210
node_color='w',
211211
node_size=600)
212212
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
216215
curried.map(''.join), # make strings from tup of char
217216
curried.map(eu.edge_from_kmer), # get k-1-mer tuples
218217
eu.add_edges(g), # add them as edges to the graph
@@ -234,9 +233,8 @@ def assemble(euler_path):
234233

235234
reads = generate_reads(seq)
236235
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
240238
curried.map(''.join), # make string from tup of char
241239
curried.map(eu.edge_from_kmer), # get k-1-mer tups
242240
eu.add_edges(g), # add edges to g

0 commit comments

Comments
 (0)