-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathrp_config
More file actions
executable file
·2167 lines (1757 loc) · 67.5 KB
/
rp_config
File metadata and controls
executable file
·2167 lines (1757 loc) · 67.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env perl
use strict;
use File::Basename;
use Cwd;
use Data::Dumper;
### Script to configure settings for ricopili pipeline
### Jackie Goldstein, Jan 2014 & stephan ripke 2016
my $version = "2.0.0";
my $progname = $0;
$progname =~ s!^.*/!!;
my $rp_custom_installation_file = "rp_config.custom.txt";
my $custom_txt = "
-----------------------------------------------
------------ CUSTOM INSTALLATION --------------
-----------------------------------------------
- please download and extract the following tarball to a different, empty directory (please remember the full path of this directory since you will need it during this process), with this tarball you will get most necessary binaries and resource files
- follow the instructions in its README (README.binaries).
e.g.:
mkdir rp_dependenscies
cd rp_dependenscies
wget https://personal.broadinstitute.org/sripke/share_links/doMoVLWDcLcasit7xlcmwtt7cxDMjq_Ricopili_Dependencies.0918/Ricopili_Dependencies.0918.tar.gz .
after that start rp_config choosing cluster environment -custom- (choice 10).
if customfile ($rp_custom_installation_file) is not present this rp_config will write out a template to be filled out by you
";
##### help message
my $usage = "
Usage : $progname [options] --help
--help print this text and exits
--customfile STRING different customfile than default $rp_custom_installation_file
--rphome STRING different homedirectory for ricopili.conf (by default it is environement HOME)
--depdir STRING replace expression DEPDIR with STRING in the customfile (e.g. dependency_directory tends to get used multiple times)
this script is trying to make the configuration of the ricopili pipeline as convenient as possible.
you will be able to choose from a variety of preset computer clusters.
since october 2018 this configuration is customizable:
- this is the preferred method since it only needs the right configuration file and not any changes of the sourcecode
please follow this document: https://docs.google.com/document/d/14aa-oeT5hF541I8hHsDAL_42oyvlHRC5FWR7gir4xco/edit?usp=sharing
";
my $old_txt = "
###############################
### I think this if found in the README anyway and can go from these instructions
#######################################
most recent addition:
-----------------------------------------------------------
in location of bcrloc needs to be this file
ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz
found on broad here:
/psych/genetics_data/ripke/rp_bins/bcftools/bcftools-1.3.1/resources/human_g1k_v37.fasta
--------------------------------------------------------------
in location of bcloc needs to be this binray:
bcftools
found on broad here:
/psych/genetics_data/ripke/rp_bins/bcftools/new_0816/bcftools-1.3.1_bin/bin/bcftools
----------------------------------------------------------------------
### Jackie Goldstein, Jan 2014 & stephan ripke 2016
########################################################
";
my $custom_file_template = '
### for details please refer to https://docs.google.com/document/d/14aa-oeT5hF541I8hHsDAL_42oyvlHRC5FWR7gir4xco/edit?usp=sharing
### and https://docs.google.com/spreadsheets/d/1LhNYIXhFi7yXBC17UkjI1KMzHhKYz0j2hwnJECBGZk4/edit?usp=sharing
variable_name variable_value
----------------------------------------------
rp_dependencies_dir
R_packages_dir
starting_R
path_to_Perlmodules
path_to_scratchdir
starting_ldsc
ldsc_reference
rp_user_initials
rp_user_email
rp_logfiles
----------------------------------------
----------------------------------------
---- jobarray and queueing parameters:
----------------------------------------
----------------------------------------
serial 0
batch_jobcommand
batch_memory_request
batch_walltime
batch_array
batch_max_parallel_jobs_per_one_array
batch_jobfile
batch_name
batch_stdout
batch_stderr
batch_job_dependency
batch_array_task_id
batch_other_job_flags NONE
batch_job_output_jid
batch_ncores_per_node NA
batch_mem_per_node NA
';
my $rphome = $ENV{HOME};
use Getopt::Long;
GetOptions(
"help"=> \my $help,
"customfile=s"=> \$rp_custom_installation_file,
"rphome=s"=> \$rphome,
"depdir=s"=> \my $depdir,
);
if ($help) {
print $usage ;
exit;
}
###################################################
### waiting for user to continue
###################################################
sub cont(){
print "continue (y/n)?\n";
my $answer = lc <>;
chomp $answer;
unless ($answer eq "y") {
print "exiting.....\n";
exit;
}
}
my $welcome_message = '
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
------------------------- RP_CONFIG ------------------------------------
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
Script to ease Downloading, Configuration, Installation of Ricopili
-----------------------------------------------------------------------------
please use flag --help if you are not familiar with its usage
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
';
print "$welcome_message\n";
#&cont();
my %bin_names;
my %bin_locs;
#####################
# plink: just download
#####################
$bin_names{"plink"} = "plink";
$bin_locs{"plink"} = "https://www.cog-genomics.org/static/bin/plink170330/plink_linux_x86_64.zip";
########################
# shapeit: download and detar and copy binary from bin subdir to root
###########################
$bin_names{"shapeit"} = "shapeit.v2.r837.linux.x86_64";
$bin_locs{"shapeit"} = "https://mathgen.stats.ox.ac.uk/genetics_software/shapeit/shapeit.v2.r837.GLIBCv2.12.Linux.static.tgz";
########################
# impute: download, detar and point to subdir
###########################
$bin_names{"impute"} = "impute_v2.3.2_x86_64_static/impute2";
$bin_locs{"impute2"} = "https://mathgen.stats.ox.ac.uk/impute/impute_v2.3.2_x86_64_static.tgz";
################################
# eigenstrat
################################
$bin_names{"eigenstrat"} = "bin/smartpca";
$bin_locs{"eigenstrat"} = "https://data.broadinstitute.org/alkesgroup/EIGENSOFT/EIG-6.1.4.tar.gz";
############
## LDSCORE????
######################
############
## liftOver
######################
$bin_names{"liftover"} = "liftOver";
$bin_locs{"liftover"} = "http://hgdownload.soe.ucsc.edu/admin/exe/linux.x86_64/liftOver";
#############################################################
### for better installation
#########################################################
# http://hgdownload.soe.ucsc.edu/goldenPath/hg17/liftOver/hg17ToHg19.over.chain.gz
# http://hgdownload.soe.ucsc.edu/goldenPath/hg18/liftOver/hg18ToHg19.over.chain.gz
# http://hgdownload.soe.ucsc.edu/goldenPath/hg16/liftOver/hg16ToHg19.over.chain.gz
# http://hgdownload.soe.ucsc.edu/goldenPath/hg38/liftOver/hg38ToHg19.over.chain.gz
# http://hgdownload.soe.ucsc.edu/goldenPath/hg19/liftOver/hg19ToHg18.over.chain.gz
# grep in rp_bin for other liloc files:
# grep liloc *
#print "fasta file to bcftools directory:\n";
#print "/psych/genetics_data/ripke/rp_bins/bcftools/bcftools-1.3.1/resources/human_g1k_v37.fasta:\n";
#print "## ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/technical/reference/human_g1k_v37.fasta.gz\n";
#exit;
my $cdir = cwd();
my $home = $ENV{HOME};
my $conf_file = $rphome."/ricopili.conf";
my $command_line = "$progname @ARGV";
#############################
# Ask user what cluster they're using
#############################
#my %clusters = ("broad",0,"mssm",0,"genomedk",0,"lisa",0,"other",0);
#my %clusters = ("broad",0,"mssm",0,"genomedk",0,"lisa",0,"computerome",0,"other",0);
#my %clusters = ("broad",0,"mssm",0,"genomedk",0,"lisa",0,"computerome",0,"co_ipsych",0,"uppmax",0,"other",0);
my %clusters = ("broad_do_not_use",0,"mssm_do_not_use",0,"genomedk_do_not_use",0,"lisa_do_not_use",0,"computerome_do_not_use",0,"co_ipsych_do_not_use",0,"uppmax_do_not_use",0,"unc_slurm_do_not_use",0,"bih_qsub_do_not_use",0,"custom",0);
my @cluster_names = ("broad_do_not_use","mssm_do_not_use","genomedk_do_not_use","lisa_do_not_use","computerome_do_not_use","co_ipsych_do_not_use","uppmax_do_not_use","unc_slurm_do_not_use","bih_qsub_do_not_use","custom");
my $cluster = "custom";
$clusters{custom} = 1;
if (0) {
print "Please enter your cluster environment from the following options:\n";
print "!!!! since the 1018 versions only custom (10) !!!!!\n";
my $i = 1;
foreach (@cluster_names){
unless ($_ =~ /do_not_use/) {
print "\t($i) $_\n";
}
$i += 1;
}
print "\n";
while (1) {
$cluster = lc <>;
chomp $cluster;
if (exists $clusters{$cluster}){$clusters{$cluster} = 1;last;}
else {
$cluster =~ s/(\)|\()//g;
if ($cluster >= 1 && $cluster <= $i){$cluster -= 1; $cluster = $cluster_names[$cluster];$clusters{$cluster} = 1;last;}
else {
print "Did not recognize option. Please enter a cluster name from the options below:\n";
my $i = 1;
foreach (@cluster_names){
print "\t($i) $_\n";
$i += 1;
}
print "\n";
my $cluster = "other";
}
}
}
}
print "\nUsing the following cluster: $cluster\nin combination with $rp_custom_installation_file\n\n";
sleep (2);
#exit;
#################################################################################
###### CUSTOM configuration file
################################################################################
my %conf;
$conf{"batch_ncores_per_node"} = "NA";
$conf{"batch_mem_per_node"} = "NA";
if ($clusters{custom}){
if (-e $rp_custom_installation_file) {
die $!."($rp_custom_installation_file)" unless open FILE, "< $rp_custom_installation_file";
while (my $line = <FILE>){
unless ($line =~ /^\-\-\-/ || $line =~ /^\*\*/) {
$line =~ s/###.*//;
my @cells = split /\s+/, $line;
if ($depdir) {
$cells[1]=~ s/DEPDIR/$depdir/g;
}
unless ($cells[0] eq "" || $cells[0] eq "variable") {
$conf{$cells[0]} = $cells[1];
# my $line =~ s/^$cells[0]//;
print "<".$cells[0].">"." <".$cells[1].">\n";
}
}
}
close FILE;
}
else {
print "-----------------------------------------------------------------\n";
print "-----------------------------------------------------------------\n";
print "Custom - File ($rp_custom_installation_file) not found\n";
die $!."($rp_custom_installation_file)" unless open FILE, "> $rp_custom_installation_file";
# print FILE "exbin_dir PLACEHOLDER ## directory in which all downloaded external binaries will be installed to\n";
print FILE $custom_file_template;
close FILE;
print "-> an empty one was now created, please fill and restart rp_config afterwards\n\nExit now\n\n";
exit;
}
# print "$custom_txt\n";
}
my $path_to_perlmodules = $conf{"path_to_Perlmodules"};
if ($path_to_perlmodules eq "") {
if ($clusters{custom}){
print "Error: <path_to_Perlmodule> is not set in $rp_custom_installation_file\n";
exit;
}
}
# If on an Uppmax cluster, determine which one, and which account to use.
# Uses code from the projinfo utility on Uppmax
my $uppmax_project;
my $uppmax_cluster;
my $username;
if ($clusters{uppmax}) {
# get username
$username = getlogin || getpwuid($<);
# get cluster name
open CONFIG, "scontrol show conf 2>&1 |"
or die "Error: Cannot find SLURM configuration.\n";
while (<CONFIG>) {
chomp;
my $line = lc $_;
if ($line =~ /^clustername\s+=\s+(\S+)\s*$/) {
$uppmax_cluster = $1;
last
}
}
close CONFIG;
# get user's current projects
my $grantfile = "/sw/share/slurm/$uppmax_cluster/grantfile";
my @uppmax_projects;
open GRANTFILE, "< $grantfile"
or die "Error: Cannot read file $grantfile.\n";
while (<GRANTFILE>) {
chomp;
my $line = $_;
next if /^\s*$/; # Empty line
next if /^\s*#/; # Comment
if (/^([^,]+),[^,]+,([^,]+),[^#]+#(.*)$/) {
my $projectname = $1;
my $grant = $2;
my $members = $3;
if ($members =~
/^$username$|^$username\s|\s$username\s|\s$username$/)
{
push @uppmax_projects, $projectname;
}
}
elsif (/^([^:]+):(\d+):.*:([^:]*)$/) {
my $projectname = $1;
my $grant = $2;
my $members = $3;
if ($members =~ /^$username$|^$username,|,$username,|,$username$/) {
push @uppmax_projects, $projectname;
}
}
else { # Error in file
die "Error: Bad line in file $grantfile:\n\t$line\n";
}
}
close GRANTFILE;
# choose project (account) to use with ricopili
print "Please choose the Uppmax project you want to use with ricopili:\n";
my $i = 1;
foreach (@uppmax_projects){
print "\t($i) $_\n";
$i += 1;
}
print "\n";
while (1) {
my $project = lc <>;
chomp $project;
if ( grep(/^$project$/, @uppmax_projects) ){ $uppmax_project = $project; last;}
else {
$project =~ s/(\)|\()//g;
if ($project >= 1 && $project <= $i){
$project -= 1;
$uppmax_project = $uppmax_projects[$project];
last;
}
else {
print "Did not recognize option. Please enter a project identifier from the options below:\n";
my $i = 1;
foreach (@uppmax_projects){
print "\t($i) $_\n";
$i += 1;
}
print "\n";
}
}
}
print "\nUsing the following Uppmax project: $uppmax_project\n\n";
}
#############################
# Determine the shell
#############################
my $shell = '';
if (exists $ENV{SHELL}){$shell = basename($ENV{SHELL});}
if ($shell eq "bash-login-check"){$shell = "bash";}
if ($shell ne "bash" && $shell ne "tcsh") {
print "Warning! Shell not recognized: $shell\n";
print "Please send email to rp_dev\@broadinstitute.org\n";
}
print "Detected you are using the following shell: $shell\n\n";
#############################
# Determine the shell-bashrc
#############################
## just for info
my $bashrc = "";
if (-e "$home/.my.bashrc") {
$bashrc = "$home/.my.bashrc";
print " - bash detected - \n\n";
}
elsif (-e "$home/.bashrc") {
$bashrc = "$home/.bashrc";
print " - bash detected - \n\n";
}
elsif (-e "$home/.my.cshrc") {
$bashrc = "$home/.my.cshrc";
print " - csh detected - \n\n";
}
elsif (-e "$home/.cshrc") {
$bashrc = "$home/.my.cshrc";
print " - csh detected - \n\n";
}
else {
print "Could not find any shell-starting files ($home/.bashrc or $home/.cshrc)\n";
print "please consult your admins how to achieve the above tasks\n";
}
###################################################
### system call with test if successful
###################################################
sub mysystem(){
my ($systemstr)="@_";
system($systemstr);
my $status = ($? >> 8);
die "$systemstr\n->system call failed: $status" if ($status != 0);
}
###################################################
### Check if rp_bin already installed
###################################################
system("bin_check"); # dummy script that doesn't do anything
my $status_bin = ($? >> 8);
system("bin_check_pdfjam"); # dummy script that doesn't do anything
my $status_pdfjam = ($? >> 8);
if ($clusters{lisa} == 1) {
unless (-e "$home/.bash_profile") {
die $! unless open FILE, "> $home/.bash_profile";
print FILE 'if [ -f ~/.bashrc ]; then '."\n";
print FILE ' . ~/.bashrc'."\n";
print FILE 'fi'."\n";
close FILE;
}
unless (-e "$home/.bashrc") {
system "touch ~/.bashrc\n";
}
}
if ($status_bin == 0 && $status_pdfjam == 0 && !(-e "install_true")) {
print "\n----------------------------------------------------\n";
print "\n\nWarning: Ricopili is already installed.\n";
print "Do you wish to uninstall the Ricopili PATH settings first (recommended)? <y/n>\n";
while (1) {
my $answer = lc <>;
chomp $answer;
if ($answer eq "y") {
print "\n\n";
print "*********************************************************************\n";
print "***** please read and follow instructions below, *******************\n";
print "***** only then restart ./rp_config *******************\n";
print "**********************************************************************\n";
print "\n\n";
print "\nJust for your information, the following commands will remove the following paths from your your current session and also for future logins:\n\n";
my @PATH = split(':',$ENV{PATH});
foreach (@PATH) {
if ($_ =~ "rp_bin" || $_ =~ "rp_perlpackages") {
print "\t$_\n";}
}
my @PATH = split ":", $ENV{PATH};
my @NEW_PATH = ();
my $path_found = 0;
foreach (@PATH) {
unless ($_ =~ "rp_bin") {
push @NEW_PATH, $_;
}
else {
$path_found = 1;
}
}
if ($path_found == 1) {
my $new_path = join ":", @NEW_PATH;
my $i = 1;
print "\n1) Run this command (copy/paste an return) to remove rp_bin from the search path in your current login session\n\n";
# 1. Remove paths for this session
if ($shell eq "bash") {
$i += 1;
print "\texport PATH=$new_path\n\n";
}
elsif ($shell eq "tcsh") {
$i += 1;
print "\tsetenv PATH $new_path\n\n";
}
else {
print " ---- shell seems to be different to bash or tcsh -------------\n";
print " ---- please figure out how to change the current search path to the following -------------\n";
$i += 1;
print "\t$new_path\n";
}
}
###############################################################################
# 2. Remove the path permanently from the search path
my $perma_found = 0;
my $found_txt = "";
if ($bashrc ne "") {
my @tmp_lines = `grep rp_bin $bashrc`;
$perma_found += @tmp_lines;
foreach (@tmp_lines) {
$found_txt .= "\t\t\t$_";
}
@tmp_lines = `grep rp_perlpackages $bashrc`;
$perma_found += @tmp_lines;
foreach (@tmp_lines) {
$found_txt .= "\t\t\t$_";
}
if ($perma_found > 0){
&mysystem("grep -v rp_bin $bashrc | grep -v rp_perlpackages > $bashrc.minus_rpbin.txt");
&mysystem("cp $bashrc $bashrc.copy");
# $i += 1;
print "\n2) Run this command to remove rp_bin permanantly from the search path.\n";
print "\n\tmv $bashrc.minus_rpbin.txt $bashrc\n\n";
print "\t\t## this will delete the following lines from your $bashrc file:\n\n";
print "$found_txt\n";
print "\n\t\t-> a backup of $bashrc is available here: $bashrc.copy\n";
}
else {
}
}
# elsif ($clusters{genomedk} == 1 || $clusters{mssm} == 1 || $clusters{lisa} == 1 || $clusters{computerome} == 1 || $clusters{co_ipsych} == 1 || $clusters{uppmax} == 1) {
# else {
# print "\n----------------------------------------------------\n";
# print "\n## Remove the directories listed above from the same place where you permanently added the directories to the search path.\n";
# $i += 1;
# }
print "\n\n";
print "*********************************************************************\n";
print "*********************************************************************\n";
print "***** please read and follow instructions above, *******************\n";
print "***** only then restart ./rp_config *******************\n";
print "**********************************************************************\n";
print "\n\n";
exit;
}
elsif ($answer eq "n") {&mysystem("touch install_true");last;}
else {print "Please answer with y or n.\n";}
}
};
###################################################
### Add rp_bin to default search path
###################################################
system("bin_check"); # dummy script that doesn't do anything
my $status_bin = ($? >> 8);
system("bin_check_pdfjam"); # dummy script that doesn't do anything
my $status_pdfjam = ($? >> 8);
# exit;
unless ($status_bin == 0 && $status_pdfjam == 0) {
my $bash = "$cdir/my.bashrc_rp_path";
my $csh = "$cdir/my.cshrc_rp_path";
die $! unless open FILE, "> $bash";
print FILE "\n\nPATH=$cdir:\$PATH\n";
print FILE "PATH=$cdir/pdfjam:\$PATH\n";
if ($clusters{lisa}){
print FILE "\texport rp_perlpackages=/home/gwas/perl_modules\n";
}
if ($clusters{computerome}){
print FILE "\texport rp_perlpackages=/home/people/sripke/rp_external_bins/perl_packages\n";
}
if ($clusters{co_ipsych}){
print FILE "\texport rp_perlpackages=/data/user_tools/rp_external_bins/perl_packages\n";
}
if ($clusters{broad}){
print FILE "\texport rp_perlpackages=/home/unix/sripke/perl_modules\n";
}
if ($clusters{uppmax}){
print FILE "\texport rp_perlpackages=/proj/$uppmax_project/ricopili/software/perl_modules\n";
}
if ($clusters{custom}){
print FILE "\texport rp_perlpackages=$path_to_perlmodules\n";
print FILE "\texport RPHOME=$rphome\n";
}
close FILE;
if ($clusters{custom}){
die $! unless open FILE, "> $csh";
print FILE "\n\nset path=($cdir \$path)\n";
print FILE "set path=($cdir/pdfjam \$path)\n";
if ($clusters{broad}){
print FILE "setenv rp_perlpackages $path_to_perlmodules\n";
print FILE "setenv RPHOME $rphome\n";
}
close FILE;
}
print "\n\n";
print "*********************************************************************\n";
print "*** Setting the path (permanantly and for this sesion ***************\n";
print "*** for the ricopili scripts and for pdfjam ***************\n";
print "*********************************************************************\n";
print "\n";
print "*********************************************************************\n";
print "***** please read and follow instructions below, *******************\n";
print "***** only then restart ./rp_config *******************\n";
print "**********************************************************************\n";
print "\n\n";
print "## Please run the following commands to permanently add rp_bin to the default search path: \n";
print "## (the last two add the necessary paths also to your current session) \n\n";
if ($clusters{broad}){
my $i = 1;
if (-e "$home/.my.bashrc") {
print "\tcat $bash >> ~/.my.bashrc\n";
$i += 1;
}
if (-e "$home/.my.cshrc") {
print "\tcat $csh >> ~/.my.cshrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
print "\texport rp_perlpackages=/home/unix/sripke/perl_modules\n";
$i += 1;
}
elsif ($shell eq "tcsh") {
print "\tset path=($cdir \$path)\n";
$i += 1;
print "\tset path=($cdir/pdfjam \$path)\n";
$i += 1;
print "\tsetenv rp_perlpackages /home/unix/sripke/perl_modules\n";
$i += 1;
}
}
elsif ($clusters{genomedk}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
}
elsif ($clusters{lisa}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
print "\texport rp_perlpackages=/home/gwas/perl_modules\n";
}
elsif ($clusters{computerome}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
print "\texport rp_perlpackages=/home/people/sripke/rp_external_bins/perl_packages\n";
}
elsif ($clusters{co_ipsych}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
print "\texport rp_perlpackages=/data/user_tools/rp_external_bins/perl_packages\n";
}
elsif ($clusters{mssm}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
}
elsif ($clusters{bih_qsub}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
}
elsif ($clusters{unc_slurm}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
}
elsif ($clusters{custom}){
my $i = 1;
if ($shell eq "bash") {
print "\tcat $bash >> $bashrc\n";
$i += 1;
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
print "\texport rp_perlpackages=$path_to_perlmodules\n";
print "\texport RPHOME=$rphome\n";
$i += 1;
}
if ($shell eq "tcsh") {
print "\tcat $csh >> $bashrc\n";
$i += 1;
print "\tset path=($cdir \$path)\n";
$i += 1;
print "\tset path=($cdir/pdfjam \$path)\n";
$i += 1;
print "\tsetenv RPHOME $rphome\n";
$i += 1;
}
}
elsif ($clusters{uppmax}){
my $i = 1;
if (-e "$home/.bashrc") {
print "\tcat $bash >> ~/.bashrc\n";
$i += 1;
}
if ($shell eq "bash") {
print "\tPATH=$cdir:\$PATH\n";
$i += 1;
print "\tPATH=$cdir/pdfjam:\$PATH\n";
$i += 1;
}
print "\texport rp_perlpackages=/proj/$uppmax_project/ricopili/software/perl_modules\n";
}
else {
print "You'll need to add the following paths to your default search path:\n";
print "\t$cdir\n";
print "\t$cdir/pdfjam\n\n";
print "If you are using a bash shell, sample commands are located in this file: $bash\n";
print "If you are using a tcsh shell, sample commands are located in this file: $csh\n";
print "For example instructions, see http://www.cyberciti.biz/faq/unix-linux-adding-path/\n";
print "If possible, add these paths permanently. Otherwise, you will need to do this everytime you start a new session.\n";
}
&mysystem("touch install_true");
print "\n\n";
print "*********************************************************************\n";
print "***** please read and follow instructions above, *******************\n";
print "***** only then restart ./rp_config *******************\n";
print "**********************************************************************\n";
print "\n\n";
exit;
}
print "Required directories found in search path:\n";
print "\trp_bin/ -- success\n";
print "\trp_bin/pdfjam/ -- success\n\n";
system("latex small2e > /dev/null"); # dummy script that doesn't do anything
my $status_latex = ($? >> 8);
unless ($status_latex) {
print "Detected latex is installed.\n\n";
&mysystem("rm small2e.*");
}
else {
print "---------------------------------------\n\n";
print "Error -- latex is not installed!\n\n";
if ($clusters{genomedk} == 1){
print "Run the following commands to add latex to the default search path:\n";
print "\techo \"source /com/extra/texlive/2014/load.sh\" >> ~/.bashrc\n";
print "\tsource /com/extra/texlive/2014/load.sh\n\n";
}