Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/Runner.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1120,7 +1120,7 @@ sub _get_temp_prefix
my $dir = $self->_get_temp_dir($fname);
if ( ! -d $dir )
{
`mkdir -p $dir`;
`mkdir -p '$dir'`;
if ( $? ) { $self->throw("Cannot create directory [$dir]: $!"); }
}
return "$dir/$file";
Expand All @@ -1140,7 +1140,7 @@ sub _mkdir
{
my ($self,$fname) = @_;
$fname =~ s{[^/]+$}{};
if ( !-e $fname ) { `mkdir -p $fname`; }
if ( !-e $fname ) { `mkdir -p '$fname'`; }
return $fname;
}

Expand Down
6 changes: 3 additions & 3 deletions scripts/run-beagle
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ sub mrProper
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
rename("$outfile.part",$outfile) or $self->throw("rename $outfile.part $outfile: $!");
}
Expand Down Expand Up @@ -473,7 +473,7 @@ sub beagle

if ( !-e "$prefix.vcf.gz" or $$self{redo_beagle} )
{
$self->cmd(qq[mkdir -p $outdir]);
$self->cmd(qq[mkdir -p '$outdir']);
my $mem = int($self->get_limits('memory') * 0.8);
if ( $mem<=0 ) { $mem = 500; }
my $known = defined $known_vcf ? "ref=$known_vcf" : '';
Expand Down Expand Up @@ -576,7 +576,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/beagle.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down
8 changes: 4 additions & 4 deletions scripts/run-bt-mpileup
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ sub clean
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
open(my $fh,'>',"$outfile.part/info.txt") or $self->throw("$outfile.part/info.txt: $!");
print $fh $$self{_about};
Expand All @@ -294,7 +294,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/mpileup.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down Expand Up @@ -470,14 +470,14 @@ return;
{
if ( !exists($bam_pls{$pl}) ) { $self->throw("The platform \"$pl\" not present in any of the BAMs.\n"); }
}
`mkdir -p $$self{outdir}`;
`mkdir -p '$$self{outdir}'`;
$self->cmd("touch $$self{outdir}/sanity_checked");
}

