Mercurial > repos > portiahollyoak > breakdancer_max
annotate create_config_file.py @ 0:f65530d07350 draft
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
| author | portiahollyoak | 
|---|---|
| date | Tue, 17 May 2016 04:35:44 -0400 | 
| parents | |
| children | 
| rev | line source | 
|---|---|
| 
0
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
1 import argparse | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
2 | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
3 | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
4 description = ("This script will create a configuration file for samples to be run in Breakdancer." | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
5 "If pooled analysis desired, only one config file needed for all samples." | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
6 "Otherwise, individual analysis requires individual config files for each sample.") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
7 | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
8 parser = argparse.ArgumentParser() | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
9 parser.add_argument("--input_file", nargs="*", help="One or more alignment files") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
10 parser.add_argument("--mean", nargs="+", help="Mean insert size") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
11 parser.add_argument("--std_dev", nargs="+", help="The standard deviation of insert size") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
12 parser.add_argument("--read_length", nargs="+", help="Average read length") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
13 parser.add_argument("--sample_name", nargs="+", help="Sample name") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
14 parser.add_argument("--output_config_file", help="Name of the output config file") | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
15 args = parser.parse_args() | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
16 | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
17 template = "map:{input_file}\tmean:{mean}\tstd:{std_dev}\treadlen:{read_length}\tsample:{sample_name}\texe:samtools view\n" | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
18 with open(args.output_config_file, "w") as output: | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
19 for input_file, mean, std_dev, read_length, sample_name in zip(args.input_file, args.mean, args.std_dev, args.read_length, args.sample_name): | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
20 config_line = template.format(input_file=input_file, mean=mean, std_dev=std_dev, read_length=read_length, sample_name=sample_name) | 
| 
 
f65530d07350
planemo upload for repository https://github.com/portiahollyoak/Tools commit 1f1c277219ca756c9baa453592b455597fd593d8-dirty
 
portiahollyoak 
parents:  
diff
changeset
 | 
21 output.write(config_line) | 
