@@ -176,7 +176,7 @@ impl TableCollection {
176176 self . add_edge_with_metadata ( left, right, parent, child, None )
177177 }
178178
179- /// Add a row with metadata to the edge table
179+ /// Add a row with optional metadata to the edge table
180180 pub fn add_edge_with_metadata < P : Into < NodeId > , C : Into < NodeId > > (
181181 & mut self ,
182182 left : f64 ,
@@ -201,6 +201,18 @@ impl TableCollection {
201201 handle_tsk_return_value ! ( rv, EdgeId :: from( rv) )
202202 }
203203
204+ /// Add a row with metadata to the edge table
205+ pub fn add_edge_with_some_metadata < P : Into < NodeId > , C : Into < NodeId > > (
206+ & mut self ,
207+ left : f64 ,
208+ right : f64 ,
209+ parent : P ,
210+ child : C ,
211+ metadata : & dyn MetadataRoundtrip ,
212+ ) -> Result < EdgeId , TskitError > {
213+ self . add_edge_with_metadata ( left, right, parent, child, Some ( metadata) )
214+ }
215+
204216 /// Add a row to the individual table
205217 pub fn add_individual < I : Into < IndividualId > > (
206218 & mut self ,
@@ -235,6 +247,17 @@ impl TableCollection {
235247 handle_tsk_return_value ! ( rv, IndividualId :: from( rv) )
236248 }
237249
250+ /// Add a row with metadata to the individual table
251+ pub fn add_individual_with_some_metadata < I : Into < IndividualId > > (
252+ & mut self ,
253+ flags : tsk_flags_t ,
254+ location : & [ f64 ] ,
255+ parents : & [ I ] ,
256+ metadata : & dyn MetadataRoundtrip ,
257+ ) -> Result < IndividualId , TskitError > {
258+ self . add_individual_with_metadata ( flags, location, parents, Some ( metadata) )
259+ }
260+
238261 /// Add a row to the migration table
239262 ///
240263 /// # Warnings
@@ -251,7 +274,7 @@ impl TableCollection {
251274 self . add_migration_with_metadata ( span, node, source_dest, time, None )
252275 }
253276
254- /// Add a row with metadata to the migration table
277+ /// Add a row with optional metadata to the migration table
255278 ///
256279 /// # Warnings
257280 ///
@@ -286,6 +309,27 @@ impl TableCollection {
286309 handle_tsk_return_value ! ( rv)
287310 }
288311
312+ /// Add a row with metadata to the migration table
313+ ///
314+ /// # Warnings
315+ ///
316+ /// Migration tables are not currently supported
317+ /// by tree sequence simplification.
318+ pub fn add_migration_with_some_metadata <
319+ N : Into < NodeId > ,
320+ SOURCE : Into < PopulationId > ,
321+ DEST : Into < PopulationId > ,
322+ > (
323+ & mut self ,
324+ span : ( f64 , f64 ) ,
325+ node : N ,
326+ source_dest : ( SOURCE , DEST ) ,
327+ time : f64 ,
328+ metadata : & dyn MetadataRoundtrip ,
329+ ) -> TskReturnValue {
330+ self . add_migration_with_metadata ( span, node, source_dest, time, Some ( metadata) )
331+ }
332+
289333 /// Add a row to the node table
290334 pub fn add_node < I : Into < IndividualId > , POP : Into < PopulationId > > (
291335 & mut self ,
@@ -297,7 +341,7 @@ impl TableCollection {
297341 self . add_node_with_metadata ( flags, time, population, individual, None )
298342 }
299343
300- /// Add a row with metadata to the node table
344+ /// Add a row with optional metadata to the node table
301345 pub fn add_node_with_metadata < I : Into < IndividualId > , POP : Into < PopulationId > > (
302346 & mut self ,
303347 flags : ll_bindings:: tsk_flags_t ,
@@ -322,6 +366,18 @@ impl TableCollection {
322366 handle_tsk_return_value ! ( rv, rv. into( ) )
323367 }
324368
369+ /// Add a row with metadata to the node table
370+ pub fn add_node_with_some_metadata < I : Into < IndividualId > , POP : Into < PopulationId > > (
371+ & mut self ,
372+ flags : ll_bindings:: tsk_flags_t ,
373+ time : f64 ,
374+ population : POP ,
375+ individual : I ,
376+ metadata : & dyn MetadataRoundtrip ,
377+ ) -> Result < NodeId , TskitError > {
378+ self . add_node_with_metadata ( flags, time, population, individual, Some ( metadata) )
379+ }
380+
325381 /// Add a row to the site table
326382 pub fn add_site (
327383 & mut self ,
@@ -331,7 +387,7 @@ impl TableCollection {
331387 self . add_site_with_metadata ( position, ancestral_state, None )
332388 }
333389
334- /// Add a row with metadata to the site table
390+ /// Add a row with optional metadata to the site table
335391 pub fn add_site_with_metadata (
336392 & mut self ,
337393 position : f64 ,
@@ -355,6 +411,16 @@ impl TableCollection {
355411 handle_tsk_return_value ! ( rv, SiteId :: from( rv) )
356412 }
357413
414+ /// Add a row with metadata to the site table
415+ pub fn add_site_with_some_metadata (
416+ & mut self ,
417+ position : f64 ,
418+ ancestral_state : Option < & [ u8 ] > ,
419+ metadata : & dyn MetadataRoundtrip ,
420+ ) -> Result < SiteId , TskitError > {
421+ self . add_site_with_metadata ( position, ancestral_state, Some ( metadata) )
422+ }
423+
358424 /// Add a row to the mutation table.
359425 pub fn add_mutation < N : Into < NodeId > , M : Into < MutationId > , S : Into < SiteId > > (
360426 & mut self ,
@@ -367,7 +433,7 @@ impl TableCollection {
367433 self . add_mutation_with_metadata ( site, node, parent, time, derived_state, None )
368434 }
369435
370- /// Add a row with metadata to the mutation table.
436+ /// Add a row with optional metadata to the mutation table.
371437 pub fn add_mutation_with_metadata < N : Into < NodeId > , M : Into < MutationId > , S : Into < SiteId > > (
372438 & mut self ,
373439 site : S ,
@@ -397,12 +463,29 @@ impl TableCollection {
397463 handle_tsk_return_value ! ( rv, MutationId :: from( rv) )
398464 }
399465
466+ /// Add a row with metadata to the mutation table.
467+ pub fn add_mutation_with_some_metadata <
468+ N : Into < NodeId > ,
469+ M : Into < MutationId > ,
470+ S : Into < SiteId > ,
471+ > (
472+ & mut self ,
473+ site : S ,
474+ node : N ,
475+ parent : M ,
476+ time : f64 ,
477+ derived_state : Option < & [ u8 ] > ,
478+ metadata : & dyn MetadataRoundtrip ,
479+ ) -> Result < MutationId , TskitError > {
480+ self . add_mutation_with_metadata ( site, node, parent, time, derived_state, Some ( metadata) )
481+ }
482+
400483 /// Add a row to the population_table
401484 pub fn add_population ( & mut self ) -> Result < PopulationId , TskitError > {
402485 self . add_population_with_metadata ( None )
403486 }
404487
405- /// Add a row with metadata to the population_table
488+ /// Add a row with optional metadata to the population_table
406489 pub fn add_population_with_metadata (
407490 & mut self ,
408491 metadata : Option < & dyn MetadataRoundtrip > ,
@@ -419,6 +502,14 @@ impl TableCollection {
419502 handle_tsk_return_value ! ( rv, PopulationId :: from( rv) )
420503 }
421504
505+ /// Add a row with metadata to the population_table
506+ pub fn add_population_with_some_metadata (
507+ & mut self ,
508+ metadata : & dyn MetadataRoundtrip ,
509+ ) -> Result < PopulationId , TskitError > {
510+ self . add_population_with_metadata ( Some ( metadata) )
511+ }
512+
422513 /// Build the "input" and "output"
423514 /// indexes for the edge table.
424515 ///
0 commit comments