annotate create_config_file.py @ 1:078c6ab38858 draft default tip

planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 90fe127eb55d6ec4f99a37f7049527b6898e66a4
author artbio
date Tue, 13 Feb 2024 10:53:40 +0000
parents decc6b5631dc
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
1 import argparse
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
2
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
3
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
4 description = ("This script will create a configuration file for samples \
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
5 to be run in Pindel")
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
6
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
7
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
8 parser = argparse.ArgumentParser()
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
9 parser.add_argument("--input_file", nargs="*",
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
10 help="One or more alignment files")
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
11 parser.add_argument("--insert_size", nargs="+",
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
12 help="Expected Insert size")
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
13 parser.add_argument("--sample_label", nargs="+",
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
14 help="Sample label")
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
15 parser.add_argument("--output_config_file",
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
16 help="Output config file")
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
17 args = parser.parse_args()
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
18
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
19 template = "{input_file}\t{insert_size}\t{sample_label}\n"
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
20 with open(args.output_config_file, "w") as output:
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
21 for input_file, insert_size, sample_label in zip(args.input_file,
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
22 args.insert_size,
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
23 args.sample_label):
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
24 config_line = template.format(input_file=input_file,
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
25 insert_size=insert_size,
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
26 sample_label=sample_label)
decc6b5631dc "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
27 output.write(config_line)