MCPcopy Index your code
hub / github.com/alignoth/alignoth / encode_sparse

Method encode_sparse

src/plot.rs:254–271  ·  view source on GitHub ↗

Helper for sparse encoding of a base track (A, T, G, C)

(&self, f: F)

Source from the content-addressed store, hash-verified

252
253 /// Helper for sparse encoding of a base track (A, T, G, C)
254 fn encode_sparse<F>(&self, f: F) -> String
255 where
256 F: Fn(&BaseCoverage) -> usize,
257 {
258 self.0
259 .iter()
260 .enumerate()
261 .filter_map(|(i, bc)| {
262 let cov = f(bc);
263 if cov > 0 {
264 Some(format!("{}|{}", i + 1, cov))
265 } else {
266 None
267 }
268 })
269 .collect::<Vec<_>>()
270 .join("$")
271 }
272
273 pub fn a(&self) -> String {
274 self.encode_sparse(|bc| bc.a)

Callers 4

aMethod · 0.80
tMethod · 0.80
gMethod · 0.80
cMethod · 0.80

Calls 1

fFunction · 0.50

Tested by

no test coverage detected