Repository: EdinburghGenomics/EGCG-Core

Issue:
Replace (.) dots in user sample name with underscores
Change the sanitize_user_id function to remove dots
https://github.com/EdinburghGenomics/EGCG-Core/blob/f54591f5420dc4b4f8241e080e594a5fd6c5f87a/egcg_core/clarity.py#L114

Discussion:

Patch:
diff --git a/egcg_core/clarity.py b/egcg_core/clarity.py
index 0068e9d..39d03f8 100644
--- a/egcg_core/clarity.py
+++ b/egcg_core/clarity.py
@@ -113,7 +113,7 @@ def get_genome_version(sample_id, species=None):
 
 def sanitize_user_id(user_id):
     if isinstance(user_id, str):
-        return re.sub("[^\w_\-.]", "_", user_id)
+        return re.sub("[^\w]", "_", user_id)
 
 
 substitutions = (


Test patch:
diff --git a/tests/test_clarity.py b/tests/test_clarity.py
index c4446fb..271d1d2 100644
--- a/tests/test_clarity.py
+++ b/tests/test_clarity.py
@@ -117,6 +117,7 @@ class TestClarity(TestEGCG):
 
     def test_sanitize_user_id(self):
         assert clarity.sanitize_user_id('this?that$other another:more') == 'this_that_other_another_more'
+        assert clarity.sanitize_user_id('this.that$other another:more') == 'this_that_other_another_more'
 
     def test_get_list_of_samples(self):
         exp_lims_sample_ids = ['this', 'that:01', 'other _L:01']