def add_genelist(self, list_id, gene_ids, case_obj=None):
        """Create a new gene list and optionally link to cases."""
        new_genelist = GeneList(list_id=list_id)
        new_genelist.gene_ids = gene_ids
        if case_obj:
            new_genelist.cases.append(case_obj)

        self.session.add(new_genelist)
        self.save()
        return new_genelist