sub open_file
{
my ($self,$file) = @_;
if ( ($file=~m{^(.+)/[^/]+$}) && ! -d $1 ) { $self->cmd("mkdir -p $1"); }
if ( ($file=~m{^(.+)/[^/]+$}) && ! -d $1 ) { $self->cmd("mkdir -p '$1'"); }
open(my $fh,'>',$file) or $self->throw("$file: $!");
return $fh;
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/run-commands
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ sub main
$self->parse_args();

my @files = $self->list_files($$self{glob});
`mkdir -p $$self{outdir}`;
`mkdir -p '$$self{outdir}'`;

for my $file (@files)
{
Expand Down Expand Up @@ -135,7 +135,7 @@ sub run_command
{
my ($self,$outfile,$file) = @_;
my $tmpdir = "$$self{outdir}/tmp.$file";
$self->cmd("mkdir -p $tmpdir");
$self->cmd("mkdir -p '$tmpdir'");
for my $cmd (@{$$self{cmds}})
{
my $task = $self->expand_task(cmd=>$cmd,name=>$file,tmpdir=>$tmpdir);
Expand Down
6 changes: 3 additions & 3 deletions scripts/run-gvcf-calling
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ sub main
my $outdir = $$self{outdir};
if ( $self->is_finished("$outdir/all_done") ) { $self->all_done; }

$self->cmd(qq[mkdir -p $outdir]);
$self->cmd(qq[mkdir -p '$outdir']);
$self->save_config();

my $chunks = $self->init_chunks();
Expand Down Expand Up @@ -223,7 +223,7 @@ sub clean
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
open(my $fh,'>',"$outfile.part/info.txt") or $self->throw("$outfile.part/info.txt: $!");
print $fh $$self{_about};
Expand All @@ -238,7 +238,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/mpileup.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down
8 changes: 4 additions & 4 deletions scripts/run-impute2
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ sub mrProper
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
rename("$outfile.part",$outfile) or $self->throw("rename $outfile.part $outfile: $!");
}
Expand Down Expand Up @@ -540,7 +540,7 @@ sub vcf_to_impute2

if ( $$self{phased_only} ) { $self->throw("todo: phased_only"); }

$self->cmd(qq[mkdir -p $outdir]);
$self->cmd(qq[mkdir -p '$outdir']);

if ( exists($$self{known_vcf}) && !$self->known_hapref_exists($chr,"$from-$to") )
{
Expand Down Expand Up @@ -614,7 +614,7 @@ sub impute2
$knowns .= " -h $known${i}.hap.gz -l $known${i}.legend.gz";
}
my $rg_prefix = "$$self{known_hapref}/$chr/$from-$to.ref";
$self->cmd(qq[mkdir -p $$self{known_hapref}/$chr/]);
$self->cmd(qq[mkdir -p '$$self{known_hapref}/$chr/']);
$self->cmd(qq[$CMD $knowns -merge_ref_panels -o $rg_prefix -merge_ref_panels_output_ref $rg_prefix]);

unlink("$rg_prefix.hap.samples.part");
Expand Down Expand Up @@ -746,7 +746,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/impute2.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down
16 changes: 8 additions & 8 deletions scripts/run-runners
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ sub parse_params
$$opts{dropbox_conf} = "$$opts{dropbox}.conf";

if ( !-d $$opts{dropbox_conf} ) { error("Incorrect dropbox prefix, the directory not found: $$opts{dropbox_conf}\n\n"); }
if ( !-e $$opts{dropbox_in} ) { `mkdir -p $$opts{dropbox_in}`; }
if ( !-e $$opts{dropbox_out} ) { `mkdir -p $$opts{dropbox_out}`; }
if ( !-e $$opts{dropbox_tmp} ) { `mkdir -p $$opts{dropbox_tmp}`; }
if ( !-e $$opts{dropbox_in} ) { `mkdir -p '$$opts{dropbox_in}'`; }
if ( !-e $$opts{dropbox_out} ) { `mkdir -p '$$opts{dropbox_out}'`; }
if ( !-e $$opts{dropbox_tmp} ) { `mkdir -p '$$opts{dropbox_tmp}'`; }
if ( !exists($$opts{err_period}) ) { $$opts{err_period} = 60; }

return $opts;
Expand Down Expand Up @@ -272,7 +272,7 @@ sub list_projects
$project = parse_project($opts,$$opts{dropbox_in},$name,$run_id);
if ( !defined $project ) { next; }

system("mkdir -p $$opts{dropbox_tmp}/$$project{run_id}");
system("mkdir -p '$$opts{dropbox_tmp}/$$project{run_id}'");
system("mv $$opts{dropbox_in}/$name $$opts{dropbox_tmp}/$$project{run_id}/$name");
if ( $? ) { confess "mv $$opts{dropbox_in}/$name $$opts{dropbox_tmp}/$$project{run_id}/$name"; }

Expand All @@ -296,7 +296,7 @@ sub clean_project
if ( ref($$project{outputs}{$outdir}) eq 'ARRAY' )
{
# create a subdirectory '$outdir' and copy all listed files in there
cmd($opts,"mkdir -p $$opts{dropbox_out}/$$project{run_id}/$outdir");
cmd($opts,"mkdir -p '$$opts{dropbox_out}/$$project{run_id}/$outdir'");
for my $file (@{$$project{outputs}{$outdir}})
{
my $path = expand_vars($opts,$project,$file);
Expand All @@ -312,13 +312,13 @@ sub clean_project
$dst = $$project{outputs}{$outdir};
if ( $dst =~ m{([^/]+)$} ) { $dir = "$dir/$`"; $dst = "$dir/$1"; }
}
cmd($opts,"mkdir -p $dir");
cmd($opts,"mkdir -p '$dir'");
my $path = expand_vars($opts,$project,$outdir);
cmd($opts,"mv $path $dst");
}
}

cmd($opts,"mkdir -p $$opts{dropbox_out}/$$project{run_id}/tmp-data");
cmd($opts,"mkdir -p '$$opts{dropbox_out}/$$project{run_id}/tmp-data'");
cmd($opts,"mv $$opts{dropbox_tmp}/$$project{run_id} $$opts{dropbox_out}/$$project{run_id}/tmp-data");
}

Expand Down Expand Up @@ -535,7 +535,7 @@ sub run_project
debug_msg($opts, "step done: $prefix.$step\n");
next;
}
if ( ! -e $prefix ) { system("mkdir -p $prefix.$step"); }
if ( ! -e $prefix ) { system("mkdir -p '$prefix.$step'"); }
$$project{step} = $step;

