annotate hla_dq.py @ 0:10a407fb5072 draft

planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
author erasmus-medical-center
date Wed, 30 May 2018 07:50:21 -0400
parents
children 4fc47a3ff9e8
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
1 #!/usr/bin/env python
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
2 '''
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
3 Given HLA-A and HLA-B genes annotated with BLAST IMGT/HLA database
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
4 genotypes, determine associated serotypes
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
5
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
6
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
7 DQA1 | DQB1 | type
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
8 --------------------
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
9 02:01| 02:02| DQ2.2
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
10 03:03| 02:02| DQ2.3
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
11 05:01| 02:01| DQ2.3
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
12 03:01| 03:02| DQ8
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
13 03:02| 03:02| DQ8
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
14 03:03| 03:02| DQ8
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
15
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
16 Annotations are of form DQ[A|B]1*xx:yy[:zz[:vv]] where xx:yy is of interest.
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
17
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
18 Example: "HLA:HLA11066 DQA1*01:05:02 768 bp"
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
19 '''
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
20
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
21 import argparse
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
22 import itertools
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
23
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
24
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
25 def to_matrix(l, n):
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
26 return [l[i:i+n] for i in range(0, len(l), n)]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
27
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
28
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
29 def get_list_of_associated_types(filename, column):
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
30 with open(filename) as f:
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
31 contents = f.readlines()
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
32
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
33 return [':'.join(line.split('\t')[column-1].split(' ')[1]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
34 .split('*')[1].split(':')[0:2])
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
35 for line in contents[1:]]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
36
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
37
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
38 def get_associations(typesA, typesB):
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
39 ''' Given list of genotype annotations (e.g. DQA1*02:01..)
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
40 from A and B, determine possible associated serotypes
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
41 '''
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
42
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
43 ''' each combination of DQA1,DQB1,type '''
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
44 associated_combinations = [
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
45 ['02:01', '02:02', 'DQ2.2'],
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
46 ['03:03', '02:02', 'DQ2.3'],
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
47 ['05:01', '02:01', 'DQ2.5'],
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
48 ['03:01', '03:02', 'DQ8'],
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
49 ['03:02', '03:02', 'DQ8'],
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
50 ['03:03', '03:02', 'DQ8']]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
51
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
52 return [a[2] for a in associated_combinations
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
53 if a[0] in typesA and a[1] in typesB]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
54
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
55
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
56 if __name__ == "__main__":
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
57 parser = argparse.ArgumentParser()
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
58 parser.add_argument('-A', required=True, action='append',
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
59 help='BLAST hits A gene')
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
60 parser.add_argument('-B', required=True, action='append',
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
61 help='BLAST hits B gene')
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
62 parser.add_argument('-c', '--column', default=5, type=int,
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
63 help='Column number containing the BLAST annotation')
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
64 args = parser.parse_args()
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
65
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
66 # TODO: QC check that file A contains DQA1 annotations and
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
67 # B file contains DQB1 annotations?
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
68
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
69 # find possible associated types, for all combinations of alleles
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
70 typesA = [get_list_of_associated_types(A, args.column) for A in args.A]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
71 typesB = [get_list_of_associated_types(B, args.column) for B in args.B]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
72 associations = [get_associations(c[0], c[1])
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
73 for c in itertools.product(typesA, typesB)]
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
74 associations = to_matrix(associations, len(args.B))
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
75
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
76 # write output table
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
77 header = '\t'+'\t'.join(['B'+str(i+1) for i in range(0, len(args.B))])+'\n'
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
78 bcount = 0
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
79 with open('results.tsv', 'w') as outfile:
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
80 outfile.write(header)
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
81 for line in associations:
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
82 bcount += 1
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
83 outfile.write(
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
84 'A' + str(bcount) + '\t' +
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
85 '\t'.join([';'.join(sorted(set(l)))
10a407fb5072 planemo upload for repository https://github.com/ErasmusMC-Bioinformatics/galaxytools-emc/tree/master/tools/hla_dq commit d6273a8247a1cbb7df2b26b9e97cd1bd3faa4f61
erasmus-medical-center
parents:
diff changeset
86 if l else '-' for l in line])+'\n')