#!/software/bin/perl use strict; use warnings ; use File::Copy; use File::Basename; use File::Listing; my $rootdir = $ARGV[0]; my $celfile = $ARGV[1]; my $cfile = fileparse($celfile); my $sample = $ARGV[2]; my $cdfdir = $rootdir . "/cdf"; my $celdir = $rootdir . "/cel"; my $outdir = $rootdir . "/outdir"; mkdir($cdfdir, 0755) || print "Couldn't make dir $!\n"; mkdir($celdir,0755) || print "Couldn't make Celdir $!\n"; my $cdffile = "/nfs/team78pc/Individuals_Folders/cdg/TRANSFER/viewer/picnicGUI_unix/src/GenomeWideSNP_6.fromDB.cdf"; copy("$cdffile", "$cdfdir/GenomeWideSNP_6.fromDB.cdf") or die "copy failed $!\n"; copy("$celfile", "$celdir/$cfile") or die "copy of celfile failed $!\n"; mkdir ($outdir,0755) || print "Couldn't create outputdir : $!\n"; chdir($rootdir) || die "Can't change directory $!\n"; my $cmd1 = "java -Xmx2G -jar $rootdir/celConverter/CelFileConverter.jar -m $rootdir/celConverter/Snp6FeatureMappings.csv -c $rootdir/cdf/GenomeWideSNP_6.fromDB.cdf -s $celdir/ -t $rootdir/outdir/raw"; system($cmd1); my $dir = "$rootdir/outdir/output2/$sample" . "_feature.TXT"; opendir(DIR, "$rootdir/outdir/raw") || "Cannot open the directory $!\n"; opendir(ODIR,"$dir") || "Cannot open output2directory $! \n"; foreach my $file (readdir(DIR)){ if($file =~ /feature_intensity$/){ #my $cmd = "sh run_preprocessing.sh $rootdir/Matlab_Compilet_Runtime/v710/ $file $rootdir/info/ $rootdir/outdir/raw/ $rootdir/outdir/output/ $rootdir/outdir/ PRIMARY 0.5"; #warn "Running $cmd... \n"; #system($cmd); #outputs ploidy_3456_feature.TXT.csv foreach my $file2(readdir(ODIR)){ if($file2 =~ /^ploidy\_$sample\_feature\.TXT\.csv$/){ open(FILE, "<$dir/$file2") || "Cannot open the file $file2 $!\n"; #output from the previous system cmd. while(){ chomp; my ($in_pi,$in_ploidy,$in_alpha) = split(/,/); my $cmd2 = "sh run_HMM.sh $rootdir/Matlab_Compilet_Runtime/v710/ $file $rootdir/info/ $rootdir/outdir/output/ $rootdir/outdir/ 10 $in_pi $in_ploidy $in_alpha"; warn "Running $cmd2\n"; system($cmd2); } close FILE; } } } }