Skip to content

Commit 79f9786

Browse files
authored
Add files via upload
1 parent 305f95d commit 79f9786

File tree

1 file changed

+32
-33
lines changed

1 file changed

+32
-33
lines changed

vcf2tree.pl

+32-33
Original file line numberDiff line numberDiff line change
@@ -13,42 +13,41 @@
1313
my $run;
1414
GetOptions(
1515
"h|?"=>\&help,
16-
"v:s"=>\$invcf,
17-
"p:s"=>\$inphy,
18-
"o:s"=>\$outdir,
19-
"k:s"=>\$key,
20-
"s:s"=>\$shdir,
21-
"b:s"=>\$bootnum,
22-
"f:s"=>\$fraction,
23-
"m:s"=>\$model,
24-
"c:s"=>\$config_file,
25-
"p:s"=>\$pattern,
26-
"r:s"=>\$run,
16+
"vcf:s"=>\$invcf,
17+
"phy:s"=>\$inphy,
18+
"outdir:s"=>\$outdir,
19+
"key:s"=>\$key,
20+
"shdir:s"=>\$shdir,
21+
"bootnum:s"=>\$bootnum,
22+
"bootfrac:s"=>\$fraction,
23+
"model:s"=>\$model,
24+
"config:s"=>\$config_file,
25+
"pattern:s"=>\$pattern,
26+
"run:s"=>\$run,
2727
) || &help;
2828
&help unless (($invcf || $inphy) && $outdir && $key);
29-
3029
sub help
3130
{
3231
print"
3332
Description: vcf to NJ-tree by pre-computed distance matrix and parallelizing bootstraps
3433
35-
-v <file> input vcf file [force if no -p]
36-
-p <file> input phylip file [force if no -v]
37-
-o <dir> output directory [force]
38-
-k <str> output prefix [force]
39-
-s <dir> shell directory [-o]
40-
-b <int> bootstrap times [100]
41-
-f <float> fraction of bootstrap sampling [0.25]
42-
-m <str> substitution model [pdist]
43-
pdist: p-distance
44-
jc : Juke-Cantor
45-
k2p : Kimura 2 Parameters
46-
f81 : Felsenstein 81
47-
f84 : Felsenstein 84
48-
tn93 : Tamura and Nei 1993
49-
-c <file> config file [optional]
50-
-p <str> config split pattern [:=]
51-
-r <T/F> run or not [T]
34+
-vcf <file> input vcf file [force if no -phy]
35+
-phy <file> input phylip file [force if no -vcf]
36+
-outdir <dir> output directory [force]
37+
-key <str> output prefix [force]
38+
-shdir <dir> shell directory [-o]
39+
-bootnum <int> bootstrap times [100]
40+
-bootfrac <float> fraction of bootstrap sampling [0.25]
41+
-model <str> substitution model [pdist]
42+
pdist: p-distance
43+
jc : Juke-Cantor
44+
k2p : Kimura 2 Parameters
45+
f81 : Felsenstein 81
46+
f84 : Felsenstein 84
47+
tn93 : Tamura and Nei 1993
48+
-config <file> config file [optional]
49+
-pattern <str> config split pattern [:=]
50+
-run <T/F> run or not [T]
5251
-h Help document
5352
";
5453
exit;
@@ -85,7 +84,7 @@ sub help
8584
$pattern ||= ":=";
8685
##### read config
8786
my %config;
88-
&read_config($config_file);
87+
&read_config($config_file) if defined $config_file;
8988

9089
$config{snp_tree_bootnum} //= 100;
9190
$config{snp_tree_model} ||= "pdist";
@@ -99,7 +98,7 @@ sub help
9998
$config{fastme} ||= "/Bio/User/kxie/software/mambaforge/envs/fastme/bin/fastme";
10099
$config{maxjob} ||= 20;
101100
$config{queue} ||= "all.q,fast.q,centos7";
102-
$config{submit} ||= "node";
101+
$config{submit} ||= "qsub";
103102

104103

105104
&main();
@@ -118,10 +117,10 @@ ()
118117
my ($cmd, $phyfile);
119118
if(defined $invcf && !defined $inphy){
120119
($cmd, $phyfile) = &filter($invcf);
120+
print PIPE "$cmd\n";
121121
}else{
122122
$phyfile = $inphy;
123123
}
124-
print PIPE "$cmd\n";
125124

126125
# distance
127126
my ($cmd1, $cmd2) = &distance($phyfile);
@@ -176,7 +175,7 @@ ()
176175
print SH1 "$cmd\n";
177176
$cmd = "$config{fastme} -i $outdir/$key.orig.dist -o $outdir/$key\.orig.tree";
178177
print SH2 "$cmd\n";
179-
for (my $i = 1; $i <= $config{snp_tree_bootnum}; $i++) {
178+
for (my $i = 0; $i <= $config{snp_tree_bootnum}; $i++) {
180179
$i = sprintf("%04d", $i);
181180
$cmd = "$config{goalign} build distboot -i $phy -p -t 4 -m $config{snp_tree_model} ";
182181
$cmd .= "-f $config{snp_tree_bootfrac} -o $tmpdir/$key.boot$i.dist";

0 commit comments

Comments
 (0)