def test_xlsx_case_parsing(self, es_testapp, wb_project, wb_institution): """ Test that Excel (.xlsx) files including case accessions are appropriately parsed when given in subsequent rows or in one comma-separated row. """ genelist = GeneListSubmission( GENELIST_PATH + "test_parse_cases_gene_list.xlsx", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.case_atids) == 3 assert len(genelist.bam_sample_ids) == 1
def test_excel_format(self, es_testapp, workbook, wb_project, wb_institution): """ Test for correct parsing of excel-formatted gene list. """ genelist = GeneListSubmission( GENELIST_PATH + "test-match_gene_list.xlsx", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.gene_ids) == 2 assert genelist.post_output
def test_validate_and_post(self, es_testapp, workbook, wb_project, wb_institution): """ Test for correct validation but no posting of document and gene list when some genes are not identified in the database. """ genelist = GeneListSubmission( GENELIST_PATH + "test-no-match_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert genelist.validation_output assert not genelist.post_output
def test_parse_empty_genelist(self, es_testapp, workbook, wb_project, wb_institution): """ Tests for detection of empty gene list and no title. """ genelist = GeneListSubmission( GENELIST_PATH + "test-empty_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert not genelist.title assert not genelist.genes assert genelist.errors
def test_match_genes(self, es_testapp, workbook, wb_project, wb_institution): """ Tests for matching of genes given various ID types (correct gene symbol, previous symbol, OMIM ID, etc.) as well as removal of duplicate items in the gene list that both point to the same gene item via different names. """ genelist = GeneListSubmission( GENELIST_PATH + "test-match_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.gene_ids) == 3
def test_parse_empty_genelist_excel(self, es_testapp, workbook, wb_project, wb_institution): """ Tests for correct detection of no title and no genes provided when given an excel gene list. """ genelist = GeneListSubmission( GENELIST_PATH + "test_empty_gene_list.xlsx", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert not genelist.title assert not genelist.genes assert genelist.errors
def test_invalid_case_accession(self, es_testapp, wb_project, wb_institution): """ Test for unsuccessful gene list submission when invalid case accession provided, as well as successful parsing of multiple cases submitted. """ genelist = GeneListSubmission( GENELIST_PATH + "test_no_match_case_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.case_atids) == 3 assert len(genelist.bam_sample_ids) == 1 assert genelist.errors assert not genelist.post_output
def test_valid_case_accession(self, es_testapp, wb_project, wb_institution): """ Test for successful gene list submission when a valid case accession is given. """ genelist = GeneListSubmission( GENELIST_PATH + "test_match_case_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert genelist.case_atids assert genelist.bam_sample_ids assert genelist.post_output assert not genelist.errors
def test_no_match_genes(self, es_testapp, workbook, wb_project, wb_institution): """ Ensure genes that don't match any existing genes are identified and possible alternative genes are provided, if applicable. Also, no posting should occur in this scenario. """ genelist = GeneListSubmission( GENELIST_PATH + "test-no-match_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.gene_ids) == 3 assert genelist.errors assert not genelist.post_output
def test_existing_title(self, es_testapp, workbook, wb_project, wb_institution): """ Ensure gene list and document are patched if attempting to submit gene list with title identical to the title of a previously created gene list associated with the project. Also tests for accurate patching of bam_sample_ids. """ genelist = GeneListSubmission( GENELIST_PATH + "test-previous-title_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert genelist.patch_genelist_uuid assert genelist.patch_document_uuid assert genelist.bam_sample_ids
def test_basic_genelist(self, es_testapp, workbook, wb_project, wb_institution): """ Tests for gene list functionality given gene list with all genes identifiable in the database and a title. """ genelist = GeneListSubmission( GENELIST_PATH + "test-parse_gene_list.txt", wb_project["@id"], wb_institution["@id"], es_testapp, ) assert len(genelist.genes) == 3 assert genelist.title == "Example Gene List" assert len(genelist.gene_ids) == 3 assert len(genelist.post_bodies) == 2 assert wb_project["@id"] == genelist.post_bodies[0]["project"] assert wb_institution["@id"] == genelist.post_bodies[0]["institution"] assert genelist.post_bodies[1]["genes"] == genelist.gene_ids assert genelist.title in genelist.post_bodies[1]["title"] assert genelist.validation_output assert genelist.post_output