Mercurial > repos > rnateam > graphclust_preprocessing
comparison splitSHAPE.py @ 9:0690d59881b9 draft
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 65d322f9ab2f24d65b307f3553589149a1d678d5
| author | rnateam |
|---|---|
| date | Thu, 01 Jun 2017 08:09:49 -0400 |
| parents | a04e93fdb40a |
| children | c0c9d19bc7b2 |
comparison
equal
deleted
inserted
replaced
| 8:a04e93fdb40a | 9:0690d59881b9 |
|---|---|
| 34 with open(shape_file, 'r') as shape: | 34 with open(shape_file, 'r') as shape: |
| 35 content = shape.read() | 35 content = shape.read() |
| 36 lines = content.split('\n') | 36 lines = content.split('\n') |
| 37 for line in lines: | 37 for line in lines: |
| 38 if pattern.match(line): | 38 if pattern.match(line): |
| 39 line = line.replace('>','').strip() | 39 line = line.replace('>','').split()[0] |
| 40 react_arr=[] | 40 react_arr=[] |
| 41 react_dict[line] = react_arr | 41 react_dict[line] = react_arr |
| 42 continue | 42 continue |
| 43 else: | 43 else: |
| 44 react_arr.append(line) | 44 react_arr.append(line) |
| 45 | 45 |
| 46 toWrite = "" | 46 toWrite = "" |
| 47 chunks = [] | 47 chunks = [] |
| 48 for i in range(len(orig_id)): | 48 for i in range(len(orig_id)): |
| 49 if not orig_id[i] in react_dict: | 49 if not orig_id[i] in react_dict: |
| 50 raise RuntimeError('Error key {} not found'.format(orig_id)) | 50 raise RuntimeError('Error key {} {} not found'.format(i, orig_id[i])) |
| 51 | 51 |
| 52 react_val = react_dict[orig_id[i]] | 52 react_val = react_dict[orig_id[i]] |
| 53 toWrite += '>' + str(seq_id[i]) + " " + seq_string[i] + "\n" | 53 toWrite += '>' + str(seq_id[i]) + " " + seq_string[i] + "\n" |
| 54 chunks = re.findall(r'\d+', seq_string[i]) | 54 chunks = re.findall(r'\d+', seq_string[i]) |
| 55 | 55 |
