comparison prepare_amplicon_info.py @ 10:ee29337f905c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 8ce6fd9aee543d9e62db33a9c95f79d8dc4e6dea
author iuc
date Wed, 13 Jul 2022 15:20:33 +0000
parents 75c279fa403a
children
comparison
equal deleted inserted replaced
9:8d36959b000d 10:ee29337f905c
9 9
10 # parse primers and their start positions from BED file 10 # parse primers and their start positions from BED file
11 primer_starts = {} 11 primer_starts = {}
12 with open(sys.argv[1]) as i: 12 with open(sys.argv[1]) as i:
13 for line in i: 13 for line in i:
14 f = line.strip().split('\t') 14 line = line.strip()
15 if not line:
16 continue
17 f = line.split('\t')
15 try: 18 try:
16 if f[5] == '+': 19 if f[5] == '+':
17 primer_starts[f[3]] = int(f[1]) 20 primer_starts[f[3]] = int(f[1])
18 elif f[5] == '-': 21 elif f[5] == '-':
19 primer_starts[f[3]] = int(f[2]) - 1 22 primer_starts[f[3]] = int(f[2]) - 1
30 33
31 # parse amplicon info and record outer primer names 34 # parse amplicon info and record outer primer names
32 with open(sys.argv[2]) as i: 35 with open(sys.argv[2]) as i:
33 ret_lines = [] 36 ret_lines = []
34 for line in i: 37 for line in i:
38 line = line.strip()
39 if not line:
40 continue
35 first = last = None 41 first = last = None
36 for pname in line.strip().split('\t'): 42 for pname in line.split('\t'):
37 try: 43 try:
38 primer_start = primer_starts[pname] 44 primer_start = primer_starts[pname]
39 except KeyError: 45 except KeyError:
40 sys.exit( 46 sys.exit(
41 'Amplicon info with primer name not found in ' 47 'Amplicon info with primer name not found in '