MCPcopy Create free account
hub / github.com/Koeng101/dnadesign / Example_writeAll

Function Example_writeAll

lib/bio/example_test.go:141–171  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

139}
140
141func Example_writeAll() {
142 // The following can be replaced with a any io.Reader. For example,
143 // `file, err := os.Open(path)` for file would also work.
144 file := strings.NewReader(`#slow5_version 0.2.0
145#num_read_groups 1
146@asic_id 4175987214
147#char* uint32_t double double double double uint64_t int16_t* uint64_t int32_t uint8_t double enum{unknown,partial,mux_change,unblock_mux_change,data_service_unblock_mux_change,signal_positive,signal_negative} char*
148#read_id read_group digitisation offset range sampling_rate len_raw_signal raw_signal start_time read_number start_mux median_before end_reason channel_number
1490026631e-33a3-49ab-aa22-3ab157d71f8b 0 8192 16 1489.52832 4000 5347 430,472,463 8318394 5383 1 219.133423 5 10
150`)
151 parser, _ := bio.NewSlow5Parser(file)
152 reads, header, _ := parser.ParseWithHeader() // Parse all data records from file
153
154 // Write the files to an io.Writer.
155 // All headers and all records implement io.WriterTo interfaces.
156 var buffer bytes.Buffer
157 _, _ = header.WriteTo(&buffer)
158 for _, read := range reads {
159 _, _ = read.WriteTo(&buffer)
160 }
161
162 fmt.Println(buffer.String())
163 // Output: #slow5_version 0.2.0
164 //#num_read_groups 1
165 //@asic_id 4175987214
166 //#char* uint32_t double double double double uint64_t int16_t* uint64_t int32_t uint8_t double enum{unknown,partial,mux_change,unblock_mux_change,data_service_unblock_mux_change,signal_positive,signal_negative} char*
167 //#read_id read_group digitisation offset range sampling_rate len_raw_signal raw_signal start_time read_number start_mux median_before end_reason channel_number
168 //0026631e-33a3-49ab-aa22-3ab157d71f8b 0 8192 16 1489.52832 4000 5347 430,472,463 8318394 5383 1 219.133423 5 10
169 //
170 //
171}
172
173func ExampleNewFastaParser() {
174 // The following can be replaced with a any io.Reader. For example,

Callers

nothing calls this directly

Calls 2

ParseWithHeaderMethod · 0.80
WriteToMethod · 0.45

Tested by

no test coverage detected