Mercurial > repos > gpovysil > range2tag
changeset 3:e66e151e07ab draft
planemo upload for repository https://github.com/gpovysil/galaxy/tools/range2tag commit 2daa6a8b7af02ed7a80381e21dd4dfb25619c39f
author | gpovysil |
---|---|
date | Wed, 16 May 2018 09:33:29 -0400 |
parents | 7d4ec8f51253 |
children | e2ccee720583 |
files | range2tag.py |
diffstat | 1 files changed, 24 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/range2tag.py Wed May 16 09:26:43 2018 -0400 +++ b/range2tag.py Wed May 16 09:33:29 2018 -0400 @@ -52,9 +52,6 @@ start_posList = range_array[:,0].astype(int) stop_posList = range_array[:,1].astype(int) - print(start_posList) - print(stop_posList) - if len(start_posList) == 0: print("Error: start_positions is empty") exit(2) @@ -84,31 +81,32 @@ stop_pos = stop_pos + 3 mut_tags = None for t in range(0, len(tags)): - c_split = re.split('([A-Z])', cigar[t]) - print(c_split) - cigar_long = None + if cigar[t] != "*": + c_split = re.split('([A-Z])', cigar[t]) + print(c_split) + cigar_long = None - for i in range(1, len(c_split), 2): - if cigar_long is None: - cigar_long = np.repeat(c_split[i], c_split[i - 1]) - else: - cigar_long = np.concatenate((cigar_long, np.repeat(c_split[i], c_split[i - 1])), axis=0) + for i in range(1, len(c_split), 2): + if cigar_long is None: + cigar_long = np.repeat(c_split[i], c_split[i - 1]) + else: + cigar_long = np.concatenate((cigar_long, np.repeat(c_split[i], c_split[i - 1])), axis=0) - pos = ref_pos[t] - seq_pos = 0 - # print(pos) - if pos < stop_pos: - for j in range(0, len(cigar_long)): - if pos >= stop_pos: - break - if cigar_long[j] in ("M", "D", "N"): - pos += 1 - # print(pos) - if pos > start_pos: - if mut_tags is None: - mut_tags = np.array((tags[t])) - else: - mut_tags = np.vstack((mut_tags, np.array(tags[t]))) + pos = ref_pos[t] + seq_pos = 0 + # print(pos) + if pos < stop_pos: + for j in range(0, len(cigar_long)): + if pos >= stop_pos: + break + if cigar_long[j] in ("M", "D", "N"): + pos += 1 + # print(pos) + if pos > start_pos: + if mut_tags is None: + mut_tags = np.array((tags[t])) + else: + mut_tags = np.vstack((mut_tags, np.array(tags[t]))) index = np.repeat("{}_{}".format(start_pos, stop_pos), len(mut_tags)) ind.append(index)