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
2 changes: 1 addition & 1 deletion CONVERTF/example.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

# $parfile = "par.ANCESTRYMAP.EIGENSTRAT";
$parfile = "par.EIGENSTRAT.PED";
Expand Down
22 changes: 19 additions & 3 deletions CONVERTF/ind2pheno.perl
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
#!/usr/bin/perl
#!/usr/bin/env perl

sub usage {
my $message = "@_";
die "
Usage: ind2pheno.perl infile outfile

Required Arguments:
infile : input .ind file
outfile : output .pheno file

$message

";
}

unless (@ARGV == 2) {usage("OOPS unexpected number of arguments")}

$in = $ARGV[0]; # .ind file
$out = $ARGV[1]; # .pheno file

open(IN,$in) || die("COF");
open(OUT,">$out") || die("COF");
open(IN,$in) || die("Cannot open file: $in");
open(OUT,">$out") || die("Cannot open file: $out");

while($line = <IN>)
{
Expand Down
2 changes: 1 addition & 1 deletion EIGENSTRAT/example.QTL.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$ENV{'PATH'} = "../bin:$ENV{'PATH'}";
# MUST put smartpca bin directory in path for smartpca.perl to work
Expand Down
2 changes: 1 addition & 1 deletion EIGENSTRAT/example.oldstyle.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$ENV{'PATH'} = "../bin:$ENV{'PATH'}";
# MUST put pca bin directory in path for smartpca.perl to work
Expand Down
2 changes: 1 addition & 1 deletion EIGENSTRAT/example.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$ENV{'PATH'} = "../bin:$ENV{'PATH'}";
# MUST put smartpca bin directory in path for smartpca.perl to work
Expand Down
4 changes: 3 additions & 1 deletion POPGEN/elldemo/doplot
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#!/usr//bin/perl -w
#!/usr/bin/env perl

use warnings;

system "ploteig -i sicaa.evec -c 1:2 -g aaa -p test4 -x -k -r ctable -e ell4aa.out -t \" Sicily EBA projected conf: 0.95\"" ;

10 changes: 4 additions & 6 deletions POPGEN/elldemo/rescale_ell
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr//bin/perl -w
#!/usr/bin/env perl

## rescale -i infile -o outfile -a inscale -b outscale

use warnings ;
use Getopt::Std ;
use File::Basename ;

Expand Down Expand Up @@ -82,9 +83,6 @@ sub critchi {

}

sub usage {

print "rescale_ell -i infile -o outfile -s outscale [-a inscale]\n" ;
exit 0 ;

sub usage {
die "Usage: rescale_ell -i infile -o outfile -s outscale [-a inscale]\n" ;
}
2 changes: 1 addition & 1 deletion POPGEN/example.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$ENV{'PATH'} = "../bin:$ENV{'PATH'}";

Expand Down
2 changes: 1 addition & 1 deletion POPGEN/twexample.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

$command = "../bin/twstats";
$command .= " -t twtable ";
Expand Down
22 changes: 21 additions & 1 deletion bin/evec2pca-ped.perl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/perl
#!/usr/bin/env perl

### translate .evec file to .pca file expected by eigenstrat program
### Note: .evec file does not contain entries for outliers
Expand All @@ -10,6 +10,26 @@
# ----- indiv names are not found in the .evec file, try the
# ----- familyname:indivname combination.

sub usage {
my $message = "@_";
die "
Usage: evec2pca-ped.perl k example.evec example.ind example.pca

Required Arguments:
k : the number of principal components in example.evec
file (e.g. 10)
example.evec : file of principal components produced by smartpca
example.ind : individual file
example.pca : file of principal components in file needed by
eigenstrat

$message

"
}

unless (@ARGV == 4) {usage("OOPS unexpected number of arguments")}

$k = $ARGV[0];
$evec = $ARGV[1];
$ind = $ARGV[2];
Expand Down
22 changes: 21 additions & 1 deletion bin/evec2pca.perl
Original file line number Diff line number Diff line change
@@ -1,9 +1,29 @@
#!/usr/bin/perl
#!/usr/bin/env perl

### translate .evec file to .pca file expected by eigenstrat program
### Note: .evec file does not contain entries for outliers
### .pca file does contain entries (set to all 0.0) for outliers

sub usage {
my $message = "@_";
die "
Usage: evec2pca.perl k example.evec example.ind example.pca

Required Arguments:
k : the number of principal components in example.evec
file (e.g. 10)
example.evec : file of principal components produced by smartpca
example.ind : individual file
example.pca : file of principal components in file needed by
eigenstrat

$message

"
}

unless (@ARGV == 4) {usage("OOPS unexpected number of arguments")}

$k = $ARGV[0];
$evec = $ARGV[1];
$ind = $ARGV[2];
Expand Down
32 changes: 29 additions & 3 deletions bin/gc.perl
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
#!/usr/bin/perl
#!/usr/bin/env perl

sub usage {
my $message = "@_";
die "
Usage: gc.perl infile outfile

Required Arguments:
infile : input file of chisq statistics produced by eigenstrat
program. It contains both uncorrected and EIGENSTRAT
statistics for each SNP.
outfile : output file. It lists lambda inflation values (for
both uncorrected and EIGENSTRAT) chisq statistics
after scaling by lambda (uncorrected and EIGENSTRAT)

Computation of lambda is as described in Devlin and Roeder 1999.
A lambda above 1 indicates inflation in chisq statistics.
By definition, lambda is not allowed to be less than 1.

Running time of the gc.perl program is very fast.

$message

"
}

unless(@ARGV == 2) {usage("OOPS unexpected number of arguments")}

$P = $ARGV[0];
$out = $ARGV[1];

# get data
$m=0;
open(P,"$P") || die("COF");
open(P,"$P") || die("Cannot open file: $P");
while($line = <P>) { if($line =~ /Chisq/) { last; } } # header lines
while($line = <P>)
{
Expand Down Expand Up @@ -66,7 +92,7 @@
if($lambda2 < 1) { $lambda2 = 1; } # not allowed to be less than 1

# output
open(OUT,">$out") || die("COF");
open(OUT,">$out") || die("Cannot open file: $out");
print OUT ("Chisq EIGENSTRAT\n");
printf OUT ("lambda=%.03f lambda=%.03f\n",$lambda1,$lambda2);
for($m=0; $m<$nSNP; $m++)
Expand Down
61 changes: 37 additions & 24 deletions bin/ploteig
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/local/bin/perl -w
#!/usr/bin/env perl

### ploteig -i eigfile -p pops -c a:b [-t title] [-s stem] [-g gstem] [-o outfile] [-x] [-k] [-y] [-z sep] -r colorstring -m xmul -n ymul
use warnings ;
use Getopt::Std ;
use File::Basename ;

Expand Down Expand Up @@ -41,8 +42,7 @@ if (defined $opts{"i"}) {
$infile = $opts{"i"} ;
}
else {
usage() ;
exit 0 ;
usage("OOPS -i parameter compulsory");
}

open (FF, $infile) || die "can't open $infile\n" ;
Expand All @@ -63,7 +63,7 @@ if (defined $opts{"p"}) {
$pops = $opts{"p"} ;
}
else {
die "p parameter compulsory\n" ;
usage("OOPS -p parameter compulsory");
}

$popsname = setpops ($pops) ;
Expand Down Expand Up @@ -142,7 +142,7 @@ $psfile = "$stem.ps" ;
$psfile =~ s/xtxt/ps/ ;
}
system "gnuplot < $gnfile > $psfile" ;
system "/home/np29/bin/fixgreen $psfile" ;
#system "/home/np29/bin/fixgreen $psfile" ;
system "ps2pdf $psfile " ;
}
unlink (@T) unless $keepflag ;
Expand Down Expand Up @@ -172,25 +172,38 @@ sub setcolor {
}

sub usage {

print "ploteig -i eigfile -p pops -c a:b [-t title] [-s stem] [-o outfile] [-x] [-k] -c colorstringh [-m xmul] [-n ymul]\n" ;
print "-i eigfile input file first col indiv-id last col population\n" ;
print "## as output by smartpca in outputvecs \n" ;
print "-c a:b a, b columns to plot. 1:2 would be common and leading 2 eigenvectors\n" ;
print "-p pops Populations to plot. : delimited. eg -p Bantu:San:French\n" ;
print "## pops can also be a filename. List populations 1 per line\n" ;
print "[-s stem] stem will start various output files\n" ;
print "[-o ofile] ofile will be gnuplot control file. Should have xtxt suffix\n";
print "[-x] make ps and pdf files\n" ;
print "[-k] keep various intermediate files although -x set\n" ;
print "## necessary if .xtxt file is to be hand edited\n" ;
print "[-r colorstringpairs or colorstringfile]\n" ;
print "[-g gstem] make gstem.xtxt gstem.ps gstem.pdf \n" ;
print "[-y] put key at top right inside box (old mode)\n" ;
print "[-t] title (legend)\n" ;

print "The xtxt file is a gnuplot file and can be easily hand edited. Intermediate files
needed if you want to make your own plot\n" ;
my $message = "@_";

# 10 20 30 40 50 60 70 80 90
#---+----|---+----|---+----|---+----|---+----|---+----|---+----|---+----|---+----|
die "
Usage: ploteig [FLAGS]

Required Flags:
-i eigfile : input file first col indiv-id last col population
as output by smartpca in outputvecs
-p pops : Populations to plot. : delimited. eg -p Bantu:San:French
pops can also be a filename. List populations 1 per line

Optional Flags:
-c a:b : a, b columns to plot. 1:2 would be common and leading 2
eigenvectors
-s stem : stem will start various output files
-o ofile : ofile will be gnuplot control file. Should have xtxt suffix
-x : make ps and pdf files
-k : keep various intermediate files, although setting -x is
necessary if .xtxt file is to be hand edited
-r cfile : colorstringpairs or colorstringfile
-g gstem : make gstem.xtxt gstem.ps gstem.pdf
-y : put key at top right inside box (old mode)
-t : title (legend)

The xtxt file is a gnuplot file and can be easily hand edited. Intermediate
files needed if you want to make your own plot

$message

" ;

}
sub setpops {
Expand Down
10 changes: 4 additions & 6 deletions bin/rescale_ell
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr//bin/perl -w
#!/usr/bin/env perl

## rescale -i infile -o outfile -a inscale -b outscale

use warnings ;
use Getopt::Std ;
use File::Basename ;

Expand Down Expand Up @@ -82,9 +83,6 @@ sub critchi {

}

sub usage {

print "rescale_ell -i infile -o outfile -s outscale [-a inscale]\n" ;
exit 0 ;

sub usage {
die "Usage: rescale_ell -i infile -o outfile -s outscale [-a inscale]\n" ;
}
Loading