From 9a30520a7aa354824613b14c0e627e0231d6df38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ciara=CC=81n=20O=27Mara?= Date: Thu, 22 Oct 2020 13:51:26 +1100 Subject: [PATCH] Extract config directory setup --- damidseq_pipeline | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/damidseq_pipeline b/damidseq_pipeline index 1891e22..6071280 100755 --- a/damidseq_pipeline +++ b/damidseq_pipeline @@ -148,6 +148,7 @@ my $samtools_version; # Read parameters if exist process_cli(0); +setupconfigdir(); read_defaults(); parameter_check(); process_cli(1); @@ -502,22 +503,23 @@ sub check_dam_name { } } - -sub read_defaults { +sub setupconfigdir { # Create config directory if it doesn't exist unless (-d "$HOME/.config") { mkdir("$HOME/.config"); } - + unless (-d "$HOME/.config/damid_pipeline") { mkdir("$HOME/.config/damid_pipeline"); } - - # Migration for version 1.0 + + # Migration for version 1.0 if (-e "$HOME/.config/damid_pipeline_defaults") { move("$HOME/.config/damid_pipeline_defaults","$HOME/.config/damid_pipeline/defaults") } - +} + +sub read_defaults { if ($vars{'load_defaults'}) { if ($vars{'load_defaults'} eq 'list') { print_defaults_files();