This repository has been archived by the owner on Jun 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcluster_centers.pl
54 lines (45 loc) · 1.63 KB
/
cluster_centers.pl
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
#!/usr/bin/perl
use strict;
use File::Spec;
use Getopt::Long;
use IO::File;
use Pod::Usage;
my $input_dir='extracted';
my $geno_dir='genotypes';
my $output_file='clusters';
my $samples_lists='';
# set user defined parameters
my $libdir='';
my $logdir='logs';
GetOptions('input_directory=s' => \$input_dir,
'geno_directory=s' => \$geno_dir,
'output_file=s' => \$output_file,
'samples_lists=s' => \$samples_lists,
'lib_dir=s' => \$libdir,
'log_dir=s' => \$logdir
)or pod2usage(1);
mkdir $logdir;
$input_dir=File::Spec->canonpath($input_dir);
unless((-d $input_dir)) {
print STDERR "Error: Cannot access directory for reading input: " .
"$input_dir\n";
exit(0);
}
print "Launching R commands ... \n\n";
my $proc_index = 1;
open(FHI,$samples_lists) || die("cannot open $samples_lists");
while(my $sampl_file=<FHI>){
$sampl_file =~ s/\012//;
$sampl_file =~ s/\015//;
my $R_command="nohup R --vanilla --no-save --slave analysis=cluster_centers input.path=".$input_dir."/ geno.path=".$geno_dir."/ out.file=".$output_file.$proc_index." samples.file=".$sampl_file." < ".$libdir."/cluster_centers.R >& ".$logdir."/cluster_centers_".$proc_index.".out &";
# Generate parameter file for the R-script performing the normalization
#open(FILE,">tQN_parameters.txt");
#print FILE "bead.platform<-\"${beadchip}_tQN_clusters.txt\"\n";
#print FILE "input.path<-\"$input_dir/\"\n";
#print FILE "output.path<-\"$output_dir/\"\n";
#print FILE "samples.file<-\"$samples_file\"\n";
#close(FILE);
# Run R script to generate normalized data
system("$R_command");
$proc_index++;
}