if ( exists($$project{$step}{config}) && !-e "$prefix.$step.conf" )
Expand Down
8 changes: 4 additions & 4 deletions scripts/run-shapeit
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ sub mrProper
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
rename("$outfile.part",$outfile) or $self->throw("rename $outfile.part $outfile: $!");
}
Expand Down Expand Up @@ -468,7 +468,7 @@ sub ref_to_shapeit
my $outdir = $outfile;
$outdir =~ s{/[^/]*$}{};
my $ref_vcf = $self->expand_chrom($$self{ref_vcf},$chr);
$self->cmd(qq[mkdir -p $outdir]);
$self->cmd(qq[mkdir -p '$outdir']);
$self->cmd(qq[$$self{bcftools} convert -r $chr:$from-$to $ref_vcf --haplegendsample $outfile.part]);
rename("$outfile.part.samples","${prefix}_samples") or $self->throw("rename $outfile.part.samples ${prefix}_samples: $!");
rename("$outfile.part.legend.gz","${prefix}_legend.gz") or $self->throw("rename $outfile.part.legend.gz ${prefix}_legend.gz: $!");
Expand Down Expand Up @@ -543,7 +543,7 @@ sub vcf_to_shapeit
my $to = $$chunk[2];
my $outdir = "$$self{outdir}/$chr";
my $in_vcf = $self->expand_chrom($$self{in_vcf},$chr);
$self->cmd(qq[mkdir -p $outdir]);
$self->cmd(qq[mkdir -p '$outdir']);
$self->cmd(qq[$$self{bcftools} view -r $chr:$from-$to -g ^miss -Ou $in_vcf | $$self{bcftools} convert --gensample $outdir/01.vcf_to_shapeit.$from-$to]);
if ( exists($$self{fams}) ) { $self->set_families("$outdir/01.vcf_to_shapeit.$from-$to.samples"); }
$self->cmd(qq[touch $outfile]);
Expand Down Expand Up @@ -640,7 +640,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/shapeit.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down
12 changes: 6 additions & 6 deletions scripts/run-st-mpileup
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ sub clean
sub runtime_stats
{
my ($self,$outfile) = @_;
$self->cmd("mkdir -p $outfile.part");
$self->cmd("mkdir -p '$outfile.part'");
$self->cmd("runtime-stats $$self{outdir} -p $outfile.part/graph > $outfile.part/stats.txt");
open(my $fh,'>',"$outfile.part/info.txt") or $self->throw("$outfile.part/info.txt: $!");
print $fh $$self{_about};
Expand All @@ -395,7 +395,7 @@ sub save_config
my $src = $$self{_config};
my $dst = "$$self{outdir}/mpileup.conf";
if ( -e $dst && (stat($src))[9] <= (stat($dst))[9] ) { return; }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p $$self{outdir}"); }
if ( !-d $$self{outdir} ) { $self->cmd("mkdir -p '$$self{outdir}'"); }
open(my $fh,'>',$dst) or $self->throw("$dst: $!");
my $about = $$self{_about};
$about =~ s/\n/\n# /g;
Expand Down Expand Up @@ -430,14 +430,14 @@ sub check_sanity
{
if ( !exists($bam_pls{$pl}) ) { $self->throw("The platform \"$pl\" not present in any of the BAMs.\n"); }
}
`mkdir -p $$self{outdir}`;
`mkdir -p '$$self{outdir}'`;
$self->cmd("touch $$self{outdir}/sanity_checked");
}

sub open_file
{
my ($self,$file) = @_;
if ( ($file=~m{^(.+)/[^/]+$}) && ! -d $1 ) { $self->cmd("mkdir -p $1"); }
if ( ($file=~m{^(.+)/[^/]+$}) && ! -d $1 ) { $self->cmd("mkdir -p '$1'"); }
open(my $fh,'>',$file) or $self->throw("$file: $!");
return $fh;
}
Expand Down Expand Up @@ -819,7 +819,7 @@ sub all_site_bcfs
my $outdir = $$self{outdir};
my $bam_list = "$outdir/lists/chr$chr-$pop.list";

`mkdir -p $outdir/$pop/$chr/` unless -d "$outdir/$pop/$chr";
`mkdir -p '$outdir/$pop/$chr/'` unless -d "$outdir/$pop/$chr";
my $cmd = "$$self{mpileup} -g -r $chr:$from-$to -b $bam_list -f $$self{fa_ref} > $outfile.part";
$self->cmd($cmd);

Expand All @@ -837,7 +837,7 @@ sub call_variants

$self->set_chunk_options($chr,$from,$to);

`mkdir -p $outdir/$pop/$chr/` unless -d "$outdir/$pop/$chr";
`mkdir -p '$outdir/$pop/$chr/'` unless -d "$outdir/$pop/$chr";

# Create sample list with correct ploidy info
my $sample_list = "$outdir/$pop/$chr/$chr:$from-$to.samples";
Expand Down