Skip to content

Commit

Permalink
Nick's updates to 7.0. Updates to Makefile and README to fix issues.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewMah committed Jun 23, 2020
1 parent a17319f commit 24e63b5
Show file tree
Hide file tree
Showing 42 changed files with 9,257 additions and 586 deletions.
28 changes: 0 additions & 28 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,34 +13,6 @@ src/admixlib/*
src/admixtables/*

#Various output files
src/backup
src/convertf
src/copych
src/diff.out
src/diffch
src/dirlist
src/dowtjack
src/gmon.out
src/grabpars
src/libnick.a
src/nicksrc/tmp
src/oldmake
src/oldmakefile
src/q1
src/qaz
src/qp3Pop
src/qp4diff
src/qpAdm
src/qpBound
src/qpDpart
src/qpDstat
src/qpff3base
src/qpF4ratio
src/qpGraph
src/qpWave
src/qpreroot
src/rolloff
src/tables
pdoc.aux
pdoc.dvi
pdoc.log
Expand Down
17 changes: 15 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ADMIXTOOLS version 6.0 1/10/20 (for Linux and Mac)
ADMIXTOOLS version 7.0 6/23/20 (for Linux and Mac)

See README.INSTALL for installation info.

Expand Down Expand Up @@ -26,9 +26,22 @@ recompile the programs, type

If you are building on a Mac, you will need gsl and openblas installed.
"brew install gsl"
"brew install homebrew/science/openblas"
"brew install openblas"
Uncomment the lines in src/Makefile that modify the CFLAGS and LDFLAGS.

If these packages are not in standard directories, you can specify the
appropriate include and library directories with the CFLAGS and LDFLAGS
make variables.
For example, on the Harvard Medical School O2 cluster, the command is:
'make CFLAGS="-I/n/app/openblas/0.2.19/include -I/n/app/gsl/2.3/include" LDFLAGS="-L/n/app/openblas/0.2.19/lib -L/n/app/gsl/2.3/lib/"'
On Mac OSX:
'make CFLAGS="-I/usr/local/opt/openblas/include -I/usr/local/opt/gsl/include" LDFLAGS="-L/usr/local/opt/openblas/lib -L/usr/local/opt/gsl/lib"'

If you have issues with missing lapacke symbols, for example "undefined reference to `LAPACKE_dlange'", run make with the corresponding additional libraries linked:
'make LDLIBS="-llapacke"' on Linux Mint 18.
Similarly for Ubuntu, for "undefined reference to dspev_"
'make LDLIBS="-llapack"'

If you have trouble compiling and running our code, try compiling and
running the examples in the examples/ directory. Download the example
datasets from https://reich.hms.harvard.edu/sites/reich.hms.harvard.edu/files/inline-files/AdmixTools_Example_Data.tar_.gz
Expand Down
10 changes: 10 additions & 0 deletions README.QPGRAPH
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,16 @@ qpGraph will accept either style.
[-d dotfile] Graph output in "dot format"; dot -Tps < dotfile > dotfile.ps gives postscript
"dot" must be installed (part of Graphviz)

*** new feature ***
Input can now be an fstats file -- see README.qpfstats
*** new feature ***
halfscore (won't work in combination with fstats)
halfscore: YES
halfjackname: <output file>
Does a VERY conservative goodness of fit test. See halfscore.pdf for details.



===================================================================================================
Utility program: qpreroot
If the input graph is not connected or has loops qpGraph will die unpleasantly.
Expand Down
4 changes: 4 additions & 0 deletions README.QpWave
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ program code:

diagplus: 0

*** new feature (for both qpAdm and qpWave)***
Input can now be an fstats file -- see README.qpfstats
For qpAdm new parameter numboot: see README.qpfstats


Nick Patterson
<[email protected]>
Expand Down
64 changes: 64 additions & 0 deletions README.qpfstats
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
qpfstats
--------
DIR: /home/np29/biologyx/v41x/yamdir2/testdir
S1: qdata1
S1X: qdata1
indivname: DIR/S1X.ind
snpname: DIR/S1.snp
genotypename: DIR/S1.geno
poplistname: lista
## must be present. ne popuation / line. First population is base
fstatsoutname: fstatsa.txt
## first line is header. Must be retained
allsnps: YES
## default NO -- dangerous bend
inbreed: NO
## default NO
scale: NO
## default YES -- when fstats are scaled to "match" fst in least squares sense

qpfmv
-----
fstatsname: fstatsa.txt
popfilename: f4sslist
## 4 pops / line (as in qpDstat) but f2, f3, f4 can be mixed. So code A C B C for f3 stat
fmvoutname: fmvq2.out


New parameters for qpAdm (which should be upwards compatible)
fstatsname: <output from qpfstats>
## if present no need to specify .ind .snp .geno
numboot: <# of bootstrap samples + antithetical samples>
## default 1000

New parameters for qpWave (which should be upwards compatible)
fstatsname: <output from qpfstats>

New parameters for qpGraph (which should be upwards compatible)
qpGraph allows to to make qpfstats file
Example
1) Make qpfstats :: ~np29/newadm19/src/jtest1/ww2dir/testdir/qpfs_example/parw2
D2: /home/np29/broaddatax/v41
D1: D2
S1: jd1
indivname: D1/S1.ind
snpname: D1/S1.snp
genotypename: D1/S1.geno
fstatsoutname: fstatsw2
allsnps: YES
## there is an option oldallsnps: YES for compatiblity. Not recommended.
loadf3: YES
## this is needed to get qpfstats calculated
graphname: graph1
diag: .0001

2) Use qpfstats
fstatsname: fstatsw2
graphname: graph1
diag: .0001

*** qpfstats with allsnps: YES is a much better way to use all the data than
the older allsnps mode. Standard errors are often much reduced and the theory
is now defensible!

See ./qpfs.pdf for a brief explanation of the theory.
17 changes: 17 additions & 0 deletions fancy.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Consider f4(l1, l2, r1, r2)
Suppose at some snp l2 is missing, but the allele frequencies of r1, r2 match. Then whatever l2 f4 is zero
Similarly f4=0 if the frequncy of l1 and l2 match,

qpAdm
qpWave
qpF4ratio
qpf4diff

use this trick.

Arie Shaus pointed out to me that this can bias f4 down toward 0.
To disable, code in the parameter file

fancyf4: NO

Nick 1/29/19
Binary file added halfscore.pdf
Binary file not shown.
46 changes: 46 additions & 0 deletions perlsrc/jackdiff
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/perl -w

use Getopt::Std ;
getopts('a:b:o:',\%opts) ;

$fa = $opts{"a"} ;
$fb = $opts{"b"} ;
$fout = $opts{"o"} ;

die "no -a parameter\n" unless (defined $fa) ;
die "no -b parameter\n" unless (defined $fb) ;

open (I1, "$fa") || die "can't open $fa\n" ;
open (I2, "$fb") || die "can't open $fa\n" ;

$maxa = -1 ;
foreach $line (<I1>) {
($a, $w, $v) = split " ", $line ;
next if ($a =~ /\#/) ;
next unless (defined $v) ;
$WA[$a] = $w ;
$VA[$a] = $v ;
}
foreach $line (<I2>) {
($a, $w, $v) = split " ", $line ;
next if ($a =~ /\#/) ;
next unless (defined $v) ;
$WB[$a] = $w ;
$VB[$a] = $v ;
$maxa = $a ;
}
$T1 = "/tmp/t1.$$" ;
open (Y1, ">$T1") ;

foreach $a (0..$maxa) {
$wa = $WA[$a] ;
$wb = $WB[$a] ;
$va = $VA[$a] ;
$vb = $VB[$a] ;
die "mismatched weights: line index $a\n" if ($wa != $wb) ;
printf Y1 "%d %d %12.6f\n", $a, $wa, $va - $vb ;
}
close Y1 ;
system "mkpretty $T1 $fout" if (defined $fout) ;
printf "##jackknife difference $fa - $fb\n" ;
system "simpjack2 -i $T1 -v" ;
66 changes: 66 additions & 0 deletions perlsrc/mkpretty
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
#!/usr/bin/perl -w

## mkpretty infile outfile

($infile, $outfile) = @ARGV ;
$T1 = "/tmp/t1.$$" ;
$T2 = "/tmp/t2.$$" ;

if (defined $infile) {
die "Usage: mkpretty < infile > outfile OR mkpretty infile outfile\n" unless (defined $outfile) ;
system "cp $infile $T1" ;
}
else {
system "cat - > $T1" ;
}
open (F1, $T1) || die "badly\n" ;
for (;;) {
last if (eof(F1)) ;
$line = <F1> ;
chomp $line ;
(@Z) = split " ", $line ;
next unless (defined $Z[0]) ;
next if ($Z[0] =~ /\#/) ;
$n = @Z ;
foreach $x (0..$n-1) {
$W[$x] = 0 unless (defined ($W[$x])) ;
$w = length($Z[$x]) ;
$W[$x] = $w if ($w > $W[$x]) ;
}
}
## @W is maximum width
close F1 ;
$nw = @W ;
foreach $x (0..$nw-1) {
$w = $W[$x] ;
$fmt = "%" . $w . "s" ;
$F[$x] = $fmt ;
}

open (F1, $T1) || die "badly\n" ;
open (YY, ">$T2") || die "very badly\n" ;
for (;;) {
last if (eof(F1)) ;
$line = <F1> ;
chomp $line ;
(@Z) = split " ", $line ;
next unless (defined $Z[0]) ;
if ($Z[0] =~ /\#/) {
print YY "$line\n";
next ;
}
$n = @Z ;
foreach $x (0..$n-1) {
printf YY "$F[$x]", $Z[$x] ;
print YY " ", if ($x != ($n-1)) ;
}
print YY "\n" ;
}
if (defined $outfile) {
system "cp $T2 $outfile" ;
}
else {
system "cat $T2" ;
}
unlink ($T1, $T2) ;

Binary file added qpfs.pdf
Binary file not shown.
36 changes: 36 additions & 0 deletions src/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
backup
convertf
copych
diff.out
diffch
dirlist
dowtjack
expfit.sh
gcount
gmon.out
grabpars
kimf
libnick.a
mergeit
nicktmp
oldmake
oldmakefile
q1
qaz
qp3Pop
qp4diff
qpAdm
qpBound
qpDpart
qpdslow
qpDstat
qpff3base
qpfmv
qpfstats
qpF4ratio
qpGraph
qpWave
qpreroot
rolloff
rolloffp
simpjack2
tables
Loading

0 comments on commit 24e63b5

Please sign in to comment.