File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1386,6 +1386,7 @@ def test_normalise_organism_name(self):
13861386 "mus_musculus" )
13871387 self .assertEqual (normalise_organism_name (" Mus musculus " ),
13881388 "mus_musculus" )
1389+ self .assertEqual (normalise_organism_name ("C. elegans" ), "c_elegans" )
13891390
13901391class TestSplitUserHostDir (unittest .TestCase ):
13911392 """Tests for the split_user_host_dir function
Original file line number Diff line number Diff line change @@ -1100,9 +1100,9 @@ def normalise_organism_name(name):
11001100 String: normalised organism name
11011101 """
11021102 # Make lowercase, split on commas and replace whitespace
1103- # with single underscore, then strip leading/trailing
1104- # underscores
1105- return re .sub (r'\s +' ,'_' ,str (name ).lower ()).strip ('_' )
1103+ # and other non-alphanumeric characters with single underscore,
1104+ # finally strip leading/trailing underscores
1105+ return re .sub (r'\W +' ,'_' ,str (name ).lower ()).strip ('_' )
11061106
11071107def split_user_host_dir (location ):
11081108 # Split a location of the form [[user@]host:]dir into its
You can’t perform that action at this time.
0 commit comments