Commit ba20e779 authored by Kenzo-Hugo Hillion's avatar Kenzo-Hugo Hillion
Browse files

change name gene_length to length

parent 0e823d06
Pipeline #13633 passed with stages
in 1 minute and 43 seconds
......@@ -42,7 +42,7 @@ class TestGenes(TestCase):
class TestCountWindows(TestCase):
def setUp(self):
self.window_col = "gene_length"
self.window_col = "length"
self.df = pd.DataFrame(
[22, 29, 35],
columns=[self.window_col]
......
......@@ -33,7 +33,7 @@ class IGCLineParser(object):
return {
'igc_id': gene_info[0],
'gene_id': gene_info[1],
'gene_length': gene_info[2],
'length': gene_info[2],
'gene_completeness_status': gene_info[3],
'cohort_origin': gene_info[4],
'taxo_phylum': gene_info[5],
......
......@@ -9,7 +9,7 @@ class TestIGCLineParser(TestCase):
raw_data = [
'gene_id',
'gene_name',
'gene_length',
'length',
'gene_completeness_status',
'cohort_origin',
'taxo_phylum',
......@@ -26,7 +26,7 @@ class TestIGCLineParser(TestCase):
expected_dict = {
'igc_id': raw_data[0],
'gene_id': raw_data[1],
'gene_length': raw_data[2],
'length': raw_data[2],
'gene_completeness_status': raw_data[3],
'cohort_origin': raw_data[4],
'taxo_phylum': raw_data[5],
......
......@@ -22,7 +22,7 @@ _LOGGER = logging.getLogger(__name__)
PHYLUM_COL = 'taxo_phylum'
GENUS_COL = 'taxo_genus'
SELECTED_KEYS = ['gene_id', 'gene_length', 'kegg_ko', PHYLUM_COL, GENUS_COL]
SELECTED_KEYS = ['gene_id', 'length', 'kegg_ko', PHYLUM_COL, GENUS_COL]
def parse_gene(raw_line, selected_keys=SELECTED_KEYS):
......
......@@ -13,7 +13,7 @@ class TestParseGene(TestCase):
raw_data = [
'gene_id',
'gene_name',
'gene_length',
'length',
'gene_completeness_status',
'cohort_origin',
'taxo_phylum',
......@@ -34,7 +34,7 @@ class TestParseGene(TestCase):
"""
expected_dict = {
'gene_id': 'gene_name',
'gene_length': 'gene_length',
'length': 'length',
'kegg_ko': 'kegg',
'taxo_phylum': 'taxo_phylum',
'taxo_genus': 'taxo_genus',
......@@ -46,10 +46,10 @@ class TestParseGene(TestCase):
"""
This test should failed and need to be updated when SELECTED_KEYS are changed
"""
selected_keys = ['gene_id', 'gene_length']
selected_keys = ['gene_id', 'length']
expected_dict = {
'gene_id': 'gene_name',
'gene_length': 'gene_length'
'length': 'length'
}
tested_dict = parse_gene(self.raw_line, selected_keys=selected_keys)
self.assertDictEqual(tested_dict, expected_dict)
......@@ -58,10 +58,10 @@ class TestParseGene(TestCase):
"""
Unknown key should be ignored
"""
selected_keys = ['gene_id', 'gene_length', 'secret_code']
selected_keys = ['gene_id', 'length', 'secret_code']
expected_dict = {
'gene_id': 'gene_name',
'gene_length': 'gene_length'
'length': 'length'
}
tested_dict = parse_gene(self.raw_line, selected_keys=selected_keys)
self.assertDictEqual(tested_dict, expected_dict)
......@@ -72,15 +72,15 @@ class TestUpsertGene(APITestCase):
def test_insert_valid_gene_no_kegg(self):
valid_gene = {
'gene_id': 'test_gene01',
'gene_length': 3556
'length': 3556
}
upsert_gene(valid_gene)
self.assertEqual(Gene.objects.all().count(), 1)
def test_insert_invalid_gene_length(self):
def test_insert_invalid_length(self):
invalid_gene = {
'gene_id': 'test_gene01',
'gene_length': 'wrong_format'
'length': 'wrong_format'
}
with self.assertRaises(ValidationError) as context: # noqa
upsert_gene(invalid_gene)
......@@ -88,16 +88,16 @@ class TestUpsertGene(APITestCase):
def test_update_gene(self):
valid_gene = {
'gene_id': 'test_gene01',
'gene_length': 3556
'length': 3556
}
updated_gene = {
'gene_id': 'test_gene01',
'gene_length': 356
'length': 356
}
upsert_gene(valid_gene)
self.assertEqual(Gene.objects.get(gene_id="test_gene01").gene_length, 3556)
self.assertEqual(Gene.objects.get(gene_id="test_gene01").length, 3556)
upsert_gene(updated_gene)
self.assertEqual(Gene.objects.get(gene_id="test_gene01").gene_length, 356)
self.assertEqual(Gene.objects.get(gene_id="test_gene01").length, 356)
class TestSelectTaxonomy(TestCase):
......@@ -114,13 +114,13 @@ class TestSelectTaxonomy(TestCase):
def test_both_unknown(self):
gene_dict = {
'gene_id': 'gene',
'gene_length': 135,
'length': 135,
'taxo_phylum': 'unknown',
'taxo_genus': 'unknown'
}
expected_dict = {
'gene_id': 'gene',
'gene_length': 135
'length': 135
}
tested_dict = select_taxonomy(gene_dict)
self.assertDictEqual(tested_dict, expected_dict)
......@@ -22,7 +22,7 @@
>
<template v-slot:items="props">
<td>{{ props.item.gene_id }}</td>
<td class="text-xs">{{ props.item.gene_length }}</td>
<td class="text-xs">{{ props.item.length }}</td>
<td class="text-xs"></td>
<td class="text-xs">{{ props.item.functions[0] }}</td>
</template>
......@@ -48,7 +48,7 @@ export default {
sortable: false,
value: 'name',
},
{ text: 'Length', value: 'gene_length' },
{ text: 'Length', value: 'length' },
{ text: 'Taxo', sortable: false },
{ text: 'Functions', value: 'functions', sortable: false },
],
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment