Mercurial > repos > rnateam > graphclust_preprocessing
annotate splitStockholm.py @ 13:2a5defc09381 draft default tip
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/GraphClust commit 4406735e44aba20859c252be39f4e99df28c7a92
author | rnateam |
---|---|
date | Sat, 27 Oct 2018 13:27:57 -0400 |
parents | c0c9d19bc7b2 |
children |
rev | line source |
---|---|
11
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
1 #!/usr/bin/env python |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
2 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
3 ######## |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
4 # This script reads multiple alignments merged in single stockholm file |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
5 # and splits the alignment blocks according to data.names table |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
6 # The first sequence of each alignment file assumed to match to names table entries |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
7 # Author: M. Miladi |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
8 ######## |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
9 import os |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
10 import re |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
11 import sys |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
12 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
13 from Bio import AlignIO, SeqIO |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
14 try: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
15 from StringIO import StringIO |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
16 except ImportError: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
17 from io import StringIO |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
18 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
19 stk_file = sys.argv[1] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
20 print ("Parsing and splitting stk file:{}".format(stk_file)) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
21 target_f = "alignment_data_split.stk" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
22 pattern = re.compile("^>.*$") |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
23 toWriteID = "" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
24 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
25 count_for_id = 1 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
26 seq_counter = 0 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
27 new_id = "" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
28 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
29 seq_id = [] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
30 seq_string = [] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
31 orig_id = [] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
32 name_file = "FASTA/data.names" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
33 array_all_chunks = [] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
34 with open(name_file, 'r') as f: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
35 for line in f: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
36 if len(line.strip()) == 0: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
37 continue |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
38 seq_id.append(int(line.split()[0])) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
39 seq_string.append(line.split()[1]) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
40 orig_id_srt = line.split()[3] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
41 orig_id_srt = orig_id_srt.rsplit('_',1)[0] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
42 orig_id.append(orig_id_srt) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
43 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
44 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
45 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
46 with open(stk_file) as stk_in: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
47 alignments = AlignIO.parse(stk_in, "stockholm")#, alphabet=IUPAC.ambiguous_rna) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
48 alignments_dic = {(a[0].id):a for a in alignments} |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
49 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
50 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
51 regx_gaps = '[-.~_]' # valid gap symbols all be converted to "-" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
52 str_gaps = '-.~_' # valid gap symbols all be converted to "-" |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
53 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
54 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
55 chunks = [] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
56 with open(target_f, 'w') as out_stk_handle: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
57 for i in range(len(orig_id)): |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
58 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
59 #---------------------- |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
60 # We need to map ungapped positions of the chunks to gapped positions of first sequence |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
61 gap_count = 0 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
62 ungap_ind = 0 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
63 dic_gap_counts = dict() |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
64 cur_alignment = alignments_dic[orig_id[i]] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
65 for c in cur_alignment[0].seq: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
66 #print ungap_ind |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
67 if c in str_gaps: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
68 gap_count += 1 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
69 else: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
70 dic_gap_counts[ungap_ind] = gap_count |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
71 ungap_ind += 1 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
72 ID = str(seq_id[i]) + " " + seq_string[i] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
73 chunks = re.findall(r'\d+', seq_string[i]) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
74 print (ID,chunks) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
75 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
76 index_start, index_end =int(chunks[1])-1, int(chunks[2])-1 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
77 subalign = cur_alignment[:, index_start + dic_gap_counts[index_start]: |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
78 index_end+dic_gap_counts[index_end]+1] |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
79 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
80 #---------------------- |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
81 # BioPython does not handel the GF ID entry for alignment |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
82 # So we add entry in the second line manually |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
83 siotmp = StringIO() |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
84 AlignIO.write(subalign, siotmp, format="stockholm") |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
85 stk_lines = siotmp.getvalue().split('\n') |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
86 out_stk_handle.write('{}\n'.format(stk_lines[0])) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
87 out_stk_handle.write('#=GF ID {}\n'.format(ID)) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
88 out_stk_handle.writelines('\n'.join(stk_lines[1:])) |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
89 #print out_stk_handle.getvalue() |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
90 |
c0c9d19bc7b2
planemo upload for repository https://github.com/eteriSokhoyan/galaxytools/tree/branchForIterations/tools/GraphClust commit 746497a64b955f6b9afc1944d1c1d8d877e53267
rnateam
parents:
diff
changeset
|
91 |