diff options
author | BonfaceKilz | 2020-10-29 01:23:22 +0300 |
---|---|---|
committer | BonfaceKilz | 2020-10-29 01:23:22 +0300 |
commit | a56e5e9d5d0c3f157599677e937deb0bbb71debb (patch) | |
tree | d3fae7421ddb5d285a995fd2654df25b16edf087 | |
parent | 7410a1f4fa8628fa087a1fb682a9d6bb54160f68 (diff) | |
download | genenetwork2-a56e5e9d5d0c3f157599677e937deb0bbb71debb.tar.gz |
Replace map on strip with a list comprehension that calls strip()
* scripts/maintenance/readProbeSetSE_v7.py: In Python3 you can't map
string.strip on a list of strings. Instead use a list comprehension
and apply strip() on each element of the list.
* wqflask/wqflask/marker_regression/plink_mapping.py: Ditto.
* wqflask/wqflask/snp_browser/snp_browser.py: Ditto.
-rwxr-xr-x | scripts/maintenance/readProbeSetSE_v7.py | 6 | ||||
-rw-r--r-- | wqflask/wqflask/marker_regression/plink_mapping.py | 4 | ||||
-rw-r--r-- | wqflask/wqflask/snp_browser/snp_browser.py | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/scripts/maintenance/readProbeSetSE_v7.py b/scripts/maintenance/readProbeSetSE_v7.py index edd9e7b0..2cfe2e07 100755 --- a/scripts/maintenance/readProbeSetSE_v7.py +++ b/scripts/maintenance/readProbeSetSE_v7.py @@ -72,14 +72,14 @@ GeneList = [] isCont = 1 header = fp.readline() header = header.strip().split('\t') -header = list(map(string.strip, header)) +header = [item.strip() for item in header] nfield = len(header) line = fp.readline() kj = 0 while line: line2 = line.strip().split('\t') - line2 = list(map(string.strip, line2)) + line2 = [item.strip() for item in line2] if len(line2) != nfield: isCont = 0 print(("Error : " + line)) @@ -110,7 +110,7 @@ isCont = 1 fp.seek(0) header = fp.readline() header = header.strip().split('\t') -header = list(map(string.strip, header)) +header = [item.strip() for item in header] header = list(map(translateAlias, header)) header = header[dataStart:] Ids = [] diff --git a/wqflask/wqflask/marker_regression/plink_mapping.py b/wqflask/wqflask/marker_regression/plink_mapping.py index 6c38c34f..fd91b6ca 100644 --- a/wqflask/wqflask/marker_regression/plink_mapping.py +++ b/wqflask/wqflask/marker_regression/plink_mapping.py @@ -84,7 +84,7 @@ def get_samples_from_ped_file(dataset): while line: lineList = line.strip().split('\t') - lineList = list(map(string.strip, lineList)) + lineList = [item.strip() for item in lineList] sample_name = lineList[0] sample_list.append(sample_name) @@ -157,6 +157,6 @@ def parse_plink_output(output_filename, species): def build_line_list(line=None): line_list = line.strip().split(' ')# irregular number of whitespaces between columns line_list = [item for item in line_list if item !=''] - line_list = list(map(string.strip, line_list)) + line_list = [item.strip() for item in line_list] return line_list diff --git a/wqflask/wqflask/snp_browser/snp_browser.py b/wqflask/wqflask/snp_browser/snp_browser.py index 2df71b12..6c3fcf53 100644 --- a/wqflask/wqflask/snp_browser/snp_browser.py +++ b/wqflask/wqflask/snp_browser/snp_browser.py @@ -457,7 +457,7 @@ class SnpBrowser(object): function_list = [] if function_details: function_list = function_details.strip().split(",") - function_list = list(map(string.strip, function_list)) + function_list = [item.strip() for item in function_list] function_list[0] = function_list[0].title() function_details = ", ".join(item for item in function_list) function_details = function_details.replace("_", " ") @@ -723,11 +723,11 @@ def get_effect_details_by_category(effect_name = None, effect_value = None): codon_effect_group_list = ['Start Lost', 'Stop Gained', 'Stop Lost', 'Nonsynonymous', 'Synonymous'] effect_detail_list = effect_value.strip().split('|') - effect_detail_list = list(map(string.strip, effect_detail_list)) + effect_detail_list = [item.strip() for item in effect_detail_list] for index, item in enumerate(effect_detail_list): item_list = item.strip().split(',') - item_list = list(map(string.strip, item_list)) + item_list = [item.strip() for item in item_list] gene_id = item_list[0] gene_name = item_list[1] |