@@ -5372,6 +5372,25 @@ TableCollection_get_sequence_length(TableCollection *self, void *closure)
53725372 return Py_BuildValue ("f" , self -> tables -> sequence_length );
53735373}
53745374
5375+ static int
5376+ TableCollection_set_sequence_length (TableCollection * self , PyObject * value , void * closure )
5377+ {
5378+ int ret = -1 ;
5379+
5380+ if (value == NULL ) {
5381+ PyErr_SetString (PyExc_TypeError , "Cannot delete the sequence_length attribute" );
5382+ goto out ;
5383+ }
5384+ if (! PyNumber_Check (value )) {
5385+ PyErr_SetString (PyExc_TypeError , "sequence_length must be a number" );
5386+ goto out ;
5387+ }
5388+ self -> tables -> sequence_length = PyFloat_AsDouble (value );
5389+ ret = 0 ;
5390+ out :
5391+ return ret ;
5392+ }
5393+
53755394static PyObject *
53765395TableCollection_get_file_uuid (TableCollection * self , void * closure )
53775396{
@@ -5499,6 +5518,45 @@ TableCollection_deduplicate_sites(TableCollection *self)
54995518 return ret ;
55005519}
55015520
5521+ static PyObject *
5522+ TableCollection_build_index (TableCollection * self )
5523+ {
5524+ int err ;
5525+ PyObject * ret = NULL ;
5526+
5527+ err = tsk_table_collection_build_index (self -> tables , 0 );
5528+ if (err != 0 ) {
5529+ handle_library_error (err );
5530+ goto out ;
5531+ }
5532+ ret = Py_BuildValue ("" );
5533+ out :
5534+ return ret ;
5535+ }
5536+
5537+ static PyObject *
5538+ TableCollection_drop_index (TableCollection * self )
5539+ {
5540+ int err ;
5541+ PyObject * ret = NULL ;
5542+
5543+ err = tsk_table_collection_drop_index (self -> tables , 0 );
5544+ if (err != 0 ) {
5545+ handle_library_error (err );
5546+ goto out ;
5547+ }
5548+ ret = Py_BuildValue ("" );
5549+ out :
5550+ return ret ;
5551+ }
5552+
5553+ static PyObject *
5554+ TableCollection_has_index (TableCollection * self )
5555+ {
5556+ bool has_index = tsk_table_collection_has_index (self -> tables , 0 );
5557+ return Py_BuildValue ("i" , (int ) has_index );
5558+ }
5559+
55025560/* Forward declaration */
55035561static PyTypeObject TableCollectionType ;
55045562
@@ -5525,24 +5583,31 @@ static PyGetSetDef TableCollection_getsetters[] = {
55255583 {"mutations" , (getter ) TableCollection_get_mutations , NULL , "The mutation table." },
55265584 {"populations" , (getter ) TableCollection_get_populations , NULL , "The population table." },
55275585 {"provenances" , (getter ) TableCollection_get_provenances , NULL , "The provenance table." },
5528- {"sequence_length" , (getter ) TableCollection_get_sequence_length , NULL ,
5529- "The sequence length." },
5586+ {"sequence_length" ,
5587+ (getter ) TableCollection_get_sequence_length ,
5588+ (setter ) TableCollection_set_sequence_length , "The sequence length." },
55305589 {"file_uuid" , (getter ) TableCollection_get_file_uuid , NULL ,
55315590 "The UUID of the corresponding file." },
55325591 {NULL } /* Sentinel */
55335592};
55345593
55355594static PyMethodDef TableCollection_methods [] = {
55365595 {"simplify" , (PyCFunction ) TableCollection_simplify , METH_VARARGS |METH_KEYWORDS ,
5537- "Simplifies for a given sample subset." },
5596+ "Simplifies for a given sample subset." },
55385597 {"sort" , (PyCFunction ) TableCollection_sort , METH_VARARGS |METH_KEYWORDS ,
5539- "Sorts the tables to satisfy tree sequence requirements." },
5598+ "Sorts the tables to satisfy tree sequence requirements." },
55405599 {"equals" , (PyCFunction ) TableCollection_equals , METH_VARARGS ,
5541- "Returns True if the parameter table collection is equal to this one." },
5600+ "Returns True if the parameter table collection is equal to this one." },
55425601 {"compute_mutation_parents" , (PyCFunction ) TableCollection_compute_mutation_parents ,
55435602 METH_NOARGS , "Computes the mutation parents for a the tables." },
55445603 {"deduplicate_sites" , (PyCFunction ) TableCollection_deduplicate_sites ,
55455604 METH_NOARGS , "Removes sites with duplicate positions." },
5605+ {"build_index" , (PyCFunction ) TableCollection_build_index ,
5606+ METH_NOARGS , "Builds an index on the table collection." },
5607+ {"drop_index" , (PyCFunction ) TableCollection_drop_index ,
5608+ METH_NOARGS , "Drops indexes." },
5609+ {"has_index" , (PyCFunction ) TableCollection_has_index ,
5610+ METH_NOARGS , "Returns True if the TableCollection is indexed." },
55465611 {NULL } /* Sentinel */
55475612};
55485613
0 commit comments