annotate create_config_file.py @ 0:6bf0dcb6bcdb draft default tip

"planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
author artbio
date Wed, 29 Sep 2021 21:29:39 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
1 import argparse
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
2
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
3
6bf0dcb6bcdb "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 \
6bf0dcb6bcdb "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")
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
6
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
7
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
8 parser = argparse.ArgumentParser()
6bf0dcb6bcdb "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="*",
6bf0dcb6bcdb "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")
6bf0dcb6bcdb "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="+",
6bf0dcb6bcdb "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")
6bf0dcb6bcdb "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="+",
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
14 help="Sample label")
6bf0dcb6bcdb "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",
6bf0dcb6bcdb "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")
6bf0dcb6bcdb "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()
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
18
6bf0dcb6bcdb "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"
6bf0dcb6bcdb "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:
6bf0dcb6bcdb "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,
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
22 args.insert_size,
6bf0dcb6bcdb "planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/pindel commit 9bae2cc35b71dabcb73cd586eb1bdc458132548c"
artbio
parents:
diff changeset
23 args.sample_label):
6bf0dcb6bcdb "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,
6bf0dcb6bcdb "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,
6bf0dcb6bcdb "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)
6bf0dcb6bcdb "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)