Sometimes, the map names require renaming. 

There are two mechanisms for automatic conversion of the map names: (1) use regular expression to extract part of the map name; (2) add a common prefix to all maps or to those that have been selected by the regular expression at the step (1). Additionally, there is a way to provide the map name conversion table in a text file and use it to convert the names.

Interactive mode

The Interactive mode allows automatic map renaming by responding to the program prompts. Select this mode by pressing the key I:

Rename maps using names from [F]ile or [I]nteractively? I

Convert all names

Let's assume that the names like Chr01 need to be renamed to Gm01

First, we want to extract the sub-string that will be retained in the name. We use the regular expression to extract the numeric part of Chr01: Chr(.+)


PS> edit map_name "Glycine max/Zhonghuang 13"
Rename maps using names from [F]ile or [I]nteractively? I
Editing map names of Glycine max/Zhonghuang 13
List first 100 maps: A - all maps; C - chromosomes only; N - change Number of listed maps? C

List of maps:
Chr01
Chr02
Chr03
Chr04
Chr05
Chr06
Chr07
Chr08
Chr09
Chr10
Chr11
Chr12
Chr13
Chr14
Chr15
Chr16
Chr17
Chr18
Chr19
Chr20
Use regular expression to extract substrings from map names? (Y/N) Y

Regular expression to extract the new names? Chr(.+)
Chr01  ==>      01
Chr02  ==>      02
Chr03  ==>      03
Chr04  ==>      04
Chr05  ==>      05
Chr06  ==>      06
Chr07  ==>      07
Chr08  ==>      08
Chr09  ==>      09
Chr10  ==>      10
Chr11  ==>      11
Chr12  ==>      12
Chr13  ==>      13
Chr14  ==>      14
Chr15  ==>      15
Chr16  ==>      16
Chr17  ==>      17
Chr18  ==>      18
Chr19  ==>      19
Chr20  ==>      20

Apply this regular expression? (Y/N) Y

Add prefix to map names? (Y/N) Y

Having the numeric part extracted, we can now add a prefix Gm:


Add prefix to map names? (Y/N) Y
Prefix: Gm
01 ==> Gm01
02 ==> Gm02
03 ==> Gm03
04 ==> Gm04
05 ==> Gm05
06 ==> Gm06
07 ==> Gm07
08 ==> Gm08
09 ==> Gm09
10 ==> Gm10
11 ==> Gm11
12 ==> Gm12
13 ==> Gm13
14 ==> Gm14
15 ==> Gm15
16 ==> Gm16
17 ==> Gm17
18 ==> Gm18
19 ==> Gm19
20 ==> Gm20

Update the maps in the database? (Y/N) Y
Updated 20 map names

Convert selected names only

What if we want to call the maps Gm1 and not Gm01? In this case, we use the regular expression to select only names that need to be modified:


PS> edit map_name "Glycine max/Zhonghuang 13"
Rename maps using names from [F]ile or [I]nteractively? I
Editing map names of Glycine max/Zhonghuang 13
List first 100 maps: A - all maps; C - chromosomes only; N - change Number of listed maps? C

List of maps:
Gm01
Gm02
Gm03
Gm04
Gm05
Gm06
Gm07
Gm08
Gm09
Gm10
Gm11
Gm12
Gm13
Gm14
Gm15
Gm16
Gm17
Gm18
Gm19
Gm20
Use regular expression to extract substrings from map names? (Y/N) Y

Regular expression to extract the new names? Gm0(.+)
Gm01  ==>       1
Gm02  ==>       2
Gm03  ==>       3
Gm04  ==>       4
Gm05  ==>       5
Gm06  ==>       6
Gm07  ==>       7
Gm08  ==>       8
Gm09  ==>       9
Gm10  ===>      Cannot extract map name using the provided regex
Gm11  ===>      Cannot extract map name using the provided regex
Gm12  ===>      Cannot extract map name using the provided regex
Gm13  ===>      Cannot extract map name using the provided regex
Gm14  ===>      Cannot extract map name using the provided regex
Gm15  ===>      Cannot extract map name using the provided regex
Gm16  ===>      Cannot extract map name using the provided regex
Gm17  ===>      Cannot extract map name using the provided regex
Gm18  ===>      Cannot extract map name using the provided regex
Gm19  ===>      Cannot extract map name using the provided regex
Gm20  ===>      Cannot extract map name using the provided regex
Not all map names match the regex
Do you want to apply the regex to the matching maps only? (Y/N) Y

Add prefix to map names? (Y/N) Y
Prefix: Gm
1 ==> Gm1
2 ==> Gm2
3 ==> Gm3
4 ==> Gm4
5 ==> Gm5
6 ==> Gm6
7 ==> Gm7
8 ==> Gm8
9 ==> Gm9

Update the maps in the database? (Y/N) Y
Updated 9 map names

If needed, you can change the number of maps that will be affected. By default, the program lists the first 100 maps. Note, if there are more maps than 100 (or whatever limit is set), the rest of the maps will not be affected. 

Reading conversion table from file

For renaming the maps in bulk, you can use a text file with two columns. Each line in such file should contain the old map name and the new one. For each map in the file, the program will find the old map by its current name specified in the left column and rename it to the new value in the column on the right.

Rename maps using names from [F]ile or [I]nteractively? F
File name (TAB- or comma-delimited, OldName ==> NewName)? /data/conversion.csv
5 name pairs have been read from file, for example:
AA003 => chr.1
AA021 => chr.2
AA933 => chr.3
AA012 => chr.4
AA311 => chr.5
Update maps in the database? (Y/N)

After renaming the maps, PersephoneShell will update the search index automatically.