SIB-PAIR: List of subroutines and functions

Sib-pair is largely written in standard Fortran 95 (as usual, there are a few system specific routines for file handling, time and date etc).

The Sib-pair source code is distributed as a single file, with C-preprocesser macros to deal with platform specific code. The "source lines" in the tables below are the lines within that single file.

The listings below are automatically generated (by an awk script), so check the source for additional informative comments that may have been skipped.

Listing is first by position in the source code file, then alphabetically. The organization of the source is modules, main, I/O, statistical library routines, association and linkage.


Alphabetical list of modules

AS164
 Algorithm AS 164: Least Squares Subject to Linear Constraints
 Author(s): W. Douglas Stirling
 Source: Applied Statistics, Vol. 30, No. 2, (1981), pp. 204-212
AS164_class
 Work arrays for AS164 -- allow passing of results to other routines
AS319
 Algorithm AS 319 
 variable metric function minimisation
 Algorithm AS 319 Appl Statist (1997), Vol 46, No 4
 Converted to Fortran 90 free-format style by Alan Miller
 e-mail: Alan.Miller @ vic.cmis.csiro.au
 URL: www.ozemail.com.au/~milleraj
BLAS
 Selected BLAS routines
EISPACK
 Selected EISPACK subroutines
LINPACK
 Selected LINPACK subroutines
alleles_class
 Allele frequency data structure
automatic_data
 
 Environmental (automatic) variables for evaluator
bgzf
 Reading bgzipped files

* BGZF/GZIP header (specialized from RFC 1952; little endian):
 ID1 ID2 CM  FLG     MTIME       XFL OS   XLEN   SI1 SI2  SLEN
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 31|139|  8|  4|              0|  0|255|      6| 66| 67|      2|BLK_LEN|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 BGZF extension:
               ^                              ^   ^   ^
               |                              |   |   |
              FLG.EXTRA                     XLEN  B   C

 BGZF format is compatible with GZIP. It limits the size of each compressed
 block to 2^16 bytes and adds and an extra "BC" field in the gzip header which
 records the size.
 
bobyqa_optimizer
 Mike Powell's BOBYQA minimizer
brent_mft
 MFT bivariate normal likelihood
brent_vcdata
 Data to be passed to function called by brent()

 MVN profile likelihood
categorical_data
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes
comp_ops
 parse comparison in isaff (simple expression)
 15='<', 16='>', 17='ge', 18='le', 19='ne', 20='eq'
 21='odd', 22='even'
contingency_table

covariate_data
 Accessory routines and structure to store information about variables in formula
extras
 Compiler, version, linked in external libraries etc recorded here:
 1) GUI additions 2) Interface to ZLib 3) Unix pipes
f95pipes
Support for Unix pipes
f95zlib
Interface and wrappers for zlib
fastatools
Read and index FASTA files
fileio
 Readline subroutine for either plain or (b)gzipped files -- 
formula_class
 Simple regression formula structure and parser
genetic_maps
 Linkage and physical maps
   genetic map functions are 1=Haldane, 2=Kosambi
   default map units is Mbp or cM (assuming 1 Mbp/cM)
   mapunits=type of map unit
   mapconstant=multiplier for internal map units (Mbp/cM)
genofile_class
 an object representing genotype data in a file
genolist_class
 Lists of genotypes
glm_types
 GLM model types
grapheps
 The grapheps Postscript functions
 See http://swiss.csail.mit.edu/~jaffer/Docupage/grapheps
gtftools
           
 GTF (GFF, GVF)
           
ibd_class
 Variance components data structure
idhash_class
 Hash table for indexing IDs etc
idhash_funs
 hash functions for IDs
idstring_widths
 One big pedigree data structure
 Updating size requires copying entire structure
 (hopefully maintaining contiguous storage)

 Preliminary work to make ID string widths adjustable 
interrupt
 interrupt
iobuff
 Input buffer, stack of input streams, prompt string etc
   ilevel=0 historical or macro command; =1 keyboard; =2,3,4 files
   toplevel=highest occupied level
   ilevold=last level, if ilevel currently 0

   incstr    stream for ith inclusion
   infil     name of file
   incaction 1=read entire stream 2=read locus information only 
             3=1+delete 
iocodes
 iostat codes needed for wrinline etc
 now available in the intrinsic module
ioports
 Definition of a port
   slots: associated file name
          1=uncompressed 2=gzipped 3=bgzipped 4=unzipped copy 5=pipe
          Fortran style logical unit number
          gzip C-style file handle
japi
Interface to the JAVA AWT Toolkit
julian_epoch
 epoch for Julian dates (defaults to 2440588==1970-01-01),
kinship_io
 Higher level i/o routines for popgen_kinship
likelihoods
 Pedigree MVN and MFT model loglikelihood
   mftlik_plevel controls output detail from mftlik()
   mftlik_nerrors counts number of pedigrees causing problems
   mftlik_interval is estimate of 99% interval containing likelihood (MC error)
lochash_class
 Locus name hash table
locstring_widths
 String length for locus names and annotations
locus_data
 Storage for the locus data
locus_list
 Subset, manipulate or print locus_data
locus_types
 Locus types bitpatterns
 loctyp Compression_scheme Deleted Marker: Autosomal X-marker Haploid Y-chrom / Affection Quantitative
        CC D T  
 1      00 0 0 001 Autosomal marker
 2      00 0 0 010 X-chromosome marker
 4      00 0 0 100 Haploid unspecified
 5      00 0 0 101 Mitochondrial marker
 6      00 0 0 110 Y-Chromosome marker
 8      00 0 1 000 Trait unspecified
 9      00 0 1 001 Quantitative trait
 10     00 0 1 010 Binary trait
 11     00 0 1 011 Categorical trait
 12     00 0 1 100 Special trait (computed)
map_position_list
 Subset of loci by map ranges

 read in range of map positions eg
    6:112345 -- 142441          => 6:112345-6:142441
    6:112345-142441             => 6:112345-6:142441
 chr6 112345 -- 142441 1424450  => 6:112345-6:142441 6:1424450-6:1424450
    -- 6:112345                 => 6:0-6:112345
    6:112345 --                 => 6:112345-6:1e99
    6:112345 -- 7:142441 => 6:112345 --, -- 7:142441 => 6:112345-6:1e99, 7:0-7:142441

         pos1              => "  ":pos1 -- "  ":pos1
         pos2              => chr1:pos2 -- chr1:pos2
    chr1:pos1              => chr1:pos1 -- chr1:pos1
    chr1:pos1 -- chr1:pos2 => chr1:pos1 -- chr1:pos2
    chr1:pos1 -- pos2      => chr1:pos1 -- chr1:pos2
    chr1:pos1 --           => chr1:pos1 -- chr1:1e99
    -- chr1:pos2           => chr1:0 -- chr1:pos2
maprange_class
 Storage for a range of map positions

 chromosome  chromosome_name  
 mapranges   range_start range_end
 chromrange  first_range_record last_range_record
matrix_class
 A container for large (dense) matrices that can keep them as
 random access files and buffer a subset of columns in memory
mcmc_model
 Mixed model analysis parameters

 linkf=link function 1=identity 2=logit 3=probit 4=MFT 5=log
 modtyp=likelihood family (1=gaussian, 2=binomial, 3=poisson)
 nqtl=trait loci in model
 nfix=number of fixed effects
 MAXPAR=maximum number of segregation model parameters
 RANPAR=number of random effects model parameters
 Model parameters
 model pars 1=P(all) 2=a 3=d 4=AA 5=AB 6=BB
            7=mu 8=totvar 9=VA 10=VD 11=VG 12=VC 13=VS 14=VE
            15=sdG 16=sdC 17=sdM 18=sdE
            19=a2 20=d2 21=h2 22=c2 23=m2 24=e2
            25..MAXPAR=Betas
 Random Effects:
  QTL:
   1=P(all)  2=a  3=d
   4=muAA  5=muAB  6=muBB
   7=mu  8=totvar  9=VA  10=VD
  Polygenes:
   11=VG  14=sdG
  Familial environment
   12=VC  15=sdC
  Maternal/sibship effect
   13=VS  17=sdS
  Error
   14=VE  18=sdE
  Proportions of variance
   19=a2 20=d2 21=h2 22=c2 23=s2 24=e2
 Fixed Effects:
   25...MAXPAR
  
 parnam  = parameter name
 paract  = status
             0=excluded
             1=estimated
             2=fixed
             3=function of estimated parameter
 par     = parameter estimate
 parscal = scale size for MCMC proposal distribution
             (usually approx standard error)
  
mftcontrol
 MVN integration control variables
     mftalgo 1=Mendell-Elston 2=Genz
     mfteval maximum number of function values allowed. This
             parameter can be used to limit the time. A sensible
             strategy is to start with MAXPTS = 1000*N, and then
             increase MAXPTS if ERROR is too large.
     abseps  absolute error tolerance.
     releps  relative error tolerance.
mftfuns
 Main multivariate normal integration routines (Alan Genz)
nucleotides
 Routines to manipulate nucleotide alleles: 
   numeric to letter, strand flipping, 
outstream
 Output stream, formatting
pairlist_class
  
 expandable ordered list of (unique) pairs of integers
 new entries are either inserted 
 or appended after comparison to most recent addition

 npairs=#pairs
 pairs=set of pairs
  
parser_data
 
 List of reserved words
 Token name, left binding power, right binding power, operation
 
ped_class
Pedigree container
pedigree_data
 Dataset pedigree storage and manipulation routines
popgen_kinship
 Large dense empirical kinship matrix,
   its latest active subset and corresponding inverse
   and a hash of the ids of the dropped rows
popgen_vcdata
 Cockerham-like multi-locus variance components
read_data
 Extract values from dataset
recast_data
 Recast data to and from dp representation
relpair_classes
 Types of relative pair
rndseed
 time/random number generator seeds
rngs
 random number generators
scanner
 Scanner
scheme_lang
 Miniscm
showcomponent
 Utilities to print arrays
sorts
 Sorting etc
 
statfuns
 Statistical functions library
 
statresults
 Results of statistical tests

 Likelihoods and no. parameters for consecutive model fits (varcom, llm, segsim)
 whlik points to last result
 pval is P-value arising from current test
 statval is statistic and error variance (asymptotic and empirical estimates) 
   or d.f. arising from current test (binreg, clreg)
storage_classes
 Phenotype/genotype data storage classes are currently:
   SCLASS = i1  4-bit genotypes or 8-bit alleles
   GCLASS = i2  16-bit alleles 
   PCLASS = r8
  (TCLASS = any)
 Chunksize is the blocksize for reading/writing binary images,
   so as not to exceed LRECL or buffers
string_utilities
 String utilities
symmetric_matrix
 Simple symmetric matrix operations
table_cell_type
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  
timelib
 date and time subroutines
varmet_optimizer
 Algorithm AS 319 
 variable metric function minimisation
 Algorithm AS 319 Appl Statist (1997), Vol 46, No 4
 Converted to Fortran 90 free-format style by Alan Miller
 e-mail: Alan.Miller @ vic.cmis.csiro.au
 URL: www.ozemail.com.au/~milleraj

 Actual varmet minimizer
vcfhash_class
 hash VCF file by locus name
vcftools
 VCF (Variant Call Format) file utilities


Alphabetical list of routines

accum_stats actlist actped
add_scheme_annotation addall addcolon addlet addlist
addridge addsexes addtmpvar addvar agl
alias aligntype alldata allinset allntcode
alngam alnum alogit ancest annotate_cat
append append append_annotation append_iarray append_one_number
append_one_real append_one_string append_pair append_rarray append_string
appval args ascend asstyp autovar
aval backchar badloop betacf bgzf_read
bgzf_seek big_clcpos big_mqls bigblue binirls
binop binp binreg binz bluefreq
blup bonf brent brent_inter brent_polyr
brent_proflik brent_proflik_mft brent_tet bsub caar
cadaar cadar cadddr caddr cadr
calc_gtp_freqs calc_naive_freq_ase calclogrank calfun car
casekin cat catseg ccpen cdar
cddddr cddr cdr ceqstr check
check_vcfhash chfind chip chisqd chkbin
chol choose chr_convert chrnum cisimped
ckibs clcchi clcibd clcibs clcmcn
clcpos clcrun clctdt clean_AS164 clean_cats
clean_mapranges clean_pairs clean_props clean_table cleanup_alleles
cleanup_bank cleanup_form cleanup_hash cleanup_loci cleanup_mem
cleanup_peds clearinput close_fasta close_port clratom
clreg clrmark cntbad cntclasses cntmark
cntprop colprint combine combine_stats comparemap
compiler_options compiler_version compld complement complete
compop compsign concat concest conchi
conlen connect conoff cons copy
copy_mem copy_peds copydata copyfreq copystring
corchi corchi_one corr corrstd corstring
cortest count_specials count_vcflines countall countargs
countfields counthom countmz countp countsep
countships couple coutyp covcor covreg
covsrt cpganova cpibd create_form csimped
csvline cubicld cubiclik current_time dataset_uses
dataset_uses dateconv dattoset davie davstat
davwri dayofweek dcentre decchr decgtp
defpro delfile delta delta7 dens
describe dhwe2 dim_table disjoin display
dkbvrc dksmrc dkswap dmatch dnorm
doanova doapm doasp doassoc dobatch
doblup dochol docomp docount docov
doeigen dogen dohash_id dohash_ped_id dohashids
dohist dohomoz dohrr dohwe doinbred
doito dokin domar domatch_id domatch_ped_id
domatch_string_id domatch_string_ped_id domft domix domqls
dopeel dopeel2 dopenrose doplot dorank
doselect dotdt dpois drop drop_inbreeding
dropt2 dryrun dsort dssp dumpstats
duplicates duptest dweib edit eigen
emibskin emllm empkin empval encchr
encgtp encode_geno1 encode_geno2 eow eqv
error0 error1 escape evalped evdtailp
exact_inbreeding exc exclude exclude_onelocus exclude_oneped
expand_alleles expand_geno expand_loci expand_pairs expand_pheno
expand_sgeno expand_table expandtilde extpath extprefix
extract_alt_alleles extract_annotation extract_fa extract_id extract_imztwin
extract_iped extract_mo extract_one_allele extract_ped extsuffix
fact famcatass famcor famcovar famerr
famimp fammeans famset famsort fchooser
fgz_close fgz_error fgz_open fgz_read fgz_read_integer
fgz_read_longint fgz_rewind fgz_seek fgz_write filecols
fill2 fill_hash filliben fillin fillin_mit
fillin_yha fillphase filltrans filltri filter_snp
fimpmap find_hashtab find_pair findbracket findend
findfile findids findlev findlev_cell findlist
findloop findmk findml findrank findrank_cell
findth findwh findword fisherp fishzci
fishzse fitbin fitloglin fitmix fixeff
flat_table flip flip_ac flip_ag flip_atgc
flip_buffer flip_ct flip_gt flipper flushinput
fonttype foulik found fp fpicker
fpicker fpmpred fprinter frater free_kin
freq fromfimp frommega fromplink fsimped
ftdev ftranspose ftranspose1 fval fval2
gammad gc gc_mark gencode gencopy
gener genfreq geninv genof2 genof3
genof4 genoff genofile_active genofile_create genofile_destroy
genot gensym get_carray get_fastaref get_geno
get_iarray get_ivalue get_kinship get_listlen get_listtail
get_namedgeno get_notes get_quantile get_rarray get_refalleles
get_rng_seeds get_snpallele1 get_snpallele2 get_stats get_string
get_strlen get_substr get_table_cell get_table_cell_type get_value
get_var get_varinfo getbin getcell getchr
getfilehint getfreq getgeno getint getlabel
getlin getnam getpairval getrelval getstrata
gettrait getvcfanno getvcfanno2 getword getyear
gibbs gibinv givenc gl glist
glist2 glmscale globhom globhom_onelocus grad
groupgenos grrpen handler handler hap2gen
hapassoc haploid_aov haploid_ass haploid_count haploid_freq
haptogen has_kinmat hashids hashmat hashprint
head help hexdump hibd highkin
histogram histstat hwe2 hwechi hwep
ibeta ibskin ibskin_one ibspca idwidths
idxlik iencgtp imputesex imultsort in_mapranges
inbreeding inchap inchar incpo incpos
incr incr_table increment_vcfcounts inderr index_fasta
indset info info_description inht inicov
init_globals init_mem init_procs init_rng init_scheme
init_scm init_syntax init_vars_global initvc insert_hash
insert_lochash insert_pair insert_table insert_table_cells insgen
insloc inuclik invkin invmap iquadmult
is_a is_c is_g is_t isactdip
isactive isaff isafun isatom isatwin
isbound iscattrait isclosure iscomment iscomp
iscompressed iscontinuation isdata iseligiblemarker isenv
isfalse isfloat isgeno isgzipped ishaploid
ishomog isimped isinenv isint isinteger
isinuse ismacro ismappos ismark ismarker
ismemoizedinv ismis ismiss ismzpair isntcode
isnumber isodate isop isort ispair
isport isproc ispromise isqtrait isreal
isspecial isstring issymbol issyntax istrait
istrue isvar isvec itlik itlik2
ito itpeel itpeel2 ival jack_useful
joinped juststr kininv kinridge kinship
kwtest landg ld2 ldlist ldp
ldtab ldtest legall lfact lifetab
linfun list_var listab listchroms listids
listloci listpeds ln load_kininv load_refallele
load_vcf_refall loadnam loadphenos loadpos loadset
loadvar loccode locfmt logccs logit
loglin logrank long_isort lorder lowermult
macloop macsub macvar make_idlist make_lochash
make_maphash make_mapranges make_ntlist make_real_matrix make_vcfhash
makeind maketab makewt mapformat maphead
margen marginal_table markeribd marseg marshare
match matchid matrix_active matrix_copy matrix_copy_row
matrix_create matrix_destroy matrix_get_col matrix_get_el matrix_get_row
matrix_ncols matrix_nrows matrix_print matrix_read matrix_read_contents
matrix_read_row matrix_read_unformatted matrix_set_bufwidth matrix_set_col matrix_set_el
matrix_set_row matrix_size matrix_type matrix_write matrix_write_filtered_row
matrix_write_row matrix_zero mcfreq mcgpe mecdf
mergebed mergefim mergeloci metavcf_vars mftlik
mhprop missing mixture mk_atom mk_closure
mk_const mk_continuation mk_number mk_port mk_proc
mk_real mk_string mk_symbol mk_syntax mkchoose
mkdummy mksegmod mktmpfil moment momentibs
moskld moskvina msdsort mulhom mumson
mutage mutate mvbvu mvndfn mvndst
mvnlik mvnlms mzdiscord mzfind mzgtp
mztest nearloc neighbours newinclude newlin
newloctyp newlun newstart nextcmd nextped
nextword nglist nglist2 non_alloc_rev nonextped
ntcode nttonum nuccode nuchek nucibd
nuclear nuclik nucseg numtont observed
ok_abbrev on_eow on_sow onchip onefam
oneinv onelik oneprop oneseg oneslice
onestripe onetab opcon open_fasta open_port
openlog openvcf opexe0 opexe1 opexe10
opexe11 opexe12 opexe13 opexe14 opexe15
opexe16 opexe17 opexe18 opexe2 opexe3
opexe4 opexe5 opexe6 opexe7 opexe8
opexe9 order ordvar packer packloci
padprint pairlink parbounds parcon parimp
parprop parser pearson pedhead pedibd
pedin pedlik pedout pedsort pedtab
permdata permut phi phist pipe_close
pipe_open pipe_read pipe_rewind pipe_write poltest
polycor polyinter popgen_homoz popgen_init popgen_summary
port_position postmult postmultm postprod postprodex
postscale postscalex ppnd prdiscord pre_grapheps
precis predmat preparser preseg prexpr
prgtp priallval print_sstate print_table printatom
printmat printmat_full prirelval processfam procnum
proct prodlim propci protect_kin prrel
prune prunep pstring pull pythag
qqplot qtdt qtlmod qtlpars quadform
quadmult quadxxm quadxy quadxy1 quadxym
quadxymv quantnorm query_fasta query_fastaseq querytbi
queryvcf ranall randn random rankstat
rantri rarecarrier rarecascon rclrts rcp
rcswp rctdt rctest rctperm rctsim
rctuse rdfreq rdlinloc rdloci rdmachdose
rdmerloc rdplinkdose rdvcf rdvcfgeno rdvcfped
read_bgzf_block read_scheme_image read_vcfhash readbigreal readbin
readcases readcsv readgeno readgrm readhapmap
readkin readline readmach readmap readnames
readoneval readpeds readprobs readstats readstr
readstrexp readval readvcf recast reclen
recode recrisk refgeno refstrand refvcfgeno
regress regwt relations relevel_cats remfam
remove renamer renumb reorder_cat repl_scheme
replacedata restore_linbuffer reverse rewind_port rs
rtheta rvalue s_retbool s_return s_save
same_loctyp sample sampleindices save_bluefreqs save_kininv
save_linbuffer save_scheme_image scatter_grapheps scheme_delim sclean
search_annot search_chrom search_table search_vcfhash searchid
sech seek_port segerr seglf seglik
seglnf segrat segsim seldel selped
selped_fil selstat set2hap set_caar set_car
set_cdar set_cdr set_geno set_hval set_ivalue
set_refalleles set_rng_seeds set_string set_substring set_syntaxnum
set_table_cell set_table_cell_type set_table_colname set_type set_value
setatom setmark setup_auto setup_bigA setup_bigC
setup_cats setup_freq setup_hash setup_ibd setup_kinmat
setup_loci setup_mem setup_mix setup_pairs setup_peds
setup_plink setup_props setup_stat setup_table setupmer
sextable share shell shibd shipcon
shipsiz shorten show_fasta show_form show_lochash
show_locus_allocation show_mapranges show_one_carray show_one_farray show_one_iarray
show_ped_allocation show_snp show_spectrum showdata showdups
showkin shuffle sibass sibcor sibloci
sibpair sibqtl sibvar simchi simdata
simhap simhaploid simibd simil simlogrank
simmat simnuc simpar simped simpev
simpol simtrend skipspace slash sliceprop
slprop snpenc sort_table sow sow
srank sshare stamp stand start
startone strandhet strat_freq strattyp streq
strfind string_hash subset_active sumcols_form sumped
sumplot sumstat sumsym sumucsc survtab
swap swapalleles swapg switch syminv
symtest syntaxnum tab tabgen tabhap
tabid table_cell_eq table_cell_gt table_cell_lt table_cell_ne
table_cell_string_int table_column_widths table_label tabmat tabstat
tarone tc_r_array tdtuse terpstra test_port
testage testflips_fasta testflips_map testflips_source testhap
testmap testpage testsex tetcor thetaf
thincov thinibd thischr tidydata time_since_epoch
todistmix togreg tojulian token tometasoft
toupper tp tql2 tqlrat traceplot
trans transmit transprob tred1 tred2
triprop twidl twincon twincor twinken
twinkencon twobyk twofrq twohwe twold
twopoi typeof typwords unidens uninf
uniqid uniqnam unop unsel unzipper
upchi update updateblups useld var
varcom varlevels varmet vcfcascon vcov
vcprofile vmerr weishape whall whitehead
wlscor wordfind wordpos workpointers wraff
wrall wrans wrarl wrbeagle wrbed
wrcri wrcsv wrdate wrdesc wrdot
wrfish wrform wrfpm wrfreq wrgen
wrgtp wrhbd wribd wribs wricas
wrid wrind wrinline wrinverse write_table_cell
write_vcfhash writebin writegrm writeline wrkout
wrlink wrmap wrmat wrmorg wroddall
wronep wrpap wrpercent wrpercentd wrpercentl
wrphe wrprd wrprop wrpropci wrset
wrsex wrsim wrsimq wrsimqtl wrsnp2
wrsnp3 wrsnp4 wrsnp_col wrsnp_row wrsubped
wrtab wrtrait wrvcf wrvert xmeans
xsimped xtab xtrans xy_grapheps zero_table
zerop zlib_compileflags zlib_compress zlib_inflate zlib_uncompress
zlib_version zp


compiler_version {extras}

Name of routine: compiler_version
Source lines: 50 - 53
Type function
Call compiler_version()
Moduleextras
Notes
 Sib-pair is a computer program for genetic analysis
  Author: David L Duffy 
 
  Compiler, version, linked in external libraries etc recorded here:
 
 1) GUI additions
 1a) Hooks to call JAPI (library calling AWT) 
  Java Application Programming Interface 1.0.6 (http://www.japi.de/)
  Main author: Merten Joost
  japi is an open source free software GUI toolkit, which makes it easy
  to develop platform independent applications. Written in JAVA and C,
  provides the JAVA AWT Toolkit to non object-oriented languages incl
  Fortran 77 and Fortran 90 onwards.  Development stopped in 2003

 1b) Hooks to call PILIB (library calling GTK+)
  Platform Independent Library for use with Fortran 9x
  PILIB 0.5 (http://www.sourceforge.net/projects/pilib)

 1c) Interface to EGGX/ProCALL graphics library
  X Library for use with C or Fortran 9x
  Main author: Chisato Yamauchi

 2) Interface to ZLib
 3) Unix pipes


compiler_options {extras}

Name of routine: compiler_options
Source lines: 54 - 57
Type function
Call compiler_options()
Moduleextras
Notes
 Sib-pair is a computer program for genetic analysis
  Author: David L Duffy 
 
  Compiler, version, linked in external libraries etc recorded here:
 
 1) GUI additions
 1a) Hooks to call JAPI (library calling AWT) 
  Java Application Programming Interface 1.0.6 (http://www.japi.de/)
  Main author: Merten Joost
  japi is an open source free software GUI toolkit, which makes it easy
  to develop platform independent applications. Written in JAVA and C,
  provides the JAVA AWT Toolkit to non object-oriented languages incl
  Fortran 77 and Fortran 90 onwards.  Development stopped in 2003

 1b) Hooks to call PILIB (library calling GTK+)
  Platform Independent Library for use with Fortran 9x
  PILIB 0.5 (http://www.sourceforge.net/projects/pilib)

 1c) Interface to EGGX/ProCALL graphics library
  X Library for use with C or Fortran 9x
  Main author: Chisato Yamauchi

 2) Interface to ZLib
 3) Unix pipes


fonttype {japi}

Name of routine: fonttype
Source lines: 356 - 377
Type function
Call fonttype(s)
Modulejapi
Notes

aligntype {japi}

Name of routine: aligntype
Source lines: 379 - 402
Type function
Call aligntype(s)
Modulejapi
Notes

newlin {outstream}

Name of routine: newlin
Source lines: 417 - 428
Type subroutine
Call newlin(sol, eol, pos, newpos)
Moduleoutstream
Notes
  
 format free output, adding newline if line exceeding specified length

colprint {outstream}

Name of routine: colprint
Source lines: 433 - 447
Type subroutine
Call colprint(sol, eol, string)
Moduleoutstream
Notes
 print one string, inserting newline is past r margin 
 cursor at l margin at beginning

hexdump {outstream}

Name of routine: hexdump
Source lines: 451 - 491
Type subroutine
Call hexdump(start, finish, string, offset)
Moduleoutstream
Notes
 hexdump -C 

iscomp {comp_ops}

Name of routine: iscomp
Source lines: 666 - 674
Type function
Call iscomp(op)
Modulecomp_ops
Notes
  
 determine if trait being compared to a constant, for isaff
  

compsign {comp_ops}

Name of routine: compsign
Source lines: 678 - 684
Type function
Call compsign(idx)
Modulecomp_ops
Notes
 Show comparison

docomp {comp_ops}

Name of routine: docomp
Source lines: 690 - 734
Type subroutine
Call docomp(pos, words, gt, thresh)
Modulecomp_ops
Notes
  
 parse comparison in isaff
 15='<', 16='>', 17='ge', 18='le', 19='ne', 20='eq'
 21='odd', 22='even'
  

defpro {comp_ops}

Name of routine: defpro
Source lines: 738 - 765
Type subroutine
Call defpro(gt, thresh, asnote)
Modulecomp_ops
Notes
  
 Message defining proband based on comparison
  

mapformat {genetic_maps}

Name of routine: mapformat
Source lines: 785 - 796
Type function
Call mapformat(mapunits, width)
Modulegenetic_maps
Notes
 Optimal format for writing different map units

invmap {genetic_maps}

Name of routine: invmap
Source lines: 800 - 812
Type function
Call invmap(x, mapf)
Modulegenetic_maps
Notes
  
 inverse Haldane (mapf=1) or Kosambi (mapf=2) mapping x cM to r
  

tojulian {timelib}

Name of routine: tojulian
Source lines: 838 - 852
Type function
Call tojulian(gdate)
Moduletimelib
Notes
  
 Julian and Gregorian from Peter Meyer's on-line notes:
 In 1968 in a letter to the editor of Communications of the ACM (CACM,
 volume 11, number 10, October 1968, p.657) Henry F. Fliegel and Thomas
 C. Van Flandern presented such conversion algorithms:
  
 gdate takes the form YYYYMMDD
  

togreg {timelib}

Name of routine: togreg
Source lines: 856 - 875
Type function
Call togreg(jdate)
Moduletimelib
Notes
 from Julian to Gregorian
  

getyear {timelib}

Name of routine: getyear
Source lines: 879 - 891
Type function
Call getyear(gdate)
Moduletimelib
Notes
 Gregorian date as decimal year
 

dayofweek {timelib}

Name of routine: dayofweek
Source lines: 893 - 897
Type function
Call dayofweek(jd)
Moduletimelib
Notes
 

current_time {timelib}

Name of routine: current_time
Source lines: 901 - 910
Type function
Call current_time()
Moduletimelib
Notes
 Date and time like fdate

isodate {timelib}

Name of routine: isodate
Source lines: 914 - 919
Type function
Call isodate()
Moduletimelib
Notes
 Today as ISO YYYYMMDD

time_since_epoch {timelib}

Name of routine: time_since_epoch
Source lines: 923 - 932
Type function
Call time_since_epoch()
Moduletimelib
Notes
 Current seconds since POSIX epoch excluding leap seconds

init_rng {rngs}

Name of routine: init_rng
Source lines: 950 - 963
Type subroutine
Call init_rng(iseed)
Modulerngs
Notes
 Moved initialization here 20180802, as ifort did not like
 rndseed and rng being simultaneously accessible by main

set_rng_seeds {rngs}

Name of routine: set_rng_seeds
Source lines: 965 - 974
Type subroutine
Call set_rng_seeds(i, j, k)
Modulerngs
Notes
 random number generators

get_rng_seeds {rngs}

Name of routine: get_rng_seeds
Source lines: 976 - 982
Type subroutine
Call get_rng_seeds(i, j, k)
Modulerngs
Notes
 random number generators

random {rngs}

Name of routine: random
Source lines: 990 - 997
Type function
Call random()
Modulerngs
Notes
  
 Algorithm AS 183 Appl Stat 1982; 31:188
 Returns a pseudo-random number from U(0,1)
  
 ix,iy,iz should be "randomly" initialised to 1-30000
 eg via time
  

uniqnam {rngs}

Name of routine: uniqnam
Source lines: 1012 - 1020
Type subroutine
Call uniqnam(nchar, str)
Modulerngs
Notes
 Random character string

rantri {rngs}

Name of routine: rantri
Source lines: 1024 - 1027
Type function
Call rantri()
Modulerngs
Notes
  
 Triangular random number generator
  

randn {rngs}

Name of routine: randn
Source lines: 1036 - 1058
Type function
Call randn()
Modulerngs
Notes
  
  The function RANDN() returns a normally distributed pseudo-random
  number with zero mean and unit variance.  Calls are made to a
  function subprogram RANDOM() which returns independent random
  numbers uniform in the interval (0,1).
  
  The algorithm uses the ratio of uniforms method of A.J. Kinderman
  and J.F. Monahan augmented with quadratic bounding curves.

permut {rngs}

Name of routine: permut
Source lines: 1062 - 1075
Type subroutine
Call permut(n, ia)
Modulerngs
Notes
  
 Permute the contents of an integer array
  

sampleindices {rngs}

Name of routine: sampleindices
Source lines: 1079 - 1101
Type subroutine
Call sampleindices(n, r, ia)
Modulerngs
Notes
 Sample of size r without replacement from 1..n by rejection sampling

handler {interrupt}

Name of routine: handler
Source lines: 1113 - 1121
Type function
Call handler()
Moduleinterrupt
Notes
 interrupt

handler {interrupt}

Name of routine: handler
Source lines: 1123 - 1129
Type subroutine
Call handler()
Moduleinterrupt
Notes
 interrupt

newinclude {iobuff}

Name of routine: newinclude
Source lines: 1157 - 1188
Type subroutine
Call newinclude(inctyp, keep, filnam, ioerr)
Moduleiobuff
Notes
 Input buffer, stack of input streams, prompt string etc
   ilevel=0 historical or macro command; =1 keyboard; =2,3,4 files
   toplevel=highest occupied level
   ilevold=last level, if ilevel currently 0

   incstr    stream for ith inclusion
   infil     name of file
   incaction 1=read entire stream 2=read locus information only 
             3=1+delete 

zlib_version {f95zlib}

Name of routine: zlib_version
Source lines: 1426 - 1439
Type subroutine
Call zlib_version(vstring)
Modulef95zlib
Notes
 Wrapper for zlibversion

zlib_compileflags {f95zlib}

Name of routine: zlib_compileflags
Source lines: 1443 - 1456
Type subroutine
Call zlib_compileflags()
Modulef95zlib
Notes
 Wrapper for zlibCompileFlags

zlib_compress {f95zlib}

Name of routine: zlib_compress
Source lines: 1460 - 1482
Type subroutine
Call zlib_compress(uncompressed_data, len_result, compressed_data, ios)
Modulef95zlib
Notes
 Wrapper for compress

zlib_uncompress {f95zlib}

Name of routine: zlib_uncompress
Source lines: 1486 - 1509
Type subroutine
Call zlib_uncompress(compressed_data, result_len, uncompressed_data, ios)
Modulef95zlib
Notes
 Wrapper for uncompress - default compression settings

zlib_inflate {f95zlib}

Name of routine: zlib_inflate
Source lines: 1515 - 1618
Type subroutine
Call zlib_inflate(compressed_data, windowbits, result_len, uncompressed_data, ios)
Modulef95zlib
Notes
 Wrapper for inflateInit2, inflate, inflateEnd, allowing adjustment of compress level
 This is essential for reading bgzf files
 Follows uncompress()

fgz_open {f95zlib}

Name of routine: fgz_open
Source lines: 1623 - 1652
Type subroutine
Call fgz_open(path, mode, fd, ios)
Modulef95zlib
Notes
 Wrapper for gzopen
   also reinitializes gzread's buffer

fgz_rewind {f95zlib}

Name of routine: fgz_rewind
Source lines: 1656 - 1670
Type subroutine
Call fgz_rewind(fd, ios)
Modulef95zlib
Notes
 Wrapper for gzrewind

fgz_seek {f95zlib}

Name of routine: fgz_seek
Source lines: 1674 - 1710
Type subroutine
Call fgz_seek(fd, offset, ios, offset_typ)
Modulef95zlib
Notes
 Wrapper for gzseek

fgz_read_integer {f95zlib}

Name of routine: fgz_read_integer
Source lines: 1715 - 1737
Type subroutine
Call fgz_read_integer(fd, res, ios)
Modulef95zlib
Notes
 Wrapper for gzread
   read one 32 bit integer

fgz_read_longint {f95zlib}

Name of routine: fgz_read_longint
Source lines: 1742 - 1764
Type subroutine
Call fgz_read_longint(fd, res, ios)
Modulef95zlib
Notes
 Wrapper for gzread
   read one 64 bit integer

fgz_read {f95zlib}

Name of routine: fgz_read
Source lines: 1769 - 1854
Type subroutine
Call fgz_read(fd, lin, advance, ios)
Modulef95zlib
Notes
 Wrapper for gzread
   read one line of text from buffer

fgz_write {f95zlib}

Name of routine: fgz_write
Source lines: 1858 - 1899
Type subroutine
Call fgz_write(fd, lin, advance, ios)
Modulef95zlib
Notes
 write one line of text to a gzipped textfile

fgz_error {f95zlib}

Name of routine: fgz_error
Source lines: 1903 - 1916
Type subroutine
Call fgz_error(fd)
Modulef95zlib
Notes
 Wrapper for gzerror

fgz_close {f95zlib}

Name of routine: fgz_close
Source lines: 1920 - 1928
Type subroutine
Call fgz_close(fd, ios)
Modulef95zlib
Notes
 Wrapper for gzclose

bgzf_read {bgzf}

Name of routine: bgzf_read
Source lines: 1959 - 2057
Type subroutine
Call bgzf_read(port, lin, advance,ios)
Modulebgzf
Notes
 To read bgzf format, need something like 
 bioruby-bgzf read_bgzf_block

 Read one line from BGZF file

read_bgzf_block {bgzf}

Name of routine: read_bgzf_block
Source lines: 2059 - 2146
Type subroutine
Call read_bgzf_block(strm, compressed_data, block_size, input_size, crc32, ios)
Modulebgzf
Notes
 Reading bgzipped files

* BGZF/GZIP header (specialized from RFC 1952; little endian):
 ID1 ID2 CM  FLG     MTIME       XFL OS   XLEN   SI1 SI2  SLEN
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 31|139|  8|  4|              0|  0|255|      6| 66| 67|      2|BLK_LEN|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 BGZF extension:
               ^                              ^   ^   ^
               |                              |   |   |
              FLG.EXTRA                     XLEN  B   C

 BGZF format is compatible with GZIP. It limits the size of each compressed
 block to 2^16 bytes and adds and an extra "BC" field in the gzip header which
 records the size.
 

bgzf_seek {bgzf}

Name of routine: bgzf_seek
Source lines: 2148 - 2183
Type subroutine
Call bgzf_seek(port, block_pos, virtual_offset, ios)
Modulebgzf
Notes
 Reading bgzipped files

* BGZF/GZIP header (specialized from RFC 1952; little endian):
 ID1 ID2 CM  FLG     MTIME       XFL OS   XLEN   SI1 SI2  SLEN
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 31|139|  8|  4|              0|  0|255|      6| 66| 67|      2|BLK_LEN|
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
 BGZF extension:
               ^                              ^   ^   ^
               |                              |   |   |
              FLG.EXTRA                     XLEN  B   C

 BGZF format is compatible with GZIP. It limits the size of each compressed
 block to 2^16 bytes and adds and an extra "BC" field in the gzip header which
 records the size.
 

pipe_open {f95pipes}

Name of routine: pipe_open
Source lines: 2231 - 2242
Type subroutine
Call pipe_open(command, fd, ios)
Modulef95pipes
Notes
 wrapper for popen
   fd%stat gives mode

pipe_rewind {f95pipes}

Name of routine: pipe_rewind
Source lines: 2245 - 2251
Type subroutine
Call pipe_rewind(fd, ios)
Modulef95pipes
Notes
 rewind pipe

pipe_read {f95pipes}

Name of routine: pipe_read
Source lines: 2254 - 2280
Type subroutine
Call pipe_read(fd, lin, advance, ios)
Modulef95pipes
Notes
 wrapper for fgets

pipe_write {f95pipes}

Name of routine: pipe_write
Source lines: 2283 - 2303
Type subroutine
Call pipe_write(fd, lin, advance, ios)
Modulef95pipes
Notes
 wrapper for fputs

pipe_close {f95pipes}

Name of routine: pipe_close
Source lines: 2306 - 2314
Type subroutine
Call pipe_close(fd, ios)
Modulef95pipes
Notes
 wrapper for pclose

newlun {fileio}

Name of routine: newlun
Source lines: 2336 - 2350
Type subroutine
Call newlun(strm)
Modulefileio
Notes
 Find a free Fortran style unit

isgzipped {fileio}

Name of routine: isgzipped
Source lines: 2354 - 2387
Type function
Call isgzipped(filnam)
Modulefileio
Notes
 Test if gzipped file, reading magic number 31,139,8

readbigreal {fileio}

Name of routine: readbigreal
Source lines: 2391 - 2410
Type subroutine
Call readbigreal(strm, n, vec)
Modulefileio
Notes
 Fill large real array from stream

open_port {fileio}

Name of routine: open_port
Source lines: 2414 - 2493
Type subroutine
Call open_port(filnam, port, mode, ios)
Modulefileio
Notes
 Open a (plain or gzipped) file or pipe for reading or writing

rewind_port {fileio}

Name of routine: rewind_port
Source lines: 2497 - 2517
Type subroutine
Call rewind_port(port, ios)
Modulefileio
Notes
 Reopen a file for reading or writing

seek_port {fileio}

Name of routine: seek_port
Source lines: 2521 - 2540
Type subroutine
Call seek_port(port, pos, ios)
Modulefileio
Notes
 Set (read) position in a file or stream (if possible)

port_position {fileio}

Name of routine: port_position
Source lines: 2544 - 2548
Type function
Call port_position(port)
Modulefileio
Notes
 Return position in file

readline {fileio}

Name of routine: readline
Source lines: 2552 - 2576
Type subroutine
Call readline(port, lin, advance, ios)
Modulefileio
Notes
 Read one record from file

writeline {fileio}

Name of routine: writeline
Source lines: 2580 - 2604
Type subroutine
Call writeline(port, lin, advance, ios)
Modulefileio
Notes
 Write one record to file

close_port {fileio}

Name of routine: close_port
Source lines: 2609 - 2634
Type subroutine
Call close_port(port, ios)
Modulefileio
Notes
 Close file for reading -  
   if gzipped but ZLIB not available, then delete temporary file

chfind {string_utilities}

Name of routine: chfind
Source lines: 2645 - 2669
Type function
Call chfind(string, ch)
Modulestring_utilities
Notes
 
 find an unescaped character in a string
 

alnum {string_utilities}

Name of routine: alnum
Source lines: 2674 - 2682
Type function
Call alnum(ch)
Modulestring_utilities
Notes
 functions supporting regexp
   notice alnum includes "_"

on_sow {string_utilities}

Name of routine: on_sow
Source lines: 2684 - 2698
Type function
Call on_sow(string, pos)
Modulestring_utilities
Notes
 String utilities

on_eow {string_utilities}

Name of routine: on_eow
Source lines: 2701 - 2713
Type function
Call on_eow(string, pos)
Modulestring_utilities
Notes
 word end is backward looking

strfind {string_utilities}

Name of routine: strfind
Source lines: 2719 - 2823
Type function
Call strfind(regexp, targt, nocase)
Modulestring_utilities
Notes
 
 Compare string to a search string, allowing wildcards '*.', 
 metacharacters \<, \>, simple lists of characters [ccc], 
 and case matching 
 

escape {string_utilities}

Name of routine: escape
Source lines: 2827 - 2853
Type subroutine
Call escape(str, trget)
Modulestring_utilities
Notes
 Escape a target character, usually "

toupper {string_utilities}

Name of routine: toupper
Source lines: 2857 - 2866
Type subroutine
Call toupper(str)
Modulestring_utilities
Notes
 lower to upper case alphabetic

sow {scanner}

Name of routine: sow
Source lines: 2890 - 2901
Type function
Call sow(string)
Modulescanner
Notes
 skip leading whitespace

countsep {scanner}

Name of routine: countsep
Source lines: 2906 - 2916
Type function
Call countsep(sep, s)
Modulescanner
Notes
 Test if reading a CSV file - based on whether current line contains a 
 number of likely separators

nextword {scanner}

Name of routine: nextword
Source lines: 2932 - 3052
Type subroutine
Call nextword(pos, s, eos, reserved, nword, word, stat, sep, typ)
Modulescanner
Notes
 Next token in buffer

 Need to know which word if reading pedigree or case-control data (with
 or without ID) as slashes separate alleles in data but are allowed in
 ID strings

 typ                      action
 1  SEP_WHITE             whitespace separated
 2  SEP_WH_RES            whitespace separated or reserved character (id by reserved string)
 3  SEP_WH_SLASH          whitespace or slash separated (so genotypes can be written a/b) ped data
 4  SEP_WH_SLASH_CAS      whitespace or slash separated (so genotypes can be written a/b) case data
 5  SEP_WH_SLASH_CAS_NOID whitespace or slash separated (so genotypes can be written a/b) case data, noid
 6  SEP_CHAR              character separated (eg CSV, TSV)

args {scanner}

Name of routine: args
Source lines: 3056 - 3086
Type subroutine
Call args(s, narg, arg, sep, typ)
Modulescanner
Notes
 extracts narg arguments from input string s

getword {scanner}

Name of routine: getword
Source lines: 3091 - 3126
Type subroutine
Call getword(s, which, word, sep, style)
Modulescanner
Notes
 extracts the nth whitespace or character separated argument  
  from input string s

wordpos {scanner}

Name of routine: wordpos
Source lines: 3130 - 3153
Type function
Call wordpos(s, which)
Modulescanner
Notes
 Find end of nth whitespace-separated argument in input string s

countargs {scanner}

Name of routine: countargs
Source lines: 3157 - 3178
Type function
Call countargs(s, sep, typ)
Modulescanner
Notes
 Return count of (whitespace-separated) arguments from input string s

wordfind {scanner}

Name of routine: wordfind
Source lines: 3184 - 3225
Type function
Call wordfind(target_word, s, sep, typ, exact)
Modulescanner
Notes
 Return index of first matching (whitespace-or-other-separated) word 
 in input string s
   eg wordfind('GQ','GT:AD:GQ:PL:DP',':',SEP_CHAR) => 3

getlabel {scanner}

Name of routine: getlabel
Source lines: 3229 - 3279
Type subroutine
Call getlabel(val, s, label, prefix)
Modulescanner
Notes
 Extracts the matching label for a list of value=label pairs in a string

getpairval {scanner}

Name of routine: getpairval
Source lines: 3283 - 3318
Type subroutine
Call getpairval(varnam, s, reserved, res, forward)
Modulescanner
Notes
 Extracts the value or the name from a matched name=value pair in a string

dsort {sorts}

Name of routine: dsort
Source lines: 3329 - 3448
Type subroutine
Call dsort(n, dx)
Modulesorts
Notes
 SLATEC quicksort routine.  Jones, Kahaner and Wisniewski.
 double precision
  

srank {sorts}

Name of routine: srank
Source lines: 3455 - 3621
Type subroutine
Call srank(n, x, iy)
Modulesorts
Notes
  
 SLATEC quicksort routine.  Jones, Kahaner and Wisniewski.
 here allowing for a missing value indicator, and carrying an indicator along
 pulls down the missing data.  To sort test statistics retaining a pointer
 to the variable name

isort {sorts}

Name of routine: isort
Source lines: 3627 - 3871
Type subroutine
Call isort(bot, top, ix, iy, kflag)
Modulesorts
Notes
  
 SLATEC quicksort routine.  Jones, Kahaner and Wisniewski.
 The option to sort descending has been removed, the argument order
 changed, and the sort is now from bot...top, rather than 1...top.
  

long_isort {sorts}

Name of routine: long_isort
Source lines: 3873 - 4118
Type subroutine
Call long_isort(bot, top, ix, iy, kflag)
Modulesorts
Notes
 Sorting etc
 

imultsort {sorts}

Name of routine: imultsort
Source lines: 4262 - 4285
Type subroutine
Call imultsort(nr, nc, mat, idx)
Modulesorts
Notes
 Sort a matrix by multiple keys

msdsort {sorts}

Name of routine: msdsort
Source lines: 4289 - 4312
Type subroutine
Call msdsort(bot,top,key1,key2,ord)
Modulesorts
Notes
  
 MSD radix sort key1, key2
  

setup_hash {idhash_class}

Name of routine: setup_hash
Source lines: 4333 - 4381
Type subroutine
Call setup_hash(keytyp, nrec, hashtab, load)
Moduleidhash_class
Notes
 Allocate an open addressed hash table
   number of buckets is prime
   probe using exponential hash following Muehlbacher 2004 JUCS 10: 1239-1249

cleanup_hash {idhash_class}

Name of routine: cleanup_hash
Source lines: 4385 - 4394
Type subroutine
Call cleanup_hash(hashtab)
Moduleidhash_class
Notes
 release memory held by a hash table

fill_hash {idhash_class}

Name of routine: fill_hash
Source lines: 4398 - 4415
Type subroutine
Call fill_hash(hashtab, string_array)
Moduleidhash_class
Notes
 populate hash table

insert_hash {idhash_class}

Name of routine: insert_hash
Source lines: 4419 - 4433
Type subroutine
Call insert_hash(hashtab, string, iaddress)
Moduleidhash_class
Notes
 add new element to hash table

find_hashtab {idhash_class}

Name of routine: find_hashtab
Source lines: 4437 - 4456
Type subroutine
Call find_hashtab(str, string_array, hashtab, iaddress)
Moduleidhash_class
Notes
 Search hash table

string_hash {idhash_class}

Name of routine: string_hash
Source lines: 4460 - 4471
Type function
Call string_hash(str, ibound)
Moduleidhash_class
Notes
 String hash function (that used by SRFI-64)

get_table_cell_type {table_cell_type}

Name of routine: get_table_cell_type
Source lines: 4502 - 4506
Type function
Call get_table_cell_type(x)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

copystring {table_cell_type}

Name of routine: copystring
Source lines: 4510 - 4520
Type subroutine
Call copystring(string, x)
Moduletable_cell_type
Notes
 recast

set_table_cell_type {table_cell_type}

Name of routine: set_table_cell_type
Source lines: 4522 - 4590
Type subroutine
Call set_table_cell_type(newtyp, x)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

table_cell_string_int {table_cell_type}

Name of routine: table_cell_string_int
Source lines: 4595 - 4613
Type function
Call table_cell_string_int(x)
Moduletable_cell_type
Notes
 is string and contents of string an integer
 useful for factor levels

table_cell_eq {table_cell_type}

Name of routine: table_cell_eq
Source lines: 4618 - 4644
Type function
Call table_cell_eq(x, y)
Moduletable_cell_type
Notes
 numbers precede strings in collation sequence, 
 integer-real comparisons cast former to real

table_cell_ne {table_cell_type}

Name of routine: table_cell_ne
Source lines: 4646 - 4650
Type function
Call table_cell_ne(x, y)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

table_cell_gt {table_cell_type}

Name of routine: table_cell_gt
Source lines: 4652 - 4696
Type function
Call table_cell_gt(x, y)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

table_cell_lt {table_cell_type}

Name of routine: table_cell_lt
Source lines: 4698 - 4746
Type function
Call table_cell_lt(x, y)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

set_table_cell {table_cell_type}

Name of routine: set_table_cell
Source lines: 4748 - 4771
Type subroutine
Call set_table_cell(x, ivalue, rvalue, string)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

get_table_cell {table_cell_type}

Name of routine: get_table_cell
Source lines: 4773 - 4833
Type subroutine
Call get_table_cell(x, ivalue, rvalue, string)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

tc_r_array {table_cell_type}

Name of routine: tc_r_array
Source lines: 4835 - 4842
Type subroutine
Call tc_r_array(n, xarray, rarray)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

write_table_cell {table_cell_type}

Name of routine: write_table_cell
Source lines: 4844 - 4901
Type subroutine
Call write_table_cell(strm, x, width, advance)
Moduletable_cell_type
Notes
  
 multidimensional contingency table 
  
 ncat=#dimensions of table
 ncells=#cells in table
 ntot=grand total of counts
 hits=#insertions already present in table  
 misses=#insertions not already present in table  
        used to optimize expansion of arrays
 idx=pointer to label/data for cell,
 icount=counts
 categories=workspace containing all labels/data,

 cell categories are stored as type table_cell:
  

setup_table {contingency_table}

Name of routine: setup_table
Source lines: 4922 - 4941
Type subroutine
Call setup_table(ncat, maxcells, table)
Modulecontingency_table
Notes
 allocate space for contingency table

zero_table {contingency_table}

Name of routine: zero_table
Source lines: 4945 - 4956
Type subroutine
Call zero_table(table)
Modulecontingency_table
Notes
 zero table for reuse

clean_table {contingency_table}

Name of routine: clean_table
Source lines: 4960 - 4971
Type subroutine
Call clean_table(table)
Modulecontingency_table
Notes
 deallocate space

expand_table {contingency_table}

Name of routine: expand_table
Source lines: 4975 - 5000
Type subroutine
Call expand_table(nextra, table)
Modulecontingency_table
Notes
 increase available space

set_table_colname {contingency_table}

Name of routine: set_table_colname
Source lines: 5004 - 5009
Type subroutine
Call set_table_colname(icol, colnam, table)
Modulecontingency_table
Notes
 insert colname 

insert_table {contingency_table}

Name of routine: insert_table
Source lines: 5013 - 5024
Type subroutine
Call insert_table(ncat, rvalues, table, iwt)
Modulecontingency_table
Notes
 insert data

insert_table_cells {contingency_table}

Name of routine: insert_table_cells
Source lines: 5026 - 5090
Type subroutine
Call insert_table_cells(ncat, values, table, iwt, slot)
Modulecontingency_table
Notes

search_table {contingency_table}

Name of routine: search_table
Source lines: 5094 - 5136
Type function
Call search_table(ncat, values, table)
Modulecontingency_table
Notes
 Search table

incr_table {contingency_table}

Name of routine: incr_table
Source lines: 5140 - 5146
Type subroutine
Call incr_table(pos, table, iwt)
Modulecontingency_table
Notes
 Increment cell count if correct address already available

table_column_widths {contingency_table}

Name of routine: table_column_widths
Source lines: 5150 - 5175
Type subroutine
Call table_column_widths(table, widths)
Modulecontingency_table
Notes
 print a table

print_table {contingency_table}

Name of routine: print_table
Source lines: 5177 - 5206
Type subroutine
Call print_table(table)
Modulecontingency_table
Notes

marginal_table {contingency_table}

Name of routine: marginal_table
Source lines: 5210 - 5227
Type subroutine
Call marginal_table(nmargin, margin, table, martable)
Modulecontingency_table
Notes
 fill a table with marginal counts from another table

flat_table {contingency_table}

Name of routine: flat_table
Source lines: 5232 - 5277
Type subroutine
Call flat_table(mtable1, mtable2, table, mat)
Modulecontingency_table
Notes
 Convert table counts to a R (dim1 x dim2 ..x dimN-1) x C (dimN) matrix 
 so mtable1 is marginal table for vars 1..nloc-1, mtable2 is univariate

dim_table {contingency_table}

Name of routine: dim_table
Source lines: 5281 - 5294
Type function
Call dim_table(margin, table)
Modulecontingency_table
Notes
 get dimension of a margin

sort_table {contingency_table}

Name of routine: sort_table
Source lines: 5298 - 5310
Type subroutine
Call sort_table(cat, table)
Modulecontingency_table
Notes
 reorder values in 1-D table to match order in table index

findlev_cell {contingency_table}

Name of routine: findlev_cell
Source lines: 5314 - 5343
Type function
Call findlev_cell(val, table)
Modulecontingency_table
Notes
 factor level based on position in (marginal) 1-D table

findlev {contingency_table}

Name of routine: findlev
Source lines: 5347 - 5371
Type function
Call findlev(val, table)
Modulecontingency_table
Notes
 
 legacy real specific

findrank_cell {contingency_table}

Name of routine: findrank_cell
Source lines: 5375 - 5399
Type function
Call findrank_cell(val, table)
Modulecontingency_table
Notes
 find rank based on position in 1-D table

findrank {contingency_table}

Name of routine: findrank
Source lines: 5403 - 5422
Type function
Call findrank(val, table)
Modulecontingency_table
Notes
 legacy real specific

show_one_iarray {showcomponent}

Name of routine: show_one_iarray
Source lines: 5429 - 5441
Type subroutine
Call show_one_iarray(nam, sep, sta, fin, isall, array)
Moduleshowcomponent
Notes
 Utilities to print arrays

show_one_carray {showcomponent}

Name of routine: show_one_carray
Source lines: 5443 - 5455
Type subroutine
Call show_one_carray(nam, sep, sta, fin, isall, array)
Moduleshowcomponent
Notes
 Utilities to print arrays

show_one_farray {showcomponent}

Name of routine: show_one_farray
Source lines: 5457 - 5469
Type subroutine
Call show_one_farray(nam, sep, sta, fin, isall, array)
Moduleshowcomponent
Notes
 Utilities to print arrays

loccode {locus_types}

Name of routine: loccode
Source lines: 5505 - 5532
Type function
Call loccode(ch)
Modulelocus_types
Notes
 Locus types bitpatterns
 loctyp Compression_scheme Deleted Marker: Autosomal X-marker Haploid Y-chrom / Affection Quantitative
        CC D T  
 1      00 0 0 001 Autosomal marker
 2      00 0 0 010 X-chromosome marker
 4      00 0 0 100 Haploid unspecified
 5      00 0 0 101 Mitochondrial marker
 6      00 0 0 110 Y-Chromosome marker
 8      00 0 1 000 Trait unspecified
 9      00 0 1 001 Quantitative trait
 10     00 0 1 010 Binary trait
 11     00 0 1 011 Categorical trait
 12     00 0 1 100 Special trait (computed)

same_loctyp {locus_types}

Name of routine: same_loctyp
Source lines: 5536 - 5552
Type function
Call same_loctyp(loctyp, reftyp)
Modulelocus_types
Notes
 same locus type or same class, ignoring compression type but not where dropped

isactive {locus_types}

Name of routine: isactive
Source lines: 5554 - 5558
Type function
Call isactive(loctyp)
Modulelocus_types
Notes
 is an active variable

istrait {locus_types}

Name of routine: istrait
Source lines: 5560 - 5564
Type function
Call istrait(loctyp)
Modulelocus_types
Notes
 trait - active

isspecial {locus_types}

Name of routine: isspecial
Source lines: 5566 - 5570
Type function
Call isspecial(loctyp)
Modulelocus_types
Notes
 calculated trait

isqtrait {locus_types}

Name of routine: isqtrait
Source lines: 5572 - 5576
Type function
Call isqtrait(loctyp)
Modulelocus_types
Notes
 quantitative trait

iscattrait {locus_types}

Name of routine: iscattrait
Source lines: 5578 - 5582
Type function
Call iscattrait(loctyp)
Modulelocus_types
Notes
 categorical trait - active

ismarker {locus_types}

Name of routine: ismarker
Source lines: 5584 - 5588
Type function
Call ismarker(loctyp)
Modulelocus_types
Notes
 marker - inactive or active

gencode {locus_types}

Name of routine: gencode
Source lines: 5590 - 5594
Type function
Call gencode(loctyp)
Modulelocus_types
Notes
 genotype encoding 1=standard 2=sequence 3=compressed SNP

ishaploid {locus_types}

Name of routine: ishaploid
Source lines: 5596 - 5600
Type function
Call ishaploid(loctyp)
Modulelocus_types
Notes
 is a haploid locus

iscompressed {locus_types}

Name of routine: iscompressed
Source lines: 5602 - 5606
Type function
Call iscompressed(loctyp)
Modulelocus_types
Notes
 is genotype storage compact (gencode > 1)

isactdip {locus_types}

Name of routine: isactdip
Source lines: 5608 - 5612
Type function
Call isactdip(loctyp)
Modulelocus_types
Notes
 most association/linkage procedures are for active diploid codominant markers

iseligiblemarker {locus_types}

Name of routine: iseligiblemarker
Source lines: 5614 - 5624
Type function
Call iseligiblemarker(loctyp, choice, active)
Modulelocus_types
Notes
 eligible for a keep or drop

make_lochash {lochash_class}

Name of routine: make_lochash
Source lines: 5641 - 5665
Type subroutine
Call make_lochash(nloci, loc, lochash)
Modulelochash_class
Notes
 Locus name hash table

insert_lochash {lochash_class}

Name of routine: insert_lochash
Source lines: 5669 - 5687
Type subroutine
Call insert_lochash(str, nloci, loc, lochash)
Modulelochash_class
Notes
 append most recent locus to hash table

show_lochash {lochash_class}

Name of routine: show_lochash
Source lines: 5689 - 5698
Type subroutine
Call show_lochash(nloci, lochash)
Modulelochash_class
Notes
 Locus name hash table

make_maphash {lochash_class}

Name of routine: make_maphash
Source lines: 5702 - 5733
Type subroutine
Call make_maphash(nloci, loctyp, group, map, map_str, maphash)
Modulelochash_class
Notes
 hash map position 'chr:bp'

setup_loci {locus_data}

Name of routine: setup_loci
Source lines: 5790 - 5806
Type subroutine
Call setup_loci(n)
Modulelocus_data
Notes
 Allocate storage for locus descriptions

setup_auto {locus_data}

Name of routine: setup_auto
Source lines: 5810 - 5844
Type subroutine
Call setup_auto()
Modulelocus_data
Notes
 Initialize automatic variables
 

count_specials {locus_data}

Name of routine: count_specials
Source lines: 5848 - 5859
Type subroutine
Call count_specials(nvars)
Modulelocus_data
Notes
 Count number of automatic variables (eg interrogate old binary images)

cleanup_loci {locus_data}

Name of routine: cleanup_loci
Source lines: 5863 - 5868
Type subroutine
Call cleanup_loci()
Modulelocus_data
Notes
 Deallocate storage for locus descriptions

expand_loci {locus_data}

Name of routine: expand_loci
Source lines: 5872 - 5915
Type subroutine
Call expand_loci(nextra, plevel)
Modulelocus_data
Notes
 Expand arrays for locus descriptions

insloc {locus_data}

Name of routine: insloc
Source lines: 5920 - 5931
Type subroutine
Call insloc(pos)
Modulelocus_data
Notes
  
 insert a locus into the locus list
 other details of the slot are left blank
  

setupmer {locus_data}

Name of routine: setupmer
Source lines: 5935 - 5963
Type subroutine
Call setupmer(port, plevel)
Modulelocus_data
Notes
 Preallocate arrays for locus descriptions from MERLIN locus file

setup_plink {locus_data}

Name of routine: setup_plink
Source lines: 5967 - 5988
Type subroutine
Call setup_plink(port, nmark, newsiz, typ)
Modulelocus_data
Notes
 Allocate arrays for locus descriptions from PLINK .map file

setup_stat {locus_data}

Name of routine: setup_stat
Source lines: 5996 - 6004
Type subroutine
Call setup_stat(comment, typ)
Modulelocus_data
Notes
 initialize locstat (stores test statistic for each locus)
 locstat_typ is type of statistic: 
   0 = P-value
   1 = continuous
   2 = categorical

show_locus_allocation {locus_data}

Name of routine: show_locus_allocation
Source lines: 6008 - 6032
Type subroutine
Call show_locus_allocation(first, last)
Modulelocus_data
Notes
 Diagnostics for locus structure

newloctyp {locus_data}

Name of routine: newloctyp
Source lines: 6034 - 6047
Type subroutine
Call newloctyp()
Modulelocus_data
Notes
 Old to new locus types

gettrait {locus_list}

Name of routine: gettrait
Source lines: 6058 - 6109
Type subroutine
Call gettrait(nam, typ1, typ2, nloci, loc, lochash, loctyp, trait, plevel)
Modulelocus_list
Notes
  
 determine if word is name of a trait locus
  

isinuse {locus_list}

Name of routine: isinuse
Source lines: 6113 - 6148
Type function
Call isinuse(namechek, string, loc, lochash)
Modulelocus_list
Notes
  
 check if name is not already used or reserved
  

getbin {locus_list}

Name of routine: getbin
Source lines: 6152 - 6189
Type subroutine
Call getbin(sta, fin, words, nloci, loc, lochash, loctyp, trait, gt, thresh)
Modulelocus_list
Notes
  
 Get a single binary trait or dichotomized quantitative trait
  

loadnam {locus_list}

Name of routine: loadnam
Source lines: 6199 - 6395
Type subroutine
Call loadnam(sta, fin, words, nloci, loc, lochash, loctyp, group, map, locstat, chosen, nterms, terms, filter, typ)
Modulelocus_list
Notes
 
 Load list of traits into an array

 allows wild cards and spans
 filter= selection must also be of class eg LOC_CODOM, LOC_ANY
 typ=1 active loci, =2 inactive loci, =3 all loci (used by ls etc)

 output both as list (terms) and as index vector (chosen)
 

neighbours {locus_list}

Name of routine: neighbours
Source lines: 6399 - 6428
Type subroutine
Call neighbours(idx, dir, nreq, nloci, loctyp, chosen)
Modulelocus_list
Notes
 Nearest neighbours in locus list of same type
 

actlist {locus_list}

Name of routine: actlist
Source lines: 6432 - 6462
Type subroutine
Call actlist(typ, nloci, loctyp, nchosen, chosen)
Modulelocus_list
Notes
 All active/inactive

search_annot {locus_list}

Name of routine: search_annot
Source lines: 6466 - 6504
Type subroutine
Call search_annot(sta, fin, words, nloci, locnotes, chosen, nterms, terms)
Modulelocus_list
Notes
 Select loci based on search of annotations

search_chrom {locus_list}

Name of routine: search_chrom
Source lines: 6508 - 6545
Type subroutine
Call search_chrom(sta, fin, words, nloci, group, chosen, nterms, terms)
Modulelocus_list
Notes
 Select loci based on chromosome

listloci {locus_list}

Name of routine: listloci
Source lines: 6550 - 6670
Type subroutine
Call listloci(nord, locord, nloci, loc, loctyp, outpos, locnotes, typ, prompt, plevel)
Modulelocus_list
Notes
 List loci using short (typ=2) or long (typ=1) form
   plevel < -1 will give a simple list of names

cntclasses {locus_list}

Name of routine: cntclasses
Source lines: 6674 - 6711
Type subroutine
Call cntclasses(nloci, loctyp)
Modulelocus_list
Notes
  
 Output counts of class of loci
  

cntmark {locus_list}

Name of routine: cntmark
Source lines: 6715 - 6742
Type subroutine
Call cntmark(nloci, loctyp, nmark, typ)
Modulelocus_list
Notes
  
 Count active codominant markers or active loci
  

findmk {locus_list}

Name of routine: findmk
Source lines: 6746 - 6764
Type function
Call findmk(sta, fin, loctyp)
Modulelocus_list
Notes
  
 Find next active codominant marker in list
  

findml {locus_list}

Name of routine: findml
Source lines: 6768 - 6784
Type function
Call findml(nord, locord, loctyp)
Modulelocus_list
Notes
  
 Find first codominant or haploid marker in list
  

ldlist {locus_list}

Name of routine: ldlist
Source lines: 6789 - 6837
Type subroutine
Call ldlist(typ, loc1, loc2, nloci, loctyp, last)
Modulelocus_list
Notes
 produce next pair of markers from:
     1. named pair 2. One named 3. map order 4. all pairs 10. empty

matrix_set_bufwidth {matrix_class}

Name of routine: matrix_set_bufwidth
Source lines: 6888 - 6903
Type subroutine
Call matrix_set_bufwidth(bufwidth)
Modulematrix_class
Notes
 Create a matrix container

matrix_create {matrix_class}

Name of routine: matrix_create
Source lines: 6905 - 6951
Type subroutine
Call matrix_create(nr, nc, a, astat, setbufwidth)
Modulematrix_class
Notes
 A container for large (dense) matrices that can keep them as
 random access files and buffer a subset of columns in memory

matrix_zero {matrix_class}

Name of routine: matrix_zero
Source lines: 6955 - 6974
Type subroutine
Call matrix_zero(a)
Modulematrix_class
Notes
 zero a matrix

matrix_copy {matrix_class}

Name of routine: matrix_copy
Source lines: 6978 - 7051
Type subroutine
Call matrix_copy(a, b, iflag, newrows, newcols, setbufwidth)
Modulematrix_class
Notes
 Copy a matrix container (a -> b)

matrix_destroy {matrix_class}

Name of routine: matrix_destroy
Source lines: 7055 - 7069
Type subroutine
Call matrix_destroy(a)
Modulematrix_class
Notes
  
 Destroy a matrix container

matrix_active {matrix_class}

Name of routine: matrix_active
Source lines: 7073 - 7077
Type function
Call matrix_active(a)
Modulematrix_class
Notes
 Test if matrix allocated/active

matrix_size {matrix_class}

Name of routine: matrix_size
Source lines: 7081 - 7089
Type function
Call matrix_size(a)
Modulematrix_class
Notes
  
 Size of matrix in container

matrix_nrows {matrix_class}

Name of routine: matrix_nrows
Source lines: 7093 - 7098
Type function
Call matrix_nrows(a)
Modulematrix_class
Notes
 Number of matrix rows accessor

matrix_ncols {matrix_class}

Name of routine: matrix_ncols
Source lines: 7102 - 7107
Type function
Call matrix_ncols(a)
Modulematrix_class
Notes
 Number of matrix cols accessor

matrix_type {matrix_class}

Name of routine: matrix_type
Source lines: 7111 - 7116
Type function
Call matrix_type(a)
Modulematrix_class
Notes
 Matrix storage type

matrix_write {matrix_class}

Name of routine: matrix_write
Source lines: 7120 - 7160
Type subroutine
Call matrix_write(a, stream, iflag)
Modulematrix_class
Notes
 Write a matrix

matrix_write_row {matrix_class}

Name of routine: matrix_write_row
Source lines: 7165 - 7186
Type subroutine
Call matrix_write_row(irow, a, stream)
Modulematrix_class
Notes
 Write one row of a matrix to an open stream, 
 needed by disjoin, nuclear etc

matrix_write_filtered_row {matrix_class}

Name of routine: matrix_write_filtered_row
Source lines: 7190 - 7215
Type subroutine
Call matrix_write_filtered_row(irow, a, ncols, cols, stream)
Modulematrix_class
Notes
 Write selected elements of one row

matrix_read {matrix_class}

Name of routine: matrix_read
Source lines: 7219 - 7238
Type subroutine
Call matrix_read(stream, a, iflag)
Modulematrix_class
Notes
 Read a matrix

matrix_read_unformatted {matrix_class}

Name of routine: matrix_read_unformatted
Source lines: 7242 - 7260
Type subroutine
Call matrix_read_unformatted(stream, nr, nc, a, iflag)
Modulematrix_class
Notes
 Fill a matrix container from a unformatted stream

matrix_read_contents {matrix_class}

Name of routine: matrix_read_contents
Source lines: 7264 - 7327
Type subroutine
Call matrix_read_contents(stream, a, iflag)
Modulematrix_class
Notes
 Read in actual contents of matrix

matrix_read_row {matrix_class}

Name of routine: matrix_read_row
Source lines: 7332 - 7360
Type subroutine
Call matrix_read_row(stream, irow, a)
Modulematrix_class
Notes
 Read one row of a matrix from an open stream, 
 was written row major by matrix_write_row

matrix_set_row {matrix_class}

Name of routine: matrix_set_row
Source lines: 7364 - 7411
Type subroutine
Call matrix_set_row(ivals, irow, a, iflag)
Modulematrix_class
Notes
 Set row

matrix_get_row {matrix_class}

Name of routine: matrix_get_row
Source lines: 7415 - 7448
Type subroutine
Call matrix_get_row(a, irow, ivals, iflag)
Modulematrix_class
Notes
 Get row

matrix_copy_row {matrix_class}

Name of routine: matrix_copy_row
Source lines: 7452 - 7481
Type subroutine
Call matrix_copy_row(rowa, a, rowb, b, iflag)
Modulematrix_class
Notes
 Copy row 

matrix_set_col {matrix_class}

Name of routine: matrix_set_col
Source lines: 7485 - 7532
Type subroutine
Call matrix_set_col(ivals, icol, a, iflag)
Modulematrix_class
Notes
 Set col

matrix_get_col {matrix_class}

Name of routine: matrix_get_col
Source lines: 7536 - 7570
Type subroutine
Call matrix_get_col(a, icol, ivals, iflag)
Modulematrix_class
Notes
 Get col: updates column buffer

matrix_set_el {matrix_class}

Name of routine: matrix_set_el
Source lines: 7574 - 7596
Type subroutine
Call matrix_set_el(ival, irow, icol, a, iflag)
Modulematrix_class
Notes
 Set element: updates column buffer as well if current

matrix_get_el {matrix_class}

Name of routine: matrix_get_el
Source lines: 7600 - 7639
Type subroutine
Call matrix_get_el(irow, icol, a, ival, iflag)
Modulematrix_class
Notes
 Get element: updates column buffer

matrix_print {matrix_class}

Name of routine: matrix_print
Source lines: 7643 - 7671
Type subroutine
Call matrix_print(a)
Modulematrix_class
Notes
 Print matrix

openvcf {vcftools}

Name of routine: openvcf
Source lines: 7681 - 7715
Type subroutine
Call openvcf(filnam, port, lin, stat)
Modulevcftools
Notes
 Open VCF file and read metainformation

metavcf_vars {vcftools}

Name of routine: metavcf_vars
Source lines: 7720 - 7788
Type subroutine
Call metavcf_vars(port, lin, infovars, stat, plevel)
Modulevcftools
Notes
 Count or check INFO variables are declared in heading VCF file
 infovars contains comma separated list of variables that should be present

increment_vcfcounts {vcftools}

Name of routine: increment_vcfcounts
Source lines: 7792 - 7816
Type subroutine
Call increment_vcfcounts(mappos, refallele, othallele, filter, info, newchrom, lastpos, sorted, mapstart, mapend, nmar, nindel, npass, nstruct)
Modulevcftools
Notes
 Update various summaries about VCF file

count_vcflines {vcftools}

Name of routine: count_vcflines
Source lines: 7820 - 7846
Type subroutine
Call count_vcflines(filnam, nlines)
Modulevcftools
Notes
 Just number of loci

queryvcf {vcftools}

Name of routine: queryvcf
Source lines: 7855 - 8137
Type subroutine
Call queryvcf(filnam, addloci, numloc, offset, plevel)
Modulevcftools
Notes
 Basic descriptives
   addloci=2: declare loci
   chrcode=1: standard codes for chromosomes, number, X, Y, Mt
           2: and, 23=X 24=Y 25=PAR 26=Mit
   offset   : usually 0, but ANNOVAR appends data after annotations
              so offset=51 for the examples I have

rdvcf {vcftools}

Name of routine: rdvcf
Source lines: 8143 - 8265
Type subroutine
Call rdvcf(port, chrcode, nmark, selchrom, mapstart, mapend, numloc, offset)
Modulevcftools
Notes
 Declare markers read from VCF file
   CHROM POS ID REF ALT QUAL FILTER INFO
   chrcode=2 if numeric X,Y,Mit

querytbi {vcftools}

Name of routine: querytbi
Source lines: 8268 - 8368
Type subroutine
Call querytbi(filnam, plevel)
Modulevcftools
Notes
 tabix or tribble index file

info_description {vcftools}

Name of routine: info_description
Source lines: 8372 - 8444
Type subroutine
Call info_description(nvars, vars, varsubsep, slin, nfound, ninfovars, ninfosubvars, plevel)
Modulevcftools
Notes
 Read and find INFO variable description

extract_annotation {vcftools}

Name of routine: extract_annotation
Source lines: 8448 - 8504
Type subroutine
Call extract_annotation(nvars, vars, varsubsep, slin, res)
Modulevcftools
Notes
 Extract VCF INFO variables from line

getvcfanno {vcftools}

Name of routine: getvcfanno
Source lines: 8511 - 8648
Type subroutine
Call getvcfanno(typ, filnam, nterms, terms, plevel)
Modulevcftools
Notes
 (re)scan VCF file and extract INFO variable data to locnotes (typ=1) or
 locstats (typ=2)
 include ability to extract nth value from an ANNOVAR type list variable
 In files I am currently dealing with, this variable is CSQ

make_vcfhash {vcfhash_class}

Name of routine: make_vcfhash
Source lines: 8675 - 8821
Type subroutine
Call make_vcfhash(filnam, vcfhash, plevel, offset)
Modulevcfhash_class
Notes
 hash VCF file by locus name

write_vcfhash {vcfhash_class}

Name of routine: write_vcfhash
Source lines: 8823 - 8862
Type subroutine
Call write_vcfhash(filnam, vcfhash)
Modulevcfhash_class
Notes
 hash VCF file by locus name

read_vcfhash {vcfhash_class}

Name of routine: read_vcfhash
Source lines: 8864 - 8951
Type subroutine
Call read_vcfhash(filnam, vcfhash, plevel)
Modulevcfhash_class
Notes
 hash VCF file by locus name

check_vcfhash {vcfhash_class}

Name of routine: check_vcfhash
Source lines: 8953 - 9042
Type subroutine
Call check_vcfhash(vcfhash, plevel)
Modulevcfhash_class
Notes
 hash VCF file by locus name

search_vcfhash {vcfhash_class}

Name of routine: search_vcfhash
Source lines: 9044 - 9104
Type subroutine
Call search_vcfhash(ntrget, trget, vcfhash)
Modulevcfhash_class
Notes
 hash VCF file by locus name

getvcfanno2 {vcfhash_class}

Name of routine: getvcfanno2
Source lines: 9108 - 9215
Type subroutine
Call getvcfanno2(typ, nterms, terms, vcfhash, plevel)
Modulevcfhash_class
Notes
 Get annotation from hashed VCF file

get_varinfo {gtftools}

Name of routine: get_varinfo
Source lines: 9222 - 9260
Type subroutine
Call get_varinfo(lin, locnam, refall, altall)
Modulegtftools
Notes
           
 GTF (GFF, GVF)
           

open_fasta {fastatools}

Name of routine: open_fasta
Source lines: 9288 - 9340
Type subroutine
Call open_fasta(fil, fasta_container, stat)
Modulefastatools
Notes
 FASTA .fa and .fai index file
 .fai contains 5 tab-delimited fields per record (made by faidx):

 NAME	     Name of this reference sequence
 LENGTH     Total length of this reference sequence, in bases
 OFFSET     Offset within the FASTA file of this sequence's first base
 LINEBASES  The number of bases on each line, usually 60
 LINEWIDTH  The number of bytes in each line, including the newline
 
 .fa file is description string (one line), then corresponding sequence

close_fasta {fastatools}

Name of routine: close_fasta
Source lines: 9342 - 9350
Type subroutine
Call close_fasta(fasta_container)
Modulefastatools
Notes
 FASTA .fa and .fai index file
 .fai contains 5 tab-delimited fields per record (made by faidx):

 NAME	     Name of this reference sequence
 LENGTH     Total length of this reference sequence, in bases
 OFFSET     Offset within the FASTA file of this sequence's first base
 LINEBASES  The number of bases on each line, usually 60
 LINEWIDTH  The number of bytes in each line, including the newline
 
 .fa file is description string (one line), then corresponding sequence

get_fastaref {fastatools}

Name of routine: get_fastaref
Source lines: 9354 - 9392
Type subroutine
Call get_fastaref(group, bp, fasta_container, refall)
Modulefastatools
Notes
 Retrieve reference sequence at given position

show_fasta {fastatools}

Name of routine: show_fasta
Source lines: 9396 - 9425
Type subroutine
Call show_fasta(fasta_container, plevel)
Modulefastatools
Notes
 
 summary of FASTA file

query_fastaseq {fastatools}

Name of routine: query_fastaseq
Source lines: 9429 - 9465
Type subroutine
Call query_fastaseq(fil, mappos, seqlen)
Modulefastatools
Notes
 wrapper for get_fastaref

query_fasta {fastatools}

Name of routine: query_fasta
Source lines: 9469 - 9479
Type subroutine
Call query_fasta(fil, plevel)
Modulefastatools
Notes
 wrapper for show_fasta

index_fasta {fastatools}

Name of routine: index_fasta
Source lines: 9483 - 9569
Type subroutine
Call index_fasta(fil, stat)
Modulefastatools
Notes
 Make an faindex type index file

genofile_create {genofile_class}

Name of routine: genofile_create
Source lines: 9592 - 9603
Type subroutine
Call genofile_create(filnam, f)
Modulegenofile_class
Notes
 an object representing genotype data in a file

genofile_destroy {genofile_class}

Name of routine: genofile_destroy
Source lines: 9605 - 9613
Type subroutine
Call genofile_destroy(f)
Modulegenofile_class
Notes
 an object representing genotype data in a file

genofile_active {genofile_class}

Name of routine: genofile_active
Source lines: 9617 - 9621
Type function
Call genofile_active(f)
Modulegenofile_class
Notes
 Test if matrix allocated/active

setup_peds {ped_class}

Name of routine: setup_peds
Source lines: 9686 - 9788
Type subroutine
Call setup_peds(nped, nobs, numloc, numcol, dataset, astat, plevel)
Moduleped_class
Notes
 allocate pedigree data

copy_peds {ped_class}

Name of routine: copy_peds
Source lines: 9792 - 9831
Type subroutine
Call copy_peds(set1, set2)
Moduleped_class
Notes
 copy pedigree data

cleanup_peds {ped_class}

Name of routine: cleanup_peds
Source lines: 9835 - 9866
Type subroutine
Call cleanup_peds(dataset)
Moduleped_class
Notes
 deallocate pedigree structure arrays

expand_pheno {ped_class}

Name of routine: expand_pheno
Source lines: 9870 - 9892
Type subroutine
Call expand_pheno(newcol, dataset, astat)
Moduleped_class
Notes
 expand phenotype storage

expand_geno {ped_class}

Name of routine: expand_geno
Source lines: 9896 - 9942
Type subroutine
Call expand_geno(newcol, dataset, astat)
Moduleped_class
Notes
 expand genotype storage

expand_sgeno {ped_class}

Name of routine: expand_sgeno
Source lines: 9946 - 9990
Type subroutine
Call expand_sgeno(newcol, dataset, astat)
Moduleped_class
Notes
 expand SNP storage

get_geno {ped_class}

Name of routine: get_geno
Source lines: 9994 - 10039
Type subroutine
Call get_geno(idx, gcol1, gcol2, dataset, g1, g2)
Moduleped_class
Notes
 Extract a genotype either stored as alleles or SNP genotypes

encode_geno1 {ped_class}

Name of routine: encode_geno1
Source lines: 10044 - 10061
Type subroutine
Call encode_geno1(g1, g2, ig1, ig2)
Moduleped_class
Notes
 Transfer genotype to internal coding
 if snptyp = 1, then one allele per byte

encode_geno2 {ped_class}

Name of routine: encode_geno2
Source lines: 10066 - 10094
Type subroutine
Call encode_geno2(g1, g2, ig, whichpos)
Moduleped_class
Notes
 Transfer genotype to internal coding
 if snptyp = 2, then one genotype per byte

set_geno {ped_class}

Name of routine: set_geno
Source lines: 10098 - 10121
Type subroutine
Call set_geno(idx, gcol1, gcol2, dataset, g1, g2)
Moduleped_class
Notes
 Set a genotype

observed {ped_class}

Name of routine: observed
Source lines: 10125 - 10145
Type function
Call observed(idx, gcol, dataset)
Moduleped_class
Notes
 Test if genotype is observed

missing {ped_class}

Name of routine: missing
Source lines: 10147 - 10172
Type function
Call missing(idx, gcol, dataset)
Moduleped_class
Notes

show_ped_allocation {ped_class}

Name of routine: show_ped_allocation
Source lines: 10174 - 10251
Type subroutine
Call show_ped_allocation(dataset)
Moduleped_class
Notes

show_snp {ped_class}

Name of routine: show_snp
Source lines: 10253 - 10273
Type subroutine
Call show_snp(idx, gpos, dataset)
Moduleped_class
Notes

setup_freq {alleles_class}

Name of routine: setup_freq
Source lines: 10315 - 10322
Type subroutine
Call setup_freq(nall, allele_buffer)
Modulealleles_class
Notes
 initialize allele_data

copyfreq {alleles_class}

Name of routine: copyfreq
Source lines: 10326 - 10348
Type subroutine
Call copyfreq(allele_buffer, allele_buffer2)
Modulealleles_class
Notes
 Copy allele frequency data from one structure to another

expand_alleles {alleles_class}

Name of routine: expand_alleles
Source lines: 10352 - 10375
Type subroutine
Call expand_alleles(allele_buffer, nextra)
Modulealleles_class
Notes
 expand size of an allele frequency structure

cleanup_alleles {alleles_class}

Name of routine: cleanup_alleles
Source lines: 10379 - 10401
Type subroutine
Call cleanup_alleles(allele_buffer)
Modulealleles_class
Notes
 release memory held by an allele frequency structure

genot {alleles_class}

Name of routine: genot
Source lines: 10405 - 10419
Type subroutine
Call genot(allele_buffer, gfrq)
Modulealleles_class
Notes
  
 produce genotype frequencies for Metropolis algorithm
  

calc_gtp_freqs {alleles_class}

Name of routine: calc_gtp_freqs
Source lines: 10422 - 10440
Type subroutine
Call calc_gtp_freqs(allele_buffer)
Modulealleles_class
Notes
 or for sequential imputation

calc_naive_freq_ase {alleles_class}

Name of routine: calc_naive_freq_ase
Source lines: 10444 - 10457
Type subroutine
Call calc_naive_freq_ase(allele_buffer)
Modulealleles_class
Notes
 naive standard errors for allele frequencies

is_a {nucleotides}

Name of routine: is_a
Source lines: 10483 - 10487
Type function
Call is_a(g)
Modulenucleotides
Notes
 each nucleotide

is_c {nucleotides}

Name of routine: is_c
Source lines: 10488 - 10492
Type function
Call is_c(g)
Modulenucleotides
Notes
 each nucleotide

is_g {nucleotides}

Name of routine: is_g
Source lines: 10493 - 10497
Type function
Call is_g(g)
Modulenucleotides
Notes
 each nucleotide

is_t {nucleotides}

Name of routine: is_t
Source lines: 10498 - 10502
Type function
Call is_t(g)
Modulenucleotides
Notes
 each nucleotide

flip_atgc {nucleotides}

Name of routine: flip_atgc
Source lines: 10506 - 10514
Type function
Call flip_atgc(g)
Modulenucleotides
Notes
 complement nucleotide: all

flip_ac {nucleotides}

Name of routine: flip_ac
Source lines: 10518 - 10524
Type function
Call flip_ac(g)
Modulenucleotides
Notes
 complement nucleotide: AC 

flip_ag {nucleotides}

Name of routine: flip_ag
Source lines: 10528 - 10534
Type function
Call flip_ag(g)
Modulenucleotides
Notes
 complement nucleotide: AG 

flip_ct {nucleotides}

Name of routine: flip_ct
Source lines: 10538 - 10544
Type function
Call flip_ct(g)
Modulenucleotides
Notes
 complement nucleotide: CT 

flip_gt {nucleotides}

Name of routine: flip_gt
Source lines: 10548 - 10554
Type function
Call flip_gt(g)
Modulenucleotides
Notes
 complement nucleotide: GT 

nttonum {nucleotides}

Name of routine: nttonum
Source lines: 10558 - 10571
Type function
Call nttonum(g)
Modulenucleotides
Notes
 number code nucleotide

numtont {nucleotides}

Name of routine: numtont
Source lines: 10575 - 10583
Type function
Call numtont(g)
Modulenucleotides
Notes
 number code nucleotide

isntcode {nucleotides}

Name of routine: isntcode
Source lines: 10591 - 10605
Type function
Call isntcode(g)
Modulenucleotides
Notes
 test if locus has only nucleotide alleles in consistent encoding
   0 = no
   1 = (1,2,3,4)
   2 = (A,C,G,T)
   3 = (a,c,g,t)

allntcode {nucleotides}

Name of routine: allntcode
Source lines: 10607 - 10639
Type function
Call allntcode(typ, gene, dataset)
Modulenucleotides
Notes
 Routines to manipulate nucleotide alleles: 
   numeric to letter, strand flipping, 

ntcode {nucleotides}

Name of routine: ntcode
Source lines: 10643 - 10685
Type subroutine
Call ntcode(typ, gene, dataset)
Modulenucleotides
Notes
 recode SNP alleles to/from numerical coding A<->1 C<->2 G<->3 T<->4

nuccode {nucleotides}

Name of routine: nuccode
Source lines: 10689 - 10745
Type subroutine
Call nuccode(gene, loctyp, locnotes, allele_buffer, dataset)
Modulenucleotides
Notes
 recode 1,2 or A,B to nucleotide code based on annotation

flip_buffer {nucleotides}

Name of routine: flip_buffer
Source lines: 10750 - 10765
Type subroutine
Call flip_buffer(allele_buffer, flip_)
Modulenucleotides
Notes
 flip allele labels in allele container to complement eg other strand A<->T G<->C
 NB allele container allele list is usually ordered by allele collation order

flip {nucleotides}

Name of routine: flip
Source lines: 10769 - 10808
Type subroutine
Call flip(loc, gene, flip_, dataset, plevel)
Modulenucleotides
Notes
 flip alleles in dataset to complement eg other strand A<->T G<->C

strandhet {nucleotides}

Name of routine: strandhet
Source lines: 10813 - 10928
Type subroutine
Call strandhet(loc, gene, dataset, allele_buffer, nhetclasses, hetclasses, hwep, plevel)
Modulenucleotides
Notes
 Test if mix of genotypes for a locus are compatible with a strand mixup
 Either test observed genotypes or compare to reference set

refstrand {nucleotides}

Name of routine: refstrand
Source lines: 10936 - 11078
Type subroutine
Call refstrand(typ, loc, gene, dataset, allele_buffer, ref_allele_buffer, comp_status, plevel)
Modulenucleotides
Notes
 Reconcile strand for observed genotypes to a reference set 
 Use frequency information when complementary alleles within system
 typ=1 flip genotypes in current dataset
 typ=2 flip list of alleles in *reference* set, to be used to read in 
       matching VCF or PLINK file

extract_one_allele {nucleotides}

Name of routine: extract_one_allele
Source lines: 11083 - 11093
Type subroutine
Call extract_one_allele(str, longall, all1)
Modulenucleotides
Notes
 Suitably mung long alleles in a VCF type ALT (usually comma separated)
  to a character (similar routine for allele_data)

extract_alt_alleles {nucleotides}

Name of routine: extract_alt_alleles
Source lines: 11095 - 11118
Type subroutine
Call extract_alt_alleles(str, all1, all2)
Modulenucleotides
Notes
 Routines to manipulate nucleotide alleles: 
   numeric to letter, strand flipping, 

load_refallele {nucleotides}

Name of routine: load_refallele
Source lines: 11122 - 11145
Type subroutine
Call load_refallele(refall, altall, altfreq, ref_allele_buffer)
Modulenucleotides
Notes
 Load reference alleles into an allele container

load_vcf_refall {nucleotides}

Name of routine: load_vcf_refall
Source lines: 11150 - 11248
Type subroutine
Call load_vcf_refall(typ, vcf_ac, vcf_an, vcf_het, vcf_hom, slin, vcf_alleles)
Modulenucleotides
Notes
  Load reference alleles from a line of a VCF file into an allele container
  if typ == 2 then VCF file expected to have summary allele count information

make_ntlist {nucleotides}

Name of routine: make_ntlist
Source lines: 11252 - 11293
Type subroutine
Call make_ntlist(allele_buffer, A, C, T, G, numnt, ntlist, astat)
Modulenucleotides
Notes
 List nucleotides in allele list , returning indicator variables and string

complement {nucleotides}

Name of routine: complement
Source lines: 11297 - 11313
Type function
Call complement(nt)
Modulenucleotides
Notes
 Complement nucleotide characters for annotation

dohash_ped_id {idhash_funs}

Name of routine: dohash_ped_id
Source lines: 11325 - 11333
Type function
Call dohash_ped_id(idx, dataset, maxkey)
Moduleidhash_funs
Notes
 pedigree + individual ID

dohash_id {idhash_funs}

Name of routine: dohash_id
Source lines: 11335 - 11342
Type function
Call dohash_id(idx, dataset, maxkey)
Moduleidhash_funs
Notes
 individual ID 

domatch_ped_id {idhash_funs}

Name of routine: domatch_ped_id
Source lines: 11344 - 11352
Type function
Call domatch_ped_id(idx, iaddress, dataset)
Moduleidhash_funs
Notes
 match pedigree + individual ID

domatch_id {idhash_funs}

Name of routine: domatch_id
Source lines: 11354 - 11360
Type function
Call domatch_id(idx, iaddress, dataset)
Moduleidhash_funs
Notes
 match individual id

domatch_string_ped_id {idhash_funs}

Name of routine: domatch_string_ped_id
Source lines: 11362 - 11371
Type function
Call domatch_string_ped_id(pedstr, indstr, iaddress, dataset)
Moduleidhash_funs
Notes
 match search string to pedigree + individual ID

domatch_string_id {idhash_funs}

Name of routine: domatch_string_id
Source lines: 11373 - 11380
Type function
Call domatch_string_id(idstr, iaddress, dataset)
Moduleidhash_funs
Notes
 match search string to individual ID

jack_useful {relpair_classes}

Name of routine: jack_useful
Source lines: 11408 - 11421
Type function
Call jack_useful(npairs, iter, plevel)
Modulerelpair_classes
Notes
 function to test if jackknife sensible

betacf {statfuns}

Name of routine: betacf
Source lines: 11437 - 11472
Type function
Call betacf(a,b,x)
Modulestatfuns
Notes
  
 betacf from Numerical Recipes, 1986
  

ibeta {statfuns}

Name of routine: ibeta
Source lines: 11480 - 11547
Type function
Call ibeta(x, p, q)
Modulestatfuns
Notes
 This function computes the beta cumulative
 distribution function at the point x.  p and q are the
 exponents of x and 1-x in the beta density.  see KL Majumder
 GP Bhattacharjee (1973). Algorithm AS 63 The incomplete beta
 integral. Appl Stat 22: 409-411.

fp {statfuns}

Name of routine: fp
Source lines: 11551 - 11576
Type function
Call fp(x, n1, n2)
Modulestatfuns
Notes
  
 F-ratio P-values
  

tp {statfuns}

Name of routine: tp
Source lines: 11580 - 11587
Type function
Call tp(x, df)
Modulestatfuns
Notes
 Wrap fp to give t-distribution P-values
 

chip {statfuns}

Name of routine: chip
Source lines: 11591 - 11624
Type function
Call chip(chisq, df)
Modulestatfuns
Notes
  
 Evaluate central chi-square in FORTRAN
  

gammad {statfuns}

Name of routine: gammad
Source lines: 11630 - 11738
Type function
Call gammad(x, p, ifault)
Modulestatfuns
Notes
  
 Algorithm AS239  Appl. Statist. (1988) Vol. 37, No. 3
  
 Computation of the Incomplete Gamma Integral
  

alngam {statfuns}

Name of routine: alngam
Source lines: 11743 - 11906
Type function
Call alngam(xvalue, ifault)
Modulestatfuns
Notes
  
 ALGORITHM AS245  APPL. STATIST. (1989) VOL. 38, NO. 2
 Calculation of the logarithm of the gamma function
  

zp {statfuns}

Name of routine: zp
Source lines: 11912 - 11956
Type function
Call zp(z)
Modulestatfuns
Notes
  
 Normal distribution probabilities accurate to 1d-15.
 Reference: J.L. Schonfelder, Math Comp 32(1978), pp 1232-1240.
 Gives one additional digit of accuracy cf Alan Miller's
  

mvbvu {statfuns}

Name of routine: mvbvu
Source lines: 11980 - 12077
Type function
Call mvbvu(sh, sk, r)
Modulestatfuns
Notes
     A function for computing bivariate normal probabilities;
       developed using 
         Drezner, Z. and Wesolowsky, G. O. (1989),
         On the Computation of the Bivariate Normal Integral,
         J. Stat. Comput. Simul.. 35 pp. 101-107.
       with extensive modications for double precisions by    
         Alan Genz and Yihong Ge
         Department of Mathematics
         Washington State University
         Pullman, WA 99164-3113
         Email : alangenz@wsu.edu

 BVN - calculate the probability that X is larger than SH and Y is
       larger than SK.

 Parameters

   SH  REAL, integration limit
   SK  REAL, integration limit
   R   REAL, correlation coefficient
   LG  INTEGER, number of Gauss Rule Points and Weights

mecdf {statfuns}

Name of routine: mecdf
Source lines: 12094 - 12158
Type subroutine
Call mecdf(ndim, d, idir, rho, prob, ier)
Modulestatfuns
Notes
 From TOMS717
 Bunch DS, Gay DM, Welsch RE. Subroutines for Maximum Likelihood and 
  Quasi-Likelihood Estimation of Parameters in Nonlinear Regression Models

 mecdf is designed to calculate the MVN CDF using the
 Mendell-Elston procedure as described in Kamakura (1989).
 NOTE: Equation (15) in Kamakura has an error.

 Specifically, assume that Z is a set of random variables
 with a standard normal distribution with correlations
 stored in RHO (in packed form).  Then this subroutine
 calculates Prob[Z(1)>D(1);...; Z(NDIM) > D(NDIM)].

 Code converted using TO_F90 by Alan Miller

phi {statfuns}

Name of routine: phi
Source lines: 12160 - 12174
Type function
Call phi(x, y)
Modulestatfuns
Notes
 Statistical functions library
 

ppnd {statfuns}

Name of routine: ppnd
Source lines: 12180 - 12263
Type function
Call ppnd(p)
Modulestatfuns
Notes
  
 ALGORITHM AS241  APPL. STATIST. (1988) VOL. 37, NO. 3
 Produces the normal deviate Z corresponding to a given lower
 tail area of P.  Replaces AS111 as more accurate for smaller P's.
 

chisqd {statfuns}

Name of routine: chisqd
Source lines: 12269 - 12330
Type function
Call chisqd(p, n)
Modulestatfuns
Notes
 Richard Goldstein, Algorithm 451: Chi-Square Quantiles,
 Communications of the ACM, August 1973, Volume 16, Number 8, pages 483-484. 
 Transcribed to machine readable form by John Burkhardt

fact {statfuns}

Name of routine: fact
Source lines: 12383 - 12400
Type function
Call fact(n)
Modulestatfuns
Notes
  
 Factorial
  

lfact {statfuns}

Name of routine: lfact
Source lines: 12404 - 12409
Type function
Call lfact(n)
Modulestatfuns
Notes
  
 Log factorial
  

dnorm {statfuns}

Name of routine: dnorm
Source lines: 12413 - 12424
Type function
Call dnorm(x, mu, sd)
Modulestatfuns
Notes
  
 Log gaussian density
  

dpois {statfuns}

Name of routine: dpois
Source lines: 12428 - 12440
Type function
Call dpois(x, mu)
Modulestatfuns
Notes
  
 Log poisson density
  

dweib {statfuns}

Name of routine: dweib
Source lines: 12444 - 12461
Type function
Call dweib(x, mu, shap, cens)
Modulestatfuns
Notes
  
 Log Weibull density (with censoring)
  

binp {statfuns}

Name of routine: binp
Source lines: 12465 - 12488
Type function
Call binp(np,nq)
Modulestatfuns
Notes
  
 Binomial probabilities for x,n-x with p=0.5
  

mvndst {mftfuns}

Name of routine: mvndst
Source lines: 12549 - 12586
Type subroutine
Call mvndst(n, lower, upper, infin, correl, maxpts, abseps, releps, error, value, inform)
Modulemftfuns
Notes
     A subroutine for computing multivariate normal probabilities.
     This subroutine uses an algorithm given in the paper
     "Numerical Computation of Multivariate Normal Probabilities", in
     J. of Computational and Graphical Stat., 1(1992), pp. 141-149, by
          Alan Genz
          Department of Mathematics
          Washington State University
          Pullman, WA 99164-3113
          Email : AlanGenz@wsu.edu
  Parameters
     N      INTEGER, the number of variables.
     LOWER  REAL, array of lower integration limits.
     UPPER  REAL, array of upper integration limits.
     INFIN  INTEGER, array of integration limits flags:
            if INFIN(I) < 0, Ith limits are (-infinity, infinity);
            if INFIN(I) = 0, Ith limits are (-infinity, UPPER(I)];
            if INFIN(I) = 1, Ith limits are [LOWER(I), infinity);
            if INFIN(I) = 2, Ith limits are [LOWER(I), UPPER(I)].
     CORREL REAL, array of correlation coefficients; the correlation
            coefficient in row I column J of the correlation matrix
            should be stored in CORREL( J + ((I-2)*(I-1))/2 ), for J < I.
            The correlation matrix must be positive semidefinite.
     MAXPTS INTEGER, maximum number of function values allowed. This
            parameter can be used to limit the time. A sensible
            strategy is to start with MAXPTS = 1000*N, and then
            increase MAXPTS if ERROR is too large.
     ABSEPS REAL absolute error tolerance.
     RELEPS REAL relative error tolerance.
     ERROR  REAL estimated absolute error, with 99% confidence level.
     VALUE  REAL estimated value for the integral
     INFORM INTEGER, termination status parameter:
            if INFORM = 0, normal completion with ERROR < EPS;
            if INFORM = 1, completion with ERROR > EPS and MAXPTS
                           function values used; increase MAXPTS to
                           decrease ERROR;
            if INFORM = 2, N > 500 or N < 1.

mvndfn {mftfuns}

Name of routine: mvndfn
Source lines: 12590 - 12678
Type function
Call mvndfn( n, w )
Modulemftfuns
Notes
  
 Integrand subroutine
  

mvnlms {mftfuns}

Name of routine: mvnlms
Source lines: 12680 - 12695
Type subroutine
Call mvnlms( a, b, infin, lower, upper )
Modulemftfuns
Notes
  

covsrt {mftfuns}

Name of routine: covsrt
Source lines: 12699 - 12867
Type subroutine
Call covsrt(n, lower, upper, correl, infin, y, infis, a, b, cov, infi)
Modulemftfuns
Notes
  
 Subroutine to sort integration limits and determine Cholesky factor.

dkswap {mftfuns}

Name of routine: dkswap
Source lines: 12869 - 12876
Type subroutine
Call dkswap( x, y )
Modulemftfuns
Notes
 Swap elements  

rcswp {mftfuns}

Name of routine: rcswp
Source lines: 12880 - 12912
Type subroutine
Call rcswp( p, q, a, b, infin, n, c )
Modulemftfuns
Notes
  
 Swaps rows and columns P and Q in situ, with P <= Q.

dkbvrc {mftfuns}

Name of routine: dkbvrc
Source lines: 12963 - 13171
Type subroutine
Call dkbvrc(ndim, minvls, maxvls, functn, abseps, releps, abserr, finest, inform )
Modulemftfuns
Notes
  ABSEPS  Required absolute accuracy.
  RELEPS  Required relative accuracy.
***** Output parameters
  MINVLS  Actual number of function evaluations used.
  ABSERR  Estimated absolute accuracy of FINEST.
  FINEST  Estimated value of integral.
  INFORM  INFORM = 0 for normal exit, when
                     ABSERR <= MAX(ABSEPS, RELEPS*ABS(FINEST))
                  and
                     INTVLS <= MAXCLS.
          INFORM = 1 If MAXVLS was too small to obtain the required
          accuracy. In this case a value FINEST is returned with
          estimated absolute accuracy ABSERR.

dksmrc {mftfuns}

Name of routine: dksmrc
Source lines: 13173 - 13207
Type subroutine
Call dksmrc( ndim, klim, sumkro, prime, vk, functn, x )
Modulemftfuns
Notes
  

printmat {symmetric_matrix}

Name of routine: printmat
Source lines: 13312 - 13323
Type subroutine
Call printmat(n, c, fstring)
Modulesymmetric_matrix
Notes
 print n rows of symmetric lower triangular matrix

printmat_full {symmetric_matrix}

Name of routine: printmat_full
Source lines: 13327 - 13346
Type subroutine
Call printmat_full(n, c)
Modulesymmetric_matrix
Notes
 print entire symmetric matrix

hashmat {symmetric_matrix}

Name of routine: hashmat
Source lines: 13350 - 13362
Type function
Call hashmat(n, c)
Modulesymmetric_matrix
Notes
 hash code for a matrix - after the Java equivalent

postmult {symmetric_matrix}

Name of routine: postmult
Source lines: 13368 - 13388
Type subroutine
Call postmult(n, x, c, w)
Modulesymmetric_matrix
Notes
 Evaluate S x
 where S is symmetric lower triangular matrix
       x is a vector

postmultm {symmetric_matrix}

Name of routine: postmultm
Source lines: 13394 - 13418
Type subroutine
Call postmultm(n, m, x, c, w)
Modulesymmetric_matrix
Notes
 Evaluate S X
 where S is symmetric lower triangular matrix
       X is a full n*m matrix

sumsym {symmetric_matrix}

Name of routine: sumsym
Source lines: 13423 - 13439
Type subroutine
Call sumsym(n, c, res)
Modulesymmetric_matrix
Notes
 Evaluate 1' S 1
 where S is symmetric lower triangular matrix

quadmult {symmetric_matrix}

Name of routine: quadmult
Source lines: 13444 - 13465
Type subroutine
Call quadmult(typ, n, x, c, res)
Modulesymmetric_matrix
Notes
 Evaluate (typ=1) x' S x  or (typ=2) 1' S x
 where S is symmetric lower triangular matrix

quadxxm {symmetric_matrix}

Name of routine: quadxxm
Source lines: 13472 - 13492
Type subroutine
Call quadxxm(n, m, x, c, res)
Modulesymmetric_matrix
Notes
 Evaluate X' S X
 where S is symmetric lower triangular matrix
       X n*m matrix
 result returned in lower triangular form

quadxy {symmetric_matrix}

Name of routine: quadxy
Source lines: 13498 - 13513
Type subroutine
Call quadxy(n, x, c, y, res)
Modulesymmetric_matrix
Notes
 Evaluate x' S y
 where S is symmetric lower triangular matrix
       x, y are 1-D arrays

quadxymv {symmetric_matrix}

Name of routine: quadxymv
Source lines: 13519 - 13535
Type subroutine
Call quadxymv(n, m, x, c, y, res)
Modulesymmetric_matrix
Notes
 Evaluate X' S y
 where S is symmetric lower triangular matrix
       X full n*m matrix, y n-vector

quadxym {symmetric_matrix}

Name of routine: quadxym
Source lines: 13541 - 13552
Type subroutine
Call quadxym(n, m1, m2, x, c, y, res)
Modulesymmetric_matrix
Notes
 Evaluate X' S Y
 where S is symmetric lower triangular matrix
       X, Y full n*m1,n*m2 matrices

quadxy1 {symmetric_matrix}

Name of routine: quadxy1
Source lines: 13558 - 13573
Type subroutine
Call quadxy1(n, m, c, y, res)
Modulesymmetric_matrix
Notes
 Evaluate 1' S Y
 where S is symmetric lower triangular matrix
       Y full n*m matrix

quadform {symmetric_matrix}

Name of routine: quadform
Source lines: 13577 - 13591
Type subroutine
Call quadform(n, x, m, c, res)
Modulesymmetric_matrix
Notes
 Evaluate (y-m)' S (y-m) where S is symmetric lower triangular matrix

chol {symmetric_matrix}

Name of routine: chol
Source lines: 13595 - 13652
Type subroutine
Call chol(a, n, nn, u, nullty, ifault)
Modulesymmetric_matrix
Notes
 Choleski decomposition of a symmetric matrix stored as lower triangular

lowermult {symmetric_matrix}

Name of routine: lowermult
Source lines: 13656 - 13670
Type subroutine
Call lowermult(n, y, s, w)
Modulesymmetric_matrix
Notes
 
 Evaluate S y, where S is lower triangular

addridge {symmetric_matrix}

Name of routine: addridge
Source lines: 13674 - 13684
Type subroutine
Call addridge(n, s, m)
Modulesymmetric_matrix
Notes
 Augment main diagnonal of symmetric matrix by factor

rs {EISPACK}

Name of routine: rs
Source lines: 14726 - 14751
Type subroutine
Call rs(nm, n, a, w, matz, z, fv1, fv2, ierr)
ModuleEISPACK
Notes
 This subroutine calls the recommended sequence of
 subroutines from the Eigensystem Subroutine Package (EISPACK)
 to find the eigenvalues and eigenvectors (if desired)
 of a real symmetric matrix.

tred1 {EISPACK}

Name of routine: tred1
Source lines: 14760 - 14863
Type subroutine
Call tred1(nm, n, a, d, e, e2)
ModuleEISPACK
Notes
 This EISPACK subroutine is a translation of the Algol procedure TRED1, 
 Num. Math. 11, 181-195(1968) by Martin, Reinsch, and Wilkinson.
 Handbook for Auto. Comp., Vol.II-Linear Algebra, 212-226(1971).
 This subroutine reduces a real symmetric matrix
 to a symmetric tridiagonal matrix using
 orthogonal similarity transformations.

tred2 {EISPACK}

Name of routine: tred2
Source lines: 14872 - 15012
Type subroutine
Call tred2(nm, n, a, d, e, z)
ModuleEISPACK
Notes
  
 This EISPACK subroutine is a translation of the Algol procedure TRED2, 
 Num. Math. 11, 181-195(1968) by Martin, Reinsch, and Wilkinson.
 Handbook for Auto. Comp., Vol.II-Linear Algebra, 212-226(1971).
 This subroutine reduces a real symmetric matrix to a
 symmetric tridiagonal matrix using and accumulating
 orthogonal similarity transformations.
  

tqlrat {EISPACK}

Name of routine: tqlrat
Source lines: 15020 - 15117
Type subroutine
Call tqlrat(n, d, e2, ierr)
ModuleEISPACK
Notes
  
 This EISPACK subroutine is a translation of the Algol procedure TQLRAT, 
 Algorithm 464, Comm. ACM 16, 689(1973) By Reinsch.
  
 This subroutine finds the eigenvalues of a symmetric
 tridiagonal matrix by the rational QL method.

tql2 {EISPACK}

Name of routine: tql2
Source lines: 15129 - 15271
Type subroutine
Call tql2(nm, n, d, e, z, ierr)
ModuleEISPACK
Notes
  
 This EISPACK subroutine is a translation of the Algol procedure TQL2, 
 Num. Math. 11, 293-306(1968) by Bowdler, Martin, Reinsch, and Wilkinson.
 Handbook for Auto. Comp., Vol.II-Linear Algebra, 227-240(1971).
  
 This subroutine finds the eigenvalues and eigenvectors
 of a symmetric tridiagonal matrix by the ql method.
 The eigenvectors of a full symmetric matrix can also
 be found if  tred2  has been used to reduce this
 full matrix to tridiagonal form.

pythag {EISPACK}

Name of routine: pythag
Source lines: 15275 - 15296
Type function
Call pythag(a, b)
ModuleEISPACK
Notes
  
 Finds dsqrt(A**2+B**2) without overflow or destructive underflow

{EISPACK}

Name of routine:
Source lines: 15300 - 15314
Type function
Call epslon (x)
ModuleEISPACK
Notes
 estimate unit roundoff in quantities of size x

decgtp {recast_data}

Name of routine: decgtp
Source lines: 15341 - 15352
Type subroutine
Call decgtp(val, g1, g2)
Modulerecast_data
Notes
  
 Decode hashed genotype code
  

encgtp {recast_data}

Name of routine: encgtp
Source lines: 15356 - 15366
Type function
Call encgtp(a1, a2)
Modulerecast_data
Notes
 Hash a genotype
  

iencgtp {recast_data}

Name of routine: iencgtp
Source lines: 15370 - 15380
Type function
Call iencgtp(a1, a2)
Modulerecast_data
Notes
 Hash an integer genotype
  

encchr {recast_data}

Name of routine: encchr
Source lines: 15384 - 15406
Type subroutine
Call encchr(chr, val)
Modulerecast_data
Notes
 Hash a chromosome retaining nice collation order

decchr {recast_data}

Name of routine: decchr
Source lines: 15410 - 15432
Type subroutine
Call decchr(val, chr)
Modulerecast_data
Notes
 Unhash a chromosome

chr_convert {recast_data}

Name of routine: chr_convert
Source lines: 15436 - 15452
Type subroutine
Call chr_convert(typ, string, chr)
Modulerecast_data
Notes
 read in a chromosome name - chr 23-26 often are X, Y, PAR (XY), MT

make_mapranges {maprange_class}

Name of routine: make_mapranges
Source lines: 15477 - 15510
Type subroutine
Call make_mapranges(rangetable, mr)
Modulemaprange_class
Notes
 make_mapranges takes a table of three vars: chr, lower, upper

show_mapranges {maprange_class}

Name of routine: show_mapranges
Source lines: 15512 - 15522
Type subroutine
Call show_mapranges(mr)
Modulemaprange_class
Notes
 Storage for a range of map positions

 chromosome  chromosome_name  
 mapranges   range_start range_end
 chromrange  first_range_record last_range_record

clean_mapranges {maprange_class}

Name of routine: clean_mapranges
Source lines: 15524 - 15535
Type subroutine
Call clean_mapranges(mr)
Modulemaprange_class
Notes
 Storage for a range of map positions

 chromosome  chromosome_name  
 mapranges   range_start range_end
 chromrange  first_range_record last_range_record

in_mapranges {maprange_class}

Name of routine: in_mapranges
Source lines: 15539 - 15559
Type subroutine
Call in_mapranges(chr, mappos, mr, res)
Modulemaprange_class
Notes
 Test if in ranges

loadpos {map_position_list}

Name of routine: loadpos
Source lines: 15586 - 15750
Type subroutine
Call loadpos(sta, fin, words, nloci, loc, lochash, loctyp, group, map, locstat, chosen, nterms, terms, typ)
Modulemap_position_list
Notes
 like loadnam, but by position
 typ=1 active loci, =2 inactive loci

marshare {read_data}

Name of routine: marshare
Source lines: 15764 - 15800
Type subroutine
Call marshare(idx, nloci, loctyp, locpos, dataset, marcom)
Moduleread_data
Notes
  
 Count maximum number of active markers where proband and
 any of relatives is genotyped at (for autovar)
  

autovar {read_data}

Name of routine: autovar
Source lines: 15804 - 15898
Type subroutine
Call autovar(idx, ctag, nloci, loctyp, locpos, dataset, res)
Moduleread_data
Notes
 Evaluate automatic variable

readval {read_data}

Name of routine: readval
Source lines: 15902 - 15933
Type subroutine
Call readval(mistyp, idx, nloc, loclist, nloci, loc, locpos, loctyp, dataset, val, astat)
Moduleread_data
Notes
 Values for one individual for insertion into contingency table

readoneval {read_data}

Name of routine: readoneval
Source lines: 15937 - 15974
Type subroutine
Call readoneval(idx, lpos, ltyp, nloci, loctyp, locpos, dataset, mistyp, val, astat)
Moduleread_data
Notes
 Value for one phenotype for one individual 

maketab {read_data}

Name of routine: maketab
Source lines: 15978 - 16019
Type subroutine
Call maketab(mistyp, weight, nloc, loclist, nloci, loc, locpos, loctyp, dataset, nmiss, table)
Moduleread_data
Notes
 Fill a crosstabulation from dataset

strat_freq {read_data}

Name of routine: strat_freq
Source lines: 16023 - 16087
Type subroutine
Call strat_freq(nloc, loclist, nloci, loc, locpos, loctyp, allele_buffer, dataset, nmiss, table)
Moduleread_data
Notes
 Returns table of allele counts by stratum 1..(nloc-1)=strata levels nloc=gene   

copy_mem {scheme_lang}

Name of routine: copy_mem
Source lines: 16340 - 16360
Type subroutine
Call copy_mem(a, b)
Modulescheme_lang
Notes
 Memory management

 copy contents of a to b

init_mem {scheme_lang}

Name of routine: init_mem
Source lines: 16362 - 16375
Type subroutine
Call init_mem(a, sta, fin)
Modulescheme_lang
Notes
 Miniscm

setup_mem {scheme_lang}

Name of routine: setup_mem
Source lines: 16379 - 16413
Type subroutine
Call setup_mem(siz)
Modulescheme_lang
Notes
 allocate cells for main memory object mem

cleanup_bank {scheme_lang}

Name of routine: cleanup_bank
Source lines: 16419 - 16433
Type subroutine
Call cleanup_bank(sta, fin)
Modulescheme_lang
Notes
 Clean up memory arrays

 Zero a block of cells, including deallocating strings 

cleanup_mem {scheme_lang}

Name of routine: cleanup_mem
Source lines: 16437 - 16440
Type subroutine
Call cleanup_mem()
Modulescheme_lang
Notes
 Free all memory

save_scheme_image {scheme_lang}

Name of routine: save_scheme_image
Source lines: 16444 - 16464
Type subroutine
Call save_scheme_image(strm, ios)
Modulescheme_lang
Notes
 Save memory image

read_scheme_image {scheme_lang}

Name of routine: read_scheme_image
Source lines: 16468 - 16499
Type subroutine
Call read_scheme_image(strm, ios)
Modulescheme_lang
Notes
 Read memory image

gc_mark {scheme_lang}

Name of routine: gc_mark
Source lines: 16505 - 16544
Type subroutine
Call gc_mark(a)
Modulescheme_lang
Notes
 Mark-sweep garbage collector

 Mark cells to be saved

gc {scheme_lang}

Name of routine: gc
Source lines: 16549 - 16589
Type subroutine
Call gc(a, b, plevel)
Modulescheme_lang
Notes
 Copy all registers to free memory
 Reset pointers from old addresses to new addresses

getcell {scheme_lang}

Name of routine: getcell
Source lines: 16593 - 16617
Type function
Call getcell(a, b)
Modulescheme_lang
Notes
 Get next free cell

set_type {scheme_lang}

Name of routine: set_type
Source lines: 16622 - 16626
Type subroutine
Call set_type(p, iflag)
Modulescheme_lang
Notes
 Cell type operations

 Setting values

set_ivalue {scheme_lang}

Name of routine: set_ivalue
Source lines: 16627 - 16632
Type subroutine
Call set_ivalue(p, ivalue)
Modulescheme_lang
Notes
 Cell type operations

 Setting values

set_value {scheme_lang}

Name of routine: set_value
Source lines: 16633 - 16638
Type subroutine
Call set_value(p, val)
Modulescheme_lang
Notes
 Cell type operations

 Setting values

set_string {scheme_lang}

Name of routine: set_string
Source lines: 16639 - 16652
Type subroutine
Call set_string(p, str)
Modulescheme_lang
Notes
 Cell type operations

 Setting values

set_substring {scheme_lang}

Name of routine: set_substring
Source lines: 16653 - 16663
Type subroutine
Call set_substring(p, sta, fin, str)
Modulescheme_lang
Notes
 Cell type operations

 Setting values

set_car {scheme_lang}

Name of routine: set_car
Source lines: 16665 - 16668
Type subroutine
Call set_car(p, icar)
Modulescheme_lang
Notes
 Miniscm

set_cdr {scheme_lang}

Name of routine: set_cdr
Source lines: 16669 - 16672
Type subroutine
Call set_cdr(p, icdr)
Modulescheme_lang
Notes
 Miniscm

set_caar {scheme_lang}

Name of routine: set_caar
Source lines: 16673 - 16676
Type subroutine
Call set_caar(p, icaar)
Modulescheme_lang
Notes
 Miniscm

set_cdar {scheme_lang}

Name of routine: set_cdar
Source lines: 16677 - 16680
Type subroutine
Call set_cdar(p, icdar)
Modulescheme_lang
Notes
 Miniscm

set_syntaxnum {scheme_lang}

Name of routine: set_syntaxnum
Source lines: 16681 - 16684
Type subroutine
Call set_syntaxnum(p, op)
Modulescheme_lang
Notes
 Miniscm

get_ivalue {scheme_lang}

Name of routine: get_ivalue
Source lines: 16688 - 16692
Type function
Call get_ivalue(p)
Modulescheme_lang
Notes
 Getting values

get_value {scheme_lang}

Name of routine: get_value
Source lines: 16694 - 16702
Type function
Call get_value(p)
Modulescheme_lang
Notes
 Miniscm

rvalue {scheme_lang}

Name of routine: rvalue
Source lines: 16704 - 16712
Type function
Call rvalue(p)
Modulescheme_lang
Notes
 Miniscm

get_string {scheme_lang}

Name of routine: get_string
Source lines: 16716 - 16726
Type function
Call get_string(p)
Modulescheme_lang
Notes
 Strings
 

append_string {scheme_lang}

Name of routine: append_string
Source lines: 16730 - 16753
Type subroutine
Call append_string(p, str)
Modulescheme_lang
Notes
 Append to existing string

get_substr {scheme_lang}

Name of routine: get_substr
Source lines: 16755 - 16768
Type function
Call get_substr(p, sta, fin)
Modulescheme_lang
Notes
 Substring

get_strlen {scheme_lang}

Name of routine: get_strlen
Source lines: 16770 - 16774
Type function
Call get_strlen(p)
Modulescheme_lang
Notes
 String length

get_listlen {scheme_lang}

Name of routine: get_listlen
Source lines: 16776 - 16788
Type function
Call get_listlen(p)
Modulescheme_lang
Notes
 Miniscm

get_listtail {scheme_lang}

Name of routine: get_listtail
Source lines: 16792 - 16803
Type function
Call get_listtail(p, idx)
Modulescheme_lang
Notes
 memory location of kth list item

ishomog {scheme_lang}

Name of routine: ishomog
Source lines: 16807 - 16821
Type function
Call ishomog(p, typfun)
Modulescheme_lang
Notes
 is homogenous list of given type?

get_carray {scheme_lang}

Name of routine: get_carray
Source lines: 16825 - 16838
Type subroutine
Call get_carray(p, n, strings, width)
Modulescheme_lang
Notes
 homogenous list to Fortran array

get_iarray {scheme_lang}

Name of routine: get_iarray
Source lines: 16840 - 16853
Type subroutine
Call get_iarray(p, n, r)
Modulescheme_lang
Notes
 Miniscm

get_rarray {scheme_lang}

Name of routine: get_rarray
Source lines: 16855 - 16894
Type subroutine
Call get_rarray(p, n, r, missing)
Modulescheme_lang
Notes
 Miniscm

append_iarray {scheme_lang}

Name of routine: append_iarray
Source lines: 16898 - 16908
Type subroutine
Call append_iarray(ivals, res)
Modulescheme_lang
Notes
 append fortran array values to list

append_rarray {scheme_lang}

Name of routine: append_rarray
Source lines: 16910 - 16920
Type subroutine
Call append_rarray(rvals, res)
Modulescheme_lang
Notes
 Miniscm

get_var {scheme_lang}

Name of routine: get_var
Source lines: 16927 - 17037
Type subroutine
Call get_var(string, pos, fin, istat)
Modulescheme_lang
Notes

 allowing access to Scheme environment from Sib-pair
 accessible variables are atomic
 result inserted into passed string

list_var {scheme_lang}

Name of routine: list_var
Source lines: 17041 - 17107
Type subroutine
Call list_var(typ, ple)
Modulescheme_lang
Notes
 List Sib-pair accessible (atomic or pair) variables

isbound {scheme_lang}

Name of routine: isbound
Source lines: 17111 - 17136
Type function
Call isbound(nam)
Modulescheme_lang
Notes
 test if a name is bound in the top environment

isafun {scheme_lang}

Name of routine: isafun
Source lines: 17140 - 17169
Type function
Call isafun(nam)
Modulescheme_lang
Notes
 Test if a macro function exists, and return address of body

procnum {scheme_lang}

Name of routine: procnum
Source lines: 17171 - 17175
Type function
Call procnum(p)
Modulescheme_lang
Notes
 Miniscm

syntaxnum {scheme_lang}

Name of routine: syntaxnum
Source lines: 17176 - 17180
Type function
Call syntaxnum(p)
Modulescheme_lang
Notes
 Miniscm

typeof {scheme_lang}

Name of routine: typeof
Source lines: 17184 - 17188
Type function
Call typeof(p)
Modulescheme_lang
Notes
 Underlying primitives for Scheme

isstring {scheme_lang}

Name of routine: isstring
Source lines: 17189 - 17193
Type function
Call isstring(p)
Modulescheme_lang
Notes
 Underlying primitives for Scheme

isnumber {scheme_lang}

Name of routine: isnumber
Source lines: 17194 - 17198
Type function
Call isnumber(p)
Modulescheme_lang
Notes
 Underlying primitives for Scheme

ispair {scheme_lang}

Name of routine: ispair
Source lines: 17199 - 17203
Type function
Call ispair(p)
Modulescheme_lang
Notes
 Underlying primitives for Scheme

car {scheme_lang}

Name of routine: car
Source lines: 17207 - 17211
Type function
Call car(p)
Modulescheme_lang
Notes
 car, cdr etc

cdr {scheme_lang}

Name of routine: cdr
Source lines: 17212 - 17216
Type function
Call cdr(p)
Modulescheme_lang
Notes
 car, cdr etc

caar {scheme_lang}

Name of routine: caar
Source lines: 17218 - 17223
Type function
Call caar(p)
Modulescheme_lang
Notes
 Miniscm

cadr {scheme_lang}

Name of routine: cadr
Source lines: 17224 - 17229
Type function
Call cadr(p)
Modulescheme_lang
Notes
 Miniscm

cdar {scheme_lang}

Name of routine: cdar
Source lines: 17230 - 17235
Type function
Call cdar(p)
Modulescheme_lang
Notes
 Miniscm

cddr {scheme_lang}

Name of routine: cddr
Source lines: 17236 - 17241
Type function
Call cddr(p)
Modulescheme_lang
Notes
 Miniscm

cadar {scheme_lang}

Name of routine: cadar
Source lines: 17242 - 17248
Type function
Call cadar(p)
Modulescheme_lang
Notes
 Miniscm

caddr {scheme_lang}

Name of routine: caddr
Source lines: 17249 - 17255
Type function
Call caddr(p)
Modulescheme_lang
Notes
 Miniscm

cadaar {scheme_lang}

Name of routine: cadaar
Source lines: 17256 - 17263
Type function
Call cadaar(p)
Modulescheme_lang
Notes
 Miniscm

cadddr {scheme_lang}

Name of routine: cadddr
Source lines: 17264 - 17271
Type function
Call cadddr(p)
Modulescheme_lang
Notes
 Miniscm

cddddr {scheme_lang}

Name of routine: cddddr
Source lines: 17272 - 17279
Type function
Call cddddr(p)
Modulescheme_lang
Notes
 Miniscm

issymbol {scheme_lang}

Name of routine: issymbol
Source lines: 17281 - 17285
Type function
Call issymbol(p)
Modulescheme_lang
Notes
 Miniscm

issyntax {scheme_lang}

Name of routine: issyntax
Source lines: 17286 - 17290
Type function
Call issyntax(p)
Modulescheme_lang
Notes
 Miniscm

isproc {scheme_lang}

Name of routine: isproc
Source lines: 17291 - 17295
Type function
Call isproc(p)
Modulescheme_lang
Notes
 Miniscm

isclosure {scheme_lang}

Name of routine: isclosure
Source lines: 17296 - 17300
Type function
Call isclosure(p)
Modulescheme_lang
Notes
 Miniscm

ismacro {scheme_lang}

Name of routine: ismacro
Source lines: 17301 - 17305
Type function
Call ismacro(p)
Modulescheme_lang
Notes
 Miniscm

iscontinuation {scheme_lang}

Name of routine: iscontinuation
Source lines: 17306 - 17310
Type function
Call iscontinuation(p)
Modulescheme_lang
Notes
 Miniscm

ispromise {scheme_lang}

Name of routine: ispromise
Source lines: 17311 - 17315
Type function
Call ispromise(p)
Modulescheme_lang
Notes
 Miniscm

isport {scheme_lang}

Name of routine: isport
Source lines: 17316 - 17320
Type function
Call isport(p)
Modulescheme_lang
Notes
 Miniscm

istrue {scheme_lang}

Name of routine: istrue
Source lines: 17322 - 17326
Type function
Call istrue(p)
Modulescheme_lang
Notes
 true or false value functions

isfalse {scheme_lang}

Name of routine: isfalse
Source lines: 17327 - 17331
Type function
Call isfalse(p)
Modulescheme_lang
Notes
 true or false value functions

isinteger {scheme_lang}

Name of routine: isinteger
Source lines: 17335 - 17339
Type function
Call isinteger(p)
Modulescheme_lang
Notes
 tower of numbers 

isfloat {scheme_lang}

Name of routine: isfloat
Source lines: 17340 - 17344
Type function
Call isfloat(p)
Modulescheme_lang
Notes
 tower of numbers 

isatom {scheme_lang}

Name of routine: isatom
Source lines: 17348 - 17352
Type function
Call isatom(p)
Modulescheme_lang
Notes
 Garbage collection
 

setatom {scheme_lang}

Name of routine: setatom
Source lines: 17353 - 17356
Type subroutine
Call setatom(p)
Modulescheme_lang
Notes
 Garbage collection
 

clratom {scheme_lang}

Name of routine: clratom
Source lines: 17357 - 17360
Type subroutine
Call clratom(p)
Modulescheme_lang
Notes
 Garbage collection
 

ismark {scheme_lang}

Name of routine: ismark
Source lines: 17361 - 17365
Type function
Call ismark(p)
Modulescheme_lang
Notes
 Garbage collection
 

setmark {scheme_lang}

Name of routine: setmark
Source lines: 17366 - 17369
Type subroutine
Call setmark(p)
Modulescheme_lang
Notes
 Garbage collection
 

clrmark {scheme_lang}

Name of routine: clrmark
Source lines: 17370 - 17373
Type subroutine
Call clrmark(p)
Modulescheme_lang
Notes
 Garbage collection
 

cons {scheme_lang}

Name of routine: cons
Source lines: 17377 - 17384
Type function
Call cons(reg1, reg2)
Modulescheme_lang
Notes
 Cons

ceqstr {scheme_lang}

Name of routine: ceqstr
Source lines: 17388 - 17405
Type function
Call ceqstr(cstr, reg)
Modulescheme_lang
Notes
 Contents of a Lisp string cell equal to a Fortran string

streq {scheme_lang}

Name of routine: streq
Source lines: 17409 - 17425
Type function
Call streq(a, b)
Modulescheme_lang
Notes
 Contents of a Lisp string equal to a Lisp string 

mk_number {scheme_lang}

Name of routine: mk_number
Source lines: 17429 - 17437
Type function
Call mk_number(num)
Modulescheme_lang
Notes
 Declare a number

mk_real {scheme_lang}

Name of routine: mk_real
Source lines: 17441 - 17449
Type function
Call mk_real(num)
Modulescheme_lang
Notes
 Declare a real

mk_string {scheme_lang}

Name of routine: mk_string
Source lines: 17453 - 17461
Type function
Call mk_string(str)
Modulescheme_lang
Notes
 Declare a string

mk_symbol {scheme_lang}

Name of routine: mk_symbol
Source lines: 17465 - 17482
Type function
Call mk_symbol(nam)
Modulescheme_lang
Notes
 Declare a symbol

append_one_string {scheme_lang}

Name of routine: append_one_string
Source lines: 17485 - 17499
Type function
Call append_one_string(str, l, protect)
Modulescheme_lang
Notes
 cons string to list

append_one_real {scheme_lang}

Name of routine: append_one_real
Source lines: 17502 - 17516
Type function
Call append_one_real(num, l, protect)
Modulescheme_lang
Notes
 cons real to list

append_one_number {scheme_lang}

Name of routine: append_one_number
Source lines: 17519 - 17533
Type function
Call append_one_number(num, l, protect)
Modulescheme_lang
Notes
 cons integer to list

make_real_matrix {scheme_lang}

Name of routine: make_real_matrix
Source lines: 17537 - 17570
Type function
Call make_real_matrix(nvals, vals, nr, protect)
Modulescheme_lang
Notes
 make matrix from 1-D array

gensym {scheme_lang}

Name of routine: gensym
Source lines: 17574 - 17593
Type function
Call gensym()
Modulescheme_lang
Notes
 automatically generate a unique symbol 

mk_atom {scheme_lang}

Name of routine: mk_atom
Source lines: 17598 - 17638
Type function
Call mk_atom(str)
Modulescheme_lang
Notes
 make symbol or number atom from string

mk_const {scheme_lang}

Name of routine: mk_const
Source lines: 17642 - 17686
Type function
Call mk_const(nam)
Modulescheme_lang
Notes
 
 Make a constant

mk_closure {scheme_lang}

Name of routine: mk_closure
Source lines: 17690 - 17699
Type function
Call mk_closure(c, e)
Modulescheme_lang
Notes
 make closure, c is code, e is environment

mk_continuation {scheme_lang}

Name of routine: mk_continuation
Source lines: 17703 - 17711
Type function
Call mk_continuation(d)
Modulescheme_lang
Notes
 make continuation

mk_port {scheme_lang}

Name of routine: mk_port
Source lines: 17715 - 17725
Type function
Call mk_port(iport, nam)
Modulescheme_lang
Notes
 make a port

test_port {scheme_lang}

Name of routine: test_port
Source lines: 17728 - 17739
Type function
Call test_port(iport)
Modulescheme_lang
Notes
 Test a port - return location in portaddress

reverse {scheme_lang}

Name of routine: reverse
Source lines: 17743 - 17758
Type function
Call reverse(a)
Modulescheme_lang
Notes
 Reverse list

non_alloc_rev {scheme_lang}

Name of routine: non_alloc_rev
Source lines: 17762 - 17778
Type function
Call non_alloc_rev(term, list)
Modulescheme_lang
Notes
 Reverse list -- no new cell generated

append {scheme_lang}

Name of routine: append
Source lines: 17782 - 17798
Type function
Call append(a, b)
Modulescheme_lang
Notes
 append list -- make new cells

eqv {scheme_lang}

Name of routine: eqv
Source lines: 17802 - 17817
Type function
Call eqv(a, b)
Modulescheme_lang
Notes
 equivalence of atoms

save_linbuffer {scheme_lang}

Name of routine: save_linbuffer
Source lines: 17821 - 17833
Type subroutine
Call save_linbuffer()
Modulescheme_lang
Notes
 save or restore command line buffer (f95 compatible)

restore_linbuffer {scheme_lang}

Name of routine: restore_linbuffer
Source lines: 17835 - 17842
Type subroutine
Call restore_linbuffer()
Modulescheme_lang
Notes
 Miniscm

inchar {scheme_lang}

Name of routine: inchar
Source lines: 17846 - 17875
Type subroutine
Call inchar(ch)
Modulescheme_lang
Notes
 get a new character from input file or stdin

clearinput {scheme_lang}

Name of routine: clearinput
Source lines: 17879 - 17881
Type subroutine
Call clearinput()
Modulescheme_lang
Notes
 clear input buffer

flushinput {scheme_lang}

Name of routine: flushinput
Source lines: 17885 - 17891
Type subroutine
Call flushinput()
Modulescheme_lang
Notes
 back to standard input

backchar {scheme_lang}

Name of routine: backchar
Source lines: 17895 - 17897
Type subroutine
Call backchar()
Modulescheme_lang
Notes
 backstep one character in input buffer

skipspace {scheme_lang}

Name of routine: skipspace
Source lines: 17901 - 17911
Type subroutine
Call skipspace()
Modulescheme_lang
Notes
 skip whitespace

token {scheme_lang}

Name of routine: token
Source lines: 17915 - 17960
Type function
Call token()
Modulescheme_lang
Notes
 get next token

scheme_delim {scheme_lang}

Name of routine: scheme_delim
Source lines: 17964 - 17972
Type function
Call scheme_delim(ch)
Modulescheme_lang
Notes
 read characters to delimiter  -- hard coded to work on Windows as well

readstr {scheme_lang}

Name of routine: readstr
Source lines: 17974 - 17992
Type subroutine
Call readstr(res)
Modulescheme_lang
Notes
 Miniscm

readstrexp {scheme_lang}

Name of routine: readstrexp
Source lines: 17996 - 18019
Type subroutine
Call readstrexp(res, reslen)
Modulescheme_lang
Notes
 read rest of a quoted string

printatom {scheme_lang}

Name of routine: printatom
Source lines: 18023 - 18100
Type subroutine
Call printatom(l, space, ndigits, commainterval, style)
Modulescheme_lang
Notes
 print an atom

padprint {scheme_lang}

Name of routine: padprint
Source lines: 18104 - 18141
Type subroutine
Call padprint(str, space, commainterval)
Modulescheme_lang
Notes
 Pad printing of an atom

ok_abbrev {scheme_lang}

Name of routine: ok_abbrev
Source lines: 18143 - 18147
Type function
Call ok_abbrev(x)
Modulescheme_lang
Notes
 Miniscm

s_save {scheme_lang}

Name of routine: s_save
Source lines: 18149 - 18154
Type subroutine
Call s_save(a, b, c)
Modulescheme_lang
Notes
 Miniscm

s_return {scheme_lang}

Name of routine: s_return
Source lines: 18155 - 18163
Type subroutine
Call s_return(a)
Modulescheme_lang
Notes
 Miniscm

s_retbool {scheme_lang}

Name of routine: s_retbool
Source lines: 18164 - 18171
Type subroutine
Call s_retbool(tf)
Modulescheme_lang
Notes
 Miniscm

opexe0 {scheme_lang}

Name of routine: opexe0
Source lines: 18176 - 18514
Type subroutine
Call opexe0(op, inline)
Modulescheme_lang
Notes
 Apply Scheme commands - split into opexe0 to opexe14
   load -- let*

opexe1 {scheme_lang}

Name of routine: opexe1
Source lines: 18518 - 18743
Type subroutine
Call opexe1(op)
Modulescheme_lang
Notes
 Scheme procedures letrc -- call/cc

opexe2 {scheme_lang}

Name of routine: opexe2
Source lines: 18747 - 19016
Type subroutine
Call opexe2(op)
Modulescheme_lang
Notes
 Scheme procedures plus -- set-cdr!

opexe3 {scheme_lang}

Name of routine: opexe3
Source lines: 19020 - 19107
Type subroutine
Call opexe3(op)
Modulescheme_lang
Notes
 Scheme procedures not -- eqv?

opexe4 {scheme_lang}

Name of routine: opexe4
Source lines: 19111 - 19220
Type subroutine
Call opexe4(op, plevel)
Modulescheme_lang
Notes
 Scheme procedures force -- gc -- new-segment

opexe5 {scheme_lang}

Name of routine: opexe5
Source lines: 19224 - 19360
Type subroutine
Call opexe5(op, plevel)
Modulescheme_lang
Notes
 Scheme procedures read expression

opexe6 {scheme_lang}

Name of routine: opexe6
Source lines: 19364 - 19419
Type subroutine
Call opexe6(op)
Modulescheme_lang
Notes
 Scheme procedures length -- macro?

opexe7 {scheme_lang}

Name of routine: opexe7
Source lines: 19423 - 19508
Type subroutine
Call opexe7(op)
Modulescheme_lang
Notes
 Mathematical functions

opexe8 {scheme_lang}

Name of routine: opexe8
Source lines: 19512 - 19620
Type subroutine
Call opexe8(op)
Modulescheme_lang
Notes
 A few other library functions eg min, max

opexe9 {scheme_lang}

Name of routine: opexe9
Source lines: 19624 - 19896
Type subroutine
Call opexe9(op)
Modulescheme_lang
Notes
 string functions

getint {scheme_lang}

Name of routine: getint
Source lines: 19898 - 19914
Type subroutine
Call getint(pos, slen, string, res)
Modulescheme_lang
Notes
 Miniscm

opexe10 {scheme_lang}

Name of routine: opexe10
Source lines: 19919 - 20457
Type subroutine
Call opexe10(op, plevel)
Modulescheme_lang
Notes
 Nonstandard library additions for system interface such as system, read-line
 Extensions for i/o and accessing system facilities eg inquire, time, date

opexe11 {scheme_lang}

Name of routine: opexe11
Source lines: 20461 - 20600
Type subroutine
Call opexe11(op)
Modulescheme_lang
Notes
 Statistical library

opexe12 {scheme_lang}

Name of routine: opexe12
Source lines: 20604 - 20988
Type subroutine
Call opexe12(op, plevel)
Modulescheme_lang
Notes
 Procedures that interact with Sib-pair

opexe13 {scheme_lang}

Name of routine: opexe13
Source lines: 20992 - 21583
Type subroutine
Call opexe13(op, plevel)
Modulescheme_lang
Notes
 Manipulate Sib-pair dataset

table_label {scheme_lang}

Name of routine: table_label
Source lines: 21585 - 21610
Type function
Call table_label(i, ncol, table, protect)
Modulescheme_lang
Notes
 Miniscm

alldata {scheme_lang}

Name of routine: alldata
Source lines: 21614 - 21628
Type subroutine
Call alldata(res, extractor)
Modulescheme_lang
Notes
 pedigree data accessor

extract_ped {scheme_lang}

Name of routine: extract_ped
Source lines: 21632 - 21638
Type function
Call extract_ped(i, res)
Modulescheme_lang
Notes
 extractors for different pedigree data fields

extract_id {scheme_lang}

Name of routine: extract_id
Source lines: 21640 - 21646
Type function
Call extract_id(i, res)
Modulescheme_lang
Notes
 Miniscm

extract_iped {scheme_lang}

Name of routine: extract_iped
Source lines: 21648 - 21654
Type function
Call extract_iped(i, res)
Modulescheme_lang
Notes
 Miniscm

extract_fa {scheme_lang}

Name of routine: extract_fa
Source lines: 21656 - 21662
Type function
Call extract_fa(i, res)
Modulescheme_lang
Notes
 Miniscm

extract_mo {scheme_lang}

Name of routine: extract_mo
Source lines: 21664 - 21670
Type function
Call extract_mo(i, res)
Modulescheme_lang
Notes
 Miniscm

extract_imztwin {scheme_lang}

Name of routine: extract_imztwin
Source lines: 21672 - 21678
Type function
Call extract_imztwin(i, res)
Modulescheme_lang
Notes
 Miniscm

opexe14 {scheme_lang}

Name of routine: opexe14
Source lines: 21682 - 21991
Type subroutine
Call opexe14(op)
Modulescheme_lang
Notes
 Scheme and xlispstat list procedures

accum_stats {scheme_lang}

Name of routine: accum_stats
Source lines: 21996 - 22025
Type subroutine
Call accum_stats(x, n, m, mean, ss, minv, maxv)
Modulescheme_lang
Notes
 univariate summary stats - accumulate one observation
   n=obs m=missing mean=mean ss=sum-of-squares minv=min maxv=max

get_quantile {scheme_lang}

Name of routine: get_quantile
Source lines: 22029 - 22050
Type subroutine
Call get_quantile(q, n, rvals, val, ifault)
Modulescheme_lang
Notes
 ith quantile

opexe17 {scheme_lang}

Name of routine: opexe17
Source lines: 22054 - 22082
Type subroutine
Call opexe17(op)
Modulescheme_lang
Notes
 car-cdr compositions

opexe18 {scheme_lang}

Name of routine: opexe18
Source lines: 22086 - 22172
Type subroutine
Call opexe18(op)
Modulescheme_lang
Notes
 set procedures

opexe15 {scheme_lang}

Name of routine: opexe15
Source lines: 22177 - 22880
Type subroutine
Call opexe15(op)
Modulescheme_lang
Notes
 Miniscm

opexe16 {scheme_lang}

Name of routine: opexe16
Source lines: 22886 - 23224
Type subroutine
Call opexe16(op)
Modulescheme_lang
Notes
 Miniscm

mk_syntax {scheme_lang}

Name of routine: mk_syntax
Source lines: 23230 - 23238
Type subroutine
Call mk_syntax(op, nam)
Modulescheme_lang
Notes

 Initialization of internal keywords

mk_proc {scheme_lang}

Name of routine: mk_proc
Source lines: 23240 - 23249
Type subroutine
Call mk_proc(op, nam)
Modulescheme_lang
Notes
 Miniscm

init_vars_global {scheme_lang}

Name of routine: init_vars_global
Source lines: 23253 - 23260
Type subroutine
Call init_vars_global()
Modulescheme_lang
Notes
 Initiate global environment

init_syntax {scheme_lang}

Name of routine: init_syntax
Source lines: 23264 - 23282
Type subroutine
Call init_syntax()
Modulescheme_lang
Notes
 Initiate syntax

init_procs {scheme_lang}

Name of routine: init_procs
Source lines: 23286 - 23629
Type subroutine
Call init_procs()
Modulescheme_lang
Notes
 Initiate procedures

init_scm {scheme_lang}

Name of routine: init_scm
Source lines: 23633 - 23810
Type subroutine
Call init_scm()
Modulescheme_lang
Notes
 Inlined init.scm

init_globals {scheme_lang}

Name of routine: init_globals
Source lines: 23814 - 23826
Type subroutine
Call init_globals()
Modulescheme_lang
Notes
 Initiate procedures

error0 {scheme_lang}

Name of routine: error0
Source lines: 23830 - 23836
Type subroutine
Call error0(s)
Modulescheme_lang
Notes
 Error handling

error1 {scheme_lang}

Name of routine: error1
Source lines: 23838 - 23846
Type subroutine
Call error1(s, a)
Modulescheme_lang
Notes
 Miniscm

init_scheme {scheme_lang}

Name of routine: init_scheme
Source lines: 23848 - 23851
Type subroutine
Call init_scheme()
Modulescheme_lang
Notes
 Miniscm

repl_scheme {scheme_lang}

Name of routine: repl_scheme
Source lines: 23855 - 23956
Type subroutine
Call repl_scheme(inline, ple)
Modulescheme_lang
Notes
 Scheme read-eval-print loop

setup_cats {categorical_data}

Name of routine: setup_cats
Source lines: 23971 - 23996
Type subroutine
Call setup_cats(categories)
Modulecategorical_data
Notes
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes

clean_cats {categorical_data}

Name of routine: clean_cats
Source lines: 23998 - 24005
Type subroutine
Call clean_cats(categories)
Modulecategorical_data
Notes
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes

relevel_cats {categorical_data}

Name of routine: relevel_cats
Source lines: 24009 - 24031
Type subroutine
Call relevel_cats(categories, dataset)
Modulecategorical_data
Notes
 recode levels so they match collation order of labels

reorder_cat {categorical_data}

Name of routine: reorder_cat
Source lines: 24033 - 24068
Type subroutine
Call reorder_cat(table, trait, dataset, allinteger)
Modulecategorical_data
Notes
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes

append_annotation {categorical_data}

Name of routine: append_annotation
Source lines: 24072 - 24087
Type subroutine
Call append_annotation(cell, annotation, spaces)
Modulecategorical_data
Notes
 List levels of categorical trait for annotation

annotate_cat {categorical_data}

Name of routine: annotate_cat
Source lines: 24089 - 24115
Type subroutine
Call annotate_cat(table, annotation, allinteger)
Modulecategorical_data
Notes
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes

add_scheme_annotation {categorical_data}

Name of routine: add_scheme_annotation
Source lines: 24117 - 24127
Type subroutine
Call add_scheme_annotation(loc, annotation)
Modulecategorical_data
Notes
 Factor type representations for categorical data 
 Currently factor labels are recorded in locnotes

create_form {formula_class}

Name of routine: create_form
Source lines: 24168 - 24324
Type subroutine
Call create_form(sta, fin, terms, nloci, loc, lochash, formula)
Moduleformula_class
Notes
 read commands and write appropriate formula structure

cleanup_form {formula_class}

Name of routine: cleanup_form
Source lines: 24326 - 24337
Type subroutine
Call cleanup_form(formula)
Moduleformula_class
Notes
 Simple regression formula structure and parser

 formula and design matrix
 formula is:   a   b   c   a*b   a*c   b*c  a*b*c
         T1    1   2   3    1     1     2     1
         T2    .   .   .    2     3     3     2
         T3    .   .   .    .     .     .     3
    TERMDIM    1   1   1    2     2     2     3

 Effects       1    2     3
         NLEV  n1   n2    n3
         STA   1    n1+1  n1+n2+1
         FIN   n1   n1+n2 n1+n2+n3
       INFORM  1    1     1       

sumcols_form {formula_class}

Name of routine: sumcols_form
Source lines: 24341 - 24381
Type subroutine
Call sumcols_form(formula)
Moduleformula_class
Notes
 If levels available, evaluate total number of model parameters
 

show_form {formula_class}

Name of routine: show_form
Source lines: 24383 - 24404
Type subroutine
Call show_form(formula)
Moduleformula_class
Notes
 Simple regression formula structure and parser

 formula and design matrix
 formula is:   a   b   c   a*b   a*c   b*c  a*b*c
         T1    1   2   3    1     1     2     1
         T2    .   .   .    2     3     3     2
         T3    .   .   .    .     .     .     3
    TERMDIM    1   1   1    2     2     2     3

 Effects       1    2     3
         NLEV  n1   n2    n3
         STA   1    n1+1  n1+n2+1
         FIN   n1   n1+n2 n1+n2+n3
       INFORM  1    1     1       

setup_props {mcmc_model}

Name of routine: setup_props
Source lines: 24564 - 24568
Type subroutine
Call setup_props(maxsiz)
Modulemcmc_model
Notes
 Allocate or deallocate work arrays

clean_props {mcmc_model}

Name of routine: clean_props
Source lines: 24569 - 24571
Type subroutine
Call clean_props()
Modulemcmc_model
Notes
 Allocate or deallocate work arrays

setup_mix {mcmc_model}

Name of routine: setup_mix
Source lines: 24575 - 24630
Type subroutine
Call setup_mix(ped, dataset, nchain, nqtl, nvar, family)
Modulemcmc_model
Notes
 Allocate a pedigree's data arrays

setup_ibd {ibd_class}

Name of routine: setup_ibd
Source lines: 24668 - 24680
Type subroutine
Call setup_ibd(ped, nobs, nvar, family)
Moduleibd_class
Notes
 Allocate a pedigree's data arrays

setup_pairs {pairlist_class}

Name of routine: setup_pairs
Source lines: 24699 - 24709
Type subroutine
Call setup_pairs(npairs, pairlist)
Modulepairlist_class
Notes
 allocate space for pairlist

clean_pairs {pairlist_class}

Name of routine: clean_pairs
Source lines: 24713 - 24719
Type subroutine
Call clean_pairs(pairlist)
Modulepairlist_class
Notes
 deallocate space

expand_pairs {pairlist_class}

Name of routine: expand_pairs
Source lines: 24723 - 24738
Type subroutine
Call expand_pairs(nextra, pairlist)
Modulepairlist_class
Notes
 increase available space

append_pair {pairlist_class}

Name of routine: append_pair
Source lines: 24742 - 24756
Type subroutine
Call append_pair(key1, key2, pairlist)
Modulepairlist_class
Notes
 
 append data, testing only latest entry for uniqueness

insert_pair {pairlist_class}

Name of routine: insert_pair
Source lines: 24760 - 24808
Type subroutine
Call insert_pair(key1, key2, pairlist)
Modulepairlist_class
Notes
 insert data

find_pair {pairlist_class}

Name of routine: find_pair
Source lines: 24812 - 24851
Type function
Call find_pair(key1, key2, pairlist)
Modulepairlist_class
Notes
 find a pair

complete {covariate_data}

Name of routine: complete
Source lines: 24875 - 24909
Type function
Call complete(useimp, idx, nvar, terms, locpos, loctyp, dataset)
Modulecovariate_data
Notes
  
 test if complete data for i'th individual
  

varlevels {covariate_data}

Name of routine: varlevels
Source lines: 24914 - 25003
Type subroutine
Call varlevels(typ, gene, numal, nvar, varlist, loc, loctyp, locpos, dataset, covariates, plevel)
Modulecovariate_data
Notes
 Collect necessary information to create dummy variables encoding a categorical trait
 allocates necessary marginal table storage

fixeff {covariate_data}

Name of routine: fixeff
Source lines: 25014 - 25148
Type subroutine
Call fixeff(idx, designpos, interc, gene, genemod, allele_buffer, nvar, varlist, nloci, loctyp, locpos, covariates, dataset, vals, stand)
Modulecovariate_data
Notes
 One row of the design matrix for the fixed effects part of model for varcom and segsim.
 Possibly including one marker for full dummy encoding.
 Possibly including an intercept.
 Missing x values replaced by overall mean
 NB (20150813): if intercept present, then covariates off by one - repaired

 Values may be stand=1: untransformed 
               stand=2: rescaled, affecting only quantitative traits

xmeans {covariate_data}

Name of routine: xmeans
Source lines: 25152 - 25248
Type subroutine
Call xmeans(nvar, varlist, nloci, loctyp, locpos, dataset, covariates)
Modulecovariate_data
Notes
  
 Means for set of variables (incl dummies) in formula
  

inicov {AS164}

Name of routine: inicov
Source lines: 25260 - 25271
Type subroutine
Call inicov(nter, ncov, r)
ModuleAS164
Notes
  
 Initialize covariance matrix used by AS164
  

givenc {AS164}

Name of routine: givenc
Source lines: 25276 - 25356
Type subroutine
Call givenc(r, ir, nvars, x, v, ifault)
ModuleAS164
Notes
  
 Algorithm AS164  Appl. Statist. (1981) vol.30, no.2
 Incorporate new row of data into R matrix
  

bsub {AS164}

Name of routine: bsub
Source lines: 25361 - 25458
Type subroutine
Call bsub(r, ir, idep, coeff, ic, ifault)
ModuleAS164
Notes
  
 Algorithm AS 164.1  Appl. Statist. (1981) vol.30, no.2
 Perform back substitution to get regression coefficient estimates
  

var {AS164}

Name of routine: var
Source lines: 25463 - 25564
Type subroutine
Call var(r, ir, s, is, idep, nobs, typ, ifault)
ModuleAS164
Notes
 Algorithm AS164.3  Appl. Statist. (1981) vol.30, no.2
 Estimates var/covar matrix of regression coefficients

alias {AS164}

Name of routine: alias
Source lines: 25570 - 25620
Type subroutine
Call alias(r, ir, nvars, eps, worksp, ifault)
ModuleAS164
Notes
  
 Algorithm AS164.4  Appl. Statist. (1981) vol.30, no.2
 Assumes any diagonal elements of d less than eps are
 rounding errors and reduces them to zero
  

clean_AS164 {AS164_class}

Name of routine: clean_AS164
Source lines: 25631 - 25639
Type subroutine
Call clean_AS164()
ModuleAS164_class
Notes
 Work arrays for AS164 -- allow passing of results to other routines

mvnlik {likelihoods}

Name of routine: mvnlik
Source lines: 25669 - 25725
Type function
Call mvnlik(npar, parest)
Modulelikelihoods
Notes
 MVN model loglikelihood

mftlik {likelihoods}

Name of routine: mftlik
Source lines: 25729 - 25815
Type function
Call mftlik(npar, parest)
Modulelikelihoods
Notes
 MFT model loglikelihood

varmet {varmet_optimizer}

Name of routine: varmet
Source lines: 25831 - 26001
Type subroutine
Call varmet(fun, npar, b, f0, gradtl, toler, maxfn, ifault, plevel)
Modulevarmet_optimizer
Notes
 Algorithm AS 319 
 variable metric function minimisation
 Algorithm AS 319 Appl Statist (1997), Vol 46, No 4
 Converted to Fortran 90 free-format style by Alan Miller
 e-mail: Alan.Miller @ vic.cmis.csiro.au
 URL: www.ozemail.com.au/~milleraj

 Actual varmet minimizer

grad {varmet_optimizer}

Name of routine: grad
Source lines: 26005 - 26048
Type subroutine
Call grad(fun, npar, b, f0, g, sa, er, ifault)
Modulevarmet_optimizer
Notes
 Calculate approximate gradient

vmerr {varmet_optimizer}

Name of routine: vmerr
Source lines: 26052 - 26068
Type subroutine
Call vmerr(ier, maxfn)
Modulevarmet_optimizer
Notes
 varmet error messages

calfun {bobyqa_optimizer}

Name of routine: calfun
Source lines: 26079 - 26089
Type subroutine
Call calfun(n, x, f)
Modulebobyqa_optimizer
Notes
 Mike Powell's BOBYQA minimizer

popgen_init {popgen_vcdata}

Name of routine: popgen_init
Source lines: 28475 - 28480
Type subroutine
Call popgen_init()
Modulepopgen_vcdata
Notes
 Cockerham-like multi-locus variance components

popgen_summary {popgen_vcdata}

Name of routine: popgen_summary
Source lines: 28481 - 28507
Type subroutine
Call popgen_summary(outstr, plevel)
Modulepopgen_vcdata
Notes
 Cockerham-like multi-locus variance components

popgen_homoz {popgen_vcdata}

Name of routine: popgen_homoz
Source lines: 28509 - 28527
Type subroutine
Call popgen_homoz(outstr, plevel)
Modulepopgen_vcdata
Notes
 Cockerham-like multi-locus variance components

setup_kinmat {popgen_kinship}

Name of routine: setup_kinmat
Source lines: 28550 - 28584
Type subroutine
Call setup_kinmat(nobs, ncov, ridge_constant, plevel, ifail)
Modulepopgen_kinship
Notes
 Large dense empirical kinship matrix,
   its latest active subset and corresponding inverse
   and a hash of the ids of the dropped rows

ismemoizedinv {popgen_kinship}

Name of routine: ismemoizedinv
Source lines: 28586 - 28596
Type function
Call ismemoizedinv()
Modulepopgen_kinship
Notes
 Large dense empirical kinship matrix,
   its latest active subset and corresponding inverse
   and a hash of the ids of the dropped rows

save_kininv {popgen_kinship}

Name of routine: save_kininv
Source lines: 28600 - 28644
Type subroutine
Call save_kininv(logdet, ainv, stat)
Modulepopgen_kinship
Notes
 write inverse kinship matrix to file

load_kininv {popgen_kinship}

Name of routine: load_kininv
Source lines: 28648 - 28683
Type subroutine
Call load_kininv(logdet, ainv, stat)
Modulepopgen_kinship
Notes
 read kinship inverse from file

has_kinmat {kinship_io}

Name of routine: has_kinmat
Source lines: 28691 - 28696
Type function
Call has_kinmat()
Modulekinship_io
Notes
 Higher level i/o routines for popgen_kinship

subset_active {kinship_io}

Name of routine: subset_active
Source lines: 28700 - 28719
Type subroutine
Call subset_active(dataset, nwanted, nreturned, indices)
Modulekinship_io
Notes
 Indices for subset of active individuals

showkin {kinship_io}

Name of routine: showkin
Source lines: 28723 - 28805
Type subroutine
Call showkin(nrows, dataset, plevel)
Modulekinship_io
Notes
 head kinmat

highkin {kinship_io}

Name of routine: highkin
Source lines: 28809 - 28852
Type subroutine
Call highkin(dataset, plevel)
Modulekinship_io
Notes
 Show high kinships

kinridge {kinship_io}

Name of routine: kinridge
Source lines: 28856 - 28868
Type subroutine
Call kinridge(ridge_constant)
Modulekinship_io
Notes
 Add ridge constant

setup_bigC {kinship_io}

Name of routine: setup_bigC
Source lines: 28872 - 28904
Type subroutine
Call setup_bigC(dataset, plevel)
Modulekinship_io
Notes
   Set large C matrix

setup_bigA {kinship_io}

Name of routine: setup_bigA
Source lines: 28908 - 28956
Type subroutine
Call setup_bigA(dataset, plevel)
Modulekinship_io
Notes
   Set large A matrix

readkin {kinship_io}

Name of routine: readkin
Source lines: 28962 - 29097
Type subroutine
Call readkin(fil, ridge_constant, hashtab, dataset, ifail, plevel)
Modulekinship_io
Notes
 Read a kinship matrix in from a file, allocating kinmat
   ped1 id1 ped2 id2 ... kin
   uses untyped() to filter useable values

readgrm {kinship_io}

Name of routine: readgrm
Source lines: 29102 - 29305
Type subroutine
Call readgrm(file_prefix, ridge_constant, hashtab, dataset, ifail, plevel)
Modulekinship_io
Notes
 Read in GCTA binary format GRM
 mapping from grm to pedigree     1 0 2 3 10 4 0 ...

writegrm {kinship_io}

Name of routine: writegrm
Source lines: 29309 - 29403
Type subroutine
Call writegrm(file_prefix, trait, dataset, plevel)
Modulekinship_io
Notes
 Write out GCTA binary format GRM

get_kinship {kinship_io}

Name of routine: get_kinship
Source lines: 29407 - 29463
Type subroutine
Call get_kinship(nfull, nreduced, active, a)
Modulekinship_io
Notes
 Subset full kinship matrix

protect_kin {kinship_io}

Name of routine: protect_kin
Source lines: 29465 - 29469
Type subroutine
Call protect_kin(on)
Modulekinship_io
Notes
 Higher level i/o routines for popgen_kinship

free_kin {kinship_io}

Name of routine: free_kin
Source lines: 29471 - 29505
Type subroutine
Call free_kin(plevel)
Modulekinship_io
Notes
 Higher level i/o routines for popgen_kinship

pre_grapheps {grapheps}

Name of routine: pre_grapheps
Source lines: 29515 - 29847
Type subroutine
Call pre_grapheps(outstr, xbound, ybound)
Modulegrapheps
Notes
 The grapheps Postscript functions
 See http://swiss.csail.mit.edu/~jaffer/Docupage/grapheps

xy_grapheps {grapheps}

Name of routine: xy_grapheps
Source lines: 29854 - 29968
Type subroutine
Call xy_grapheps(outstr, nvals, xvals, yvals, xlab, ylab, title, gstyle, gratio, typ)
Modulegrapheps
Notes
 Draw simple plot

 typ 1=scatterplot 2=jittered dotplot 3=mountain 4=bargraph
     10=square Q-Q plot

scatter_grapheps {grapheps}

Name of routine: scatter_grapheps
Source lines: 29972 - 30037
Type subroutine
Call scatter_grapheps(outstr, nvals, symbols, xvals, yvals, slab, xlab, ylab, title, gratio)
Modulegrapheps
Notes
 Draw scatterplot with different glyphs for each category

nextcmd

Name of routine: nextcmd
Source lines: 41564 - 41622
Type subroutine
Call nextcmd(commands, numcmd, linlen, s, more)
ModuleNone
Notes
 count number of commands on line and delineate next command 
 (using position of ";"'s) to be evaluated

ival

Name of routine: ival
Source lines: 41626 - 41673
Type function
Call ival(string)
ModuleNone
Notes
 character to integer conversion via internal read

fval

Name of routine: fval
Source lines: 41677 - 41705
Type function
Call fval(string)
ModuleNone
Notes
 character to float conversion via internal read

fval2

Name of routine: fval2
Source lines: 41709 - 41739
Type subroutine
Call fval2(string, res, ierr)
ModuleNone
Notes
 subroutine version

frommega

Name of routine: frommega
Source lines: 41743 - 41765
Type subroutine
Call frommega(mapval, bpval)
ModuleNone
Notes
 Lossless conversion of double precision Mbp to integer bp

aval

Name of routine: aval
Source lines: 41770 - 41822
Type function
Call aval(string, gcode)
ModuleNone
Notes
 read allele values either numeric or letter code
   range of legal alleles depends on storage type

locfmt

Name of routine: locfmt
Source lines: 41826 - 41856
Type subroutine
Call locfmt(str, rep, newtyp)
ModuleNone
Notes
 Read simplified locus declaration eg 10m 10 m -> 10 autosomal markers

sow

Name of routine: sow
Source lines: 41860 - 41870
Type function
Call sow(string)
ModuleNone
Notes
 skip leading whitespace

eow

Name of routine: eow
Source lines: 41874 - 41883
Type function
Call eow(string)
ModuleNone
Notes
 find end of string

sclean

Name of routine: sclean
Source lines: 41887 - 41895
Type subroutine
Call sclean(string)
ModuleNone
Notes
 scrub non-ASCII characters

ismiss

Name of routine: ismiss
Source lines: 41899 - 41903
Type function
Call ismiss(string)
ModuleNone
Notes
  See if a string is a missing value

isint

Name of routine: isint
Source lines: 41907 - 41934
Type function
Call isint(string)
ModuleNone
Notes
  see if a string is a valid integer

isreal

Name of routine: isreal
Source lines: 41938 - 41957
Type function
Call isreal(string)
ModuleNone
Notes
  see if a string is a valid double precision number

iscomment

Name of routine: iscomment
Source lines: 41961 - 41976
Type function
Call iscomment(string)
ModuleNone
Notes
  See if a string is a comment

ismappos

Name of routine: ismappos
Source lines: 41983 - 42012
Type function
Call ismappos(string)
ModuleNone
Notes
 See if a string is a map position of form CHR:bp
   0 = no
   1 = <any>:<int>
   2 = [chr](<int>|X|Y|XY|MT):<int>

wrsex

Name of routine: wrsex
Source lines: 42016 - 42025
Type subroutine
Call wrsex(sex,ch)
ModuleNone
Notes
  
 write sex as character
  

wrdate

Name of routine: wrdate
Source lines: 42029 - 42041
Type subroutine
Call wrdate(date,str,typ)
ModuleNone
Notes
 write date as character

wraff

Name of routine: wraff
Source lines: 42045 - 42056
Type subroutine
Call wraff(value, ch, typ)
ModuleNone
Notes
  
 binary trait as character
  

wrform

Name of routine: wrform
Source lines: 42060 - 42077
Type subroutine
Call wrform(typ, nwid, ndec, fstring)
ModuleNone
Notes
 Fortran format statement to write one number

idwidths

Name of routine: idwidths
Source lines: 42081 - 42109
Type subroutine
Call idwidths(dataset, widths, name_formats)
ModuleNone
Notes
 Get maximum lengths of ID strings

phist

Name of routine: phist
Source lines: 42113 - 42129
Type subroutine
Call phist(pval1, pval2, histo)
ModuleNone
Notes
  
 Write P-values as a histogram: . + * ** ***
  

pstring

Name of routine: pstring
Source lines: 42133 - 42164
Type function
Call pstring(pval)
ModuleNone
Notes
  
 Write P-values as a string
  

corstring

Name of routine: corstring
Source lines: 42168 - 42178
Type function
Call corstring(rval)
ModuleNone
Notes
  
 Write correlation as a 6 character string (deal nicely with -1)
  

append

Name of routine: append
Source lines: 42182 - 42192
Type subroutine
Call append(word, note)
ModuleNone
Notes
 append one word to a string if enough room

addlet

Name of routine: addlet
Source lines: 42197 - 42207
Type subroutine
Call addlet(old, new)
ModuleNone
Notes
  
 prepend "x" to a string if starts with an integer
 Loki and R for example do not allow variable names that start with a digit
  

shorten

Name of routine: shorten
Source lines: 42212 - 42253
Type subroutine
Call shorten(idx, nwords, words, newlen, res)
ModuleNone
Notes
  
 create a shorter unique version of a string eg locus name
 Old versions of MENDEL for instance wants 8 character locus names
  

makeind

Name of routine: makeind
Source lines: 42258 - 42304
Type subroutine
Call makeind(typ, idx, eos, los, string)
ModuleNone
Notes
  
 hash an integer to a two character string 01-99,A-Z,a-z,a-z...
 append to name: typ=1, appended with underscore; typ=2, appended directly
  

mktmpfil

Name of routine: mktmpfil
Source lines: 42308 - 42330
Type subroutine
Call mktmpfil(str, filnam, wrkdir, ioerr)
ModuleNone
Notes
  
 Create a new unique temporary file 
  

wrinline

Name of routine: wrinline
Source lines: 42335 - 42354
Type subroutine
Call wrinline(nlin, outstr)
ModuleNone
Notes
 Copy inline data to a file
 Relies on iostat=-2 as eol to use lin as a buffer

openlog

Name of routine: openlog
Source lines: 42358 - 42385
Type subroutine
Call openlog(lstr, logfil, nhis)
ModuleNone
Notes
 Open the standard log file "sib-pair.log"

findfile

Name of routine: findfile
Source lines: 42391 - 42420
Type subroutine
Call findfile(filnam, stat)
ModuleNone
Notes
 System utilities

 Find a file along the search path -- check pwd, then HOME first

expandtilde

Name of routine: expandtilde
Source lines: 42424 - 42438
Type subroutine
Call expandtilde(filnam)
ModuleNone
Notes
 Evaluate tilde in path names

delfile

Name of routine: delfile
Source lines: 42442 - 42459
Type subroutine
Call delfile(filnam, plevel)
ModuleNone
Notes
 Delete a file

unzipper

Name of routine: unzipper
Source lines: 42464 - 42485
Type subroutine
Call unzipper(filnam, wrkfil, gzipped)
ModuleNone
Notes
 Flag a file as gzip compressed and 
 unzip for reading (necessary for binary files)

reclen

Name of routine: reclen
Source lines: 42493 - 42532
Type subroutine
Call reclen(port, buffer, longest, testlines, skipcomments)
ModuleNone
Notes
 Return length of longest line of file
 Use lin as buffer
 Relies on iostat code for eol
 testlines limits to the first testlines lines: set to -1 to check all
 if skipcomments is set, testlines excludes comment lines

filecols

Name of routine: filecols
Source lines: 42537 - 42569
Type subroutine
Call filecols(port, buffer, testlines, nwords, plevel)
ModuleNone
Notes
 Return representative number of words per line in file
 Use lin as buffer

fchooser

Name of routine: fchooser
Source lines: 42575 - 42627
Type subroutine
Call fchooser(fil, gui, plevel)
ModuleNone
Notes
 GUI stuff
 Uses JAPI to call AWT, or PILIB to call GTK2 if present
 else simple file picker

fpicker

Name of routine: fpicker
Source lines: 42632 - 42738
Type subroutine
Call fpicker(fil, plevel)
ModuleNone
Notes
 Text based Windows file picker

fpicker

Name of routine: fpicker
Source lines: 42743 - 42827
Type subroutine
Call fpicker(fil, plevel)
ModuleNone
Notes
 Text based file picker

info

Name of routine: info
Source lines: 42832 - 42927
Type subroutine
Call info(lin, burnin, imp, iter, mapf, mincnt, plevel, genemod, showorig, chek, droperr, prompt, use2, gui, twintrait, sexmarker, datdir, wrkdir)
ModuleNone
Notes
 Display information about program and current settings

help

Name of routine: help
Source lines: 42931 - 43470
Type subroutine
Call help(typ, regexp, lin, twrk)
ModuleNone
Notes
  
 brief online help
  

shell

Name of routine: shell
Source lines: 43474 - 43507
Type subroutine
Call shell(lin, plevel)
ModuleNone
Notes
 pass line to shell -- requires existence of fairly
                       standard routine system()

stamp

Name of routine: stamp
Source lines: 43511 - 43527
Type subroutine
Call stamp(t0)
ModuleNone
Notes
  
 write elapsed time since first/last asked
  

proct

Name of routine: proct
Source lines: 43531 - 43539
Type subroutine
Call proct(t1, plevel)
ModuleNone
Notes
  
 time a procedure
  

getlin

Name of routine: getlin
Source lines: 43543 - 43559
Type subroutine
Call getlin(port, narg, words, lin, skipbl)
ModuleNone
Notes
  
 Get a line from a port
  

rdmerloc

Name of routine: rdmerloc
Source lines: 43563 - 43663
Type subroutine
Call rdmerloc(port, xli, nloci, loc, locpos, outpos, loctyp, locnotes, numloc, twinning, twintype, twintrait, nread, plevel)
ModuleNone
Notes
  
 Read a MERLIN locus file
  

rdloci

Name of routine: rdloci
Source lines: 43672 - 43861
Type subroutine
Call rdloci(port, typ, chrcode, namechek, nloci, loc, lochash, locpos, outpos, loctyp, locnotes, numloc, group, map, nread)
ModuleNone
Notes
 Read PLINK or other .map file (combines locus and map information)
   typ=1: standard PLINK, one dummy trait, overwrite any existing loci
       2: PLINK, no dummy trait, append
       3: Other, columns specified, append
   chrcode=1: standard codes for chromosomes, number, X, Y, Mt
           2: and, 23=X 24=Y 25=PAR 26=Mit

getfilehint

Name of routine: getfilehint
Source lines: 43868 - 43881
Type subroutine
Call getfilehint(filnam, filtyp)
ModuleNone
Notes
 read file suffix to obtain hint as to type, currently:
   filtyp 3 GTF/GFF
          4 VCF
          5 PLINK .bim

maphead

Name of routine: maphead
Source lines: 43885 - 44122
Type subroutine
Call maphead(port, units, filehinted, lin, words, filtyp, nampos, chrpos, bppos, mappos, mapunits, plevel)
ModuleNone
Notes
 Read start of map file, working out file type or column names

comparemap

Name of routine: comparemap
Source lines: 44126 - 44287
Type subroutine
Call comparemap(port, plevel)
ModuleNone
Notes
 Compare Sib-pair map and locus list to map

renamer

Name of routine: renamer
Source lines: 44291 - 44399
Type subroutine
Call renamer(port, pos_chrom, pos_bp, pos_id, plevel)
ModuleNone
Notes
 rename loci based on matching position on a map

testflips_map

Name of routine: testflips_map
Source lines: 44404 - 44581
Type subroutine
Call testflips_map(port, plevel)
ModuleNone
Notes
 test strand flips based on matching to a reference set
   reads a VCF or GTF file

testflips_fasta

Name of routine: testflips_fasta
Source lines: 44589 - 44703
Type subroutine
Call testflips_fasta(typ, fil, plevel)
ModuleNone
Notes
 Compare reference alleles in annotation to the consensus allele 
   from FASTA sequence file
   Scans annotations rather than map file since latter is indexed and bigger.
   Swaps around the references alleles in the annotation to match the consensus
   Does not touch actual genotypes

testflips_source

Name of routine: testflips_source
Source lines: 44708 - 44899
Type subroutine
Call testflips_source(typ, lodthresh, loc, trait, loctyp, locnote, gene, locnam, allele_buffer, dataset, assoc_stat, statval, plevel)
ModuleNone
Notes
 Test for allele swaps or flips for genotypes coming from different sources
 typ=1 report, typ=2 carry out swap in appropriate stratum

flipper

Name of routine: flipper
Source lines: 44905 - 45087
Type subroutine
Call flipper(typ, port, dataset, plevel)
ModuleNone
Notes
 flip strand based on matching to a reference set
   typ=1 looks in annotations for "[A/B]" A=Ref B=Alt
   typ=2 reads a VCF or GTF file

readstats

Name of routine: readstats
Source lines: 45091 - 45166
Type subroutine
Call readstats(port, statcol, lin, words, plevel)
ModuleNone
Notes
  
 Read a set of locus statistics for locstat - usually P-values
  

readmap

Name of routine: readmap
Source lines: 45171 - 45456
Type subroutine
Call readmap(port, units, filehint, lin, words, plevel)
ModuleNone
Notes
  
 Read a mapfile -- attempts to intelligently decide
 what to read
  

readnames

Name of routine: readnames
Source lines: 45460 - 45493
Type subroutine
Call readnames(port, nloci, loc, lochash, chosen)
ModuleNone
Notes
 Read a list of locus names from a file to keep/drop/undrop

rdlinloc

Name of routine: rdlinloc
Source lines: 45497 - 45707
Type subroutine
Call rdlinloc(port, lin, words, nord, numloc)
ModuleNone
Notes
  
 Read a Linkage locus file
  

rdfreq

Name of routine: rdfreq
Source lines: 45714 - 45863
Type subroutine
Call rdfreq(typ, sta, fin, words, allele_buffer)
ModuleNone
Notes
 Read a set of allele frequencies from the command line, 
 making up some numbers if necessary
 typ=1 only expect list of allele frequencies
     2 check for allele names alternating with frequencies

ordvar

Name of routine: ordvar
Source lines: 45868 - 45921
Type subroutine
Call ordvar(twrk, nloci, loc, loctyp, locpos, outpos, nord, locord, group, map, locstat, locnotes, ord)
ModuleNone
Notes
  
 Make change in order of variables
  Note that automatic variables get special treatment (esp since 20180829)
  

packer

Name of routine: packer
Source lines: 45928 - 46092
Type subroutine
Call packer(typ, wrk, wrk2, nloci, loc, loctyp, locpos, group, map, locnotes, numloc, dataset, plevel)
ModuleNone
Notes
 Pack pedigrees and loci
 Writes and reads temporary data to disk
 Note that SNPs stored as 2 genotypes per byte cannot be packed,
  so if hassnps == 2 then slocus is left unchanged 

packloci

Name of routine: packloci
Source lines: 46096 - 46148
Type subroutine
Call packloci(nloci, loc, loctyp, locpos, group, map, locnotes, numloc, plevel)
ModuleNone
Notes
 Pack locus list if dataset not yet read in

bonf

Name of routine: bonf
Source lines: 46152 - 46161
Type function
Call bonf(ntest,alpha)
ModuleNone
Notes
 Calculate Bonferroni corrected P-value for given number of tests

isaff

Name of routine: isaff
Source lines: 46165 - 46197
Type function
Call isaff(val, thresh, gt)
ModuleNone
Notes
  
 Determine if index person is affected or unaffected
  

isatwin

Name of routine: isatwin
Source lines: 46201 - 46209
Type function
Call isatwin(twintype, twinind)
ModuleNone
Notes
 Is an MZ twin?

ismzpair

Name of routine: ismzpair
Source lines: 46214 - 46228
Type function
Call ismzpair(i, j, dataset)
ModuleNone
Notes
 Is pair MZ?
 index i must precede j

order

Name of routine: order
Source lines: 46232 - 46241
Type subroutine
Call order(all1, all2)
ModuleNone
Notes
 swap alleles so ordered consistently

swap

Name of routine: swap
Source lines: 46245 - 46253
Type subroutine
Call swap(all1, all2)
ModuleNone
Notes
  
 swap alleles
  

lorder

Name of routine: lorder
Source lines: 46265 - 46341
Type subroutine
Call lorder(typ, addummy, liab, liabclass, nloci, loctyp, nord, locord)
ModuleNone
Notes
 Create order of loci for outputting a pedigree
  1 = as is
  2 = LINKAGE
  3 = GENEHUNTER
  4 = MENDEL
  5 = LINKAGE PPD
  6 = FBAT
  7 = MERLIN
  

isinenv

Name of routine: isinenv
Source lines: 46345 - 46356
Type function
Call isinenv(word,nvar,envnam)
ModuleNone
Notes
 Is a bound environmental variable? and if so where?

readbin

Name of routine: readbin
Source lines: 46367 - 46642
Type subroutine
Call readbin(strm, filnam, wrkfil, typ, numloc, dataset, red, plevel)
ModuleNone
Notes
 Read a Sib-pair binary file encoded using
 various levels of compression (currently just calls gunzip)
 Default (compress_level=1) is a "Fortran unformatted write" dump of the 
 locus and pedigree arrays
 typ=format version 
    1=current (2012/02) 
    2=older   (2009/08) 
    3=original (change in loctyp coding)

writebin

Name of routine: writebin
Source lines: 46654 - 46732
Type subroutine
Call writebin(strm, compress_level, filnam, dataset, plevel)
ModuleNone
Notes
 Write a Sib-pair binary file
 Default was a "Fortran unformatted write" dump of the 
 locus and pedigree arrays, but now is stream output
 If compress=2, currently calls gzip to compress the resulting file

 2.0 stream based write
 2.1 first NUMENV variables are automatic
 2.2 NUMENV increased by 1
 2.3 adjustable ped_width id_width

readhapmap

Name of routine: readhapmap
Source lines: 46736 - 46908
Type subroutine
Call readhapmap(filnam, numloc, dataset, longnam, red, plevel)
ModuleNone
Notes
 Read in HapMap format

readgeno

Name of routine: readgeno
Source lines: 46917 - 47122
Type subroutine
Call readgeno(typ, port, gt, thresh, skipline, hashtab, dataset, plevel)
ModuleNone
Notes
 Read genotyping file where one genotype per record (eg Sequenom, Illumina report)
 typ=1  id locus_name allele1 allele2 ... [quality score etc]
 typ=2  locus_name id allele1 allele2 ... [quality score etc]
 typ=3  locus_name id qual_score allele1 allele2 
 gt thresh used if quality score available
 skipline defaults to 1 (skipping a header line)

readprobs

Name of routine: readprobs
Source lines: 47136 - 47417
Type subroutine
Call readprobs(port, typ, mergekey, pedfil, longest, hashtab, dataset, plevel)
ModuleNone
Notes
 Read in biallelic genotypic probabilities from a file, 
 imputing the most likely genotype
 Need to have numeric variable in pedigree that matches
 column of genotypes
 Assumes that all SNPs have been declared already
 file formats 
 typ=1: (Beagle)
 marker alleleA alleleB col.3 col.3 col.3 col.5 col.5 col.5 col.7 col.7 col.7 col
 rs885550 C T 0.9846 0.0154 0.0001 0.9846 0.0154 0.0001 0.9846 0.0154 0.0001 0.98
 typ=2:
   -- rs885550 9887804 C T 0.97 0.03 0 0.97 0.03 0 0.97 0.03 0 0.97 0.03 0 0.97

rdplinkdose

Name of routine: rdplinkdose
Source lines: 47423 - 47624
Type subroutine
Call rdplinkdose(port, thresh, longest, hashtab, dataset, plevel)
ModuleNone
Notes
 Merge in most likely genotype based on PLINK dosage file
   SNP A1 A2 00010 0001002 00028 0002801 
   rs2237028 T G 1 2 2 1 0 2 

readmach

Name of routine: readmach
Source lines: 47634 - 47750
Type subroutine
Call readmach(locfil, pedfil, thresh, hashtab, dataset, plevel)
ModuleNone
Notes
 Read MaCH/minimac type allelic dosages
   pedigree file:
     00359 0035902 0035903 0035904 2 -9 2.000  2.000   2.000 
   locus file:
     Z Zygosity
     T COUNT(T,18:28937192)
     T COUNT(G,18:28937474)

rdmachdose

Name of routine: rdmachdose
Source lines: 47754 - 47896
Type subroutine
Call rdmachdose(port, thresh, firstcol, firstloc, longest, hashtab, dataset, nmatched, ngeno, plevel)
ModuleNone
Notes
 Actually read MaCH/minimac dosage file

readvcf

Name of routine: readvcf
Source lines: 47912 - 48018
Type subroutine
Call readvcf(typ, addref, qualstat, gt, thresh, linlen, filnam, numloc, hashtab, dataset, red, plevel)
ModuleNone
Notes
 Read in VCF dataset
    typ=1 read in pedigree data
        2 read in pedigree data where VCF IDs of form ped_id
        3 merge in genotype data on individual ID
        4 merge in genotype data on VCF IDs of form ped_id
        5 report matching IDs in VCF file
        6 count matching VCF IDs of form ped_id
        7 count matching individual IDs
        8 fill in missing genotypes with reference allele homozygote
        9 fill in missing genotypes with major allele homozygote

    addref replaces missing genotypes with reference allele homozygote
    qualstat is the genotype quality score to return in locstat

rdvcfped

Name of routine: rdvcfped
Source lines: 48022 - 48150
Type subroutine
Call rdvcfped(typ, longest, port, numloc, dataset, red, plevel)
ModuleNone
Notes
 read in IDs from VCF dataset

rdvcfgeno

Name of routine: rdvcfgeno
Source lines: 48160 - 48807
Type subroutine
Call rdvcfgeno(typ, addref, qualstat, gt, thresh, longest, port, hashtab, dataset, nmatched, ngeno, plevel)
ModuleNone
Notes
 Actually read VCF file genotypes where corresponding pedigree 
   is active (was all matchable IDs, changed 20161017)
   merge on id (typ=1) or ped_id (typ=2) 
   count matching VCF IDs on id (typ=3) or ped_id (typ=4)
   count matching VCF genotypes on id (typ=5) or ped_id (typ=6)
   if addref, replace missing genotypes with reference allele homozygote
   also check strand etc

refvcfgeno

Name of routine: refvcfgeno
Source lines: 48811 - 49008
Type subroutine
Call refvcfgeno(typ, vcf_ac, vcf_an, port, dataset, plevel)
ModuleNone
Notes
 Replace missing genotypes with reference (ref or maj) allele in VCF file

mergebed

Name of routine: mergebed
Source lines: 49049 - 49560
Type subroutine
Call mergebed(strm, typ, chrcode, keytyp, filnam, hashtab, dataset, plevel)
ModuleNone
Notes
 Read PLINK .bed format
 
 The .bim and .fam files are plain ASCII and allow us to fix the
 expected number of genotypes. In the .bed file, the first 3 bytes
 have a special meaning. The first two bytes are a 'magic number'
 that enables PLINK to confirm that a BED file is really a BED
 file: that is, BED files should always start 01101100 00011011.
 The third byte indicates whether the BED file is in SNP-major or
 individual-major mode: a value of 00000001 indicates SNP-major (i.e.
 list all individuals for first SNP, all individuals for second SNP,
 etc) whereas a value of 00000000 indicates individual-major (i.e.
 list all SNPs for the first individual, list all SNPs for the second
 individual, etc). By default, all BED files are SNP-major mode.

 For the genotype data, each byte encodes up to four genotypes (2 bits
 per genotype). The coding is
             
   00  Homozygote    1/1
   01  Heterozygote  1/2
   11  Homozygote    2/2
   10  Missing       x/x
 
 The only slightly confusing wrinkle is that each byte is effectively read
 backwards. That is, if we label each of the 8 position as A to H, we would
 label backwards: 01101100
                  HGFEDCBA
                  | | | AB   00  -- homozygote (first)
                  | | CD   11  -- other homozygote
                  | EF   01  -- heterozygote
                  GH   10  -- missing genotype (fourth)
 
 Finally, when we reach the end of a SNP (or if in individual-mode, the
 end an individual) we skip to the start of a new byte (i.e. skip any
 remaining bits in that byte).
 
 Data read in is either stored as normal genotypes (typ=1,2) or as 4-bits per
 genotype (typ=3).  A join operation (appending any new loci) is carried out
 for typ=2 or typ=3, while a merge affecting only existing loci is typ=1

fromplink

Name of routine: fromplink
Source lines: 49564 - 49591
Type subroutine
Call fromplink(pcode, a1, a2, snpswap, g1, g2, ngeno)
ModuleNone
Notes
 Convert PLINK .bed genotype codes to alleles

mergefim

Name of routine: mergefim
Source lines: 49604 - 49936
Type subroutine
Call mergefim(typ, mapfil, genofil, chrcode, keytyp, hashtab, dataset, plevel)
ModuleNone
Notes
 Read FImpute imputed genotypes
 
 The snp_info.txt file gives the SNP (FImpute does diallelic markers only) map
 The genotypes_imp.txt gives the genotypes 
 ID       Chip Calls...
 0001001  2    3004440003233
 ...
 First allele is paternal and the second is maternal.
  0=1|1 1=1/2 2=2|2 3=1|2 4=2|1
  5=x/x 6=1|x 7=2|x 8=x|1 9=x|2

fromfimp

Name of routine: fromfimp
Source lines: 49940 - 49962
Type subroutine
Call fromfimp(geno, refall, altall, g1, g2)
ModuleNone
Notes
 Read FImpute output genotype

readcsv

Name of routine: readcsv
Source lines: 49966 - 50021
Type subroutine
Call readcsv(filnam, sepchar)
ModuleNone
Notes
 Test reading csv

readcases

Name of routine: readcases
Source lines: 50028 - 50297
Type subroutine
Call readcases(port, hasid, hassex, skipline, numloc, coltyp, locnotes, dataset, longnam, longest, nwarn, plevel)
ModuleNone
Notes
 Read file containing just unrelated individuals
 Duplicates (if contiguous) are combined into the same "family"
 with appended copy numbers
 Annotates locnotes with labels for categorical variable levels

readpeds

Name of routine: readpeds
Source lines: 50301 - 50825
Type subroutine
Call readpeds(port, wrk, wrk2, skipline, link, unspecified, mztwin, gt, thresh, sexchek, hassex, nextped, numloc, coltyp, dataset, longnam, longest, nwarn, plevel)
ModuleNone
Notes
 Read pedigree file

nextped

Name of routine: nextped
Source lines: 50829 - 50834
Type function
Call nextped(str, pedigree)
ModuleNone
Notes
 Test if current line is next pedigree

nonextped

Name of routine: nonextped
Source lines: 50838 - 50843
Type function
Call nonextped(str, pedigree)
ModuleNone
Notes
 Does not use pedigree IDs

processfam

Name of routine: processfam
Source lines: 50847 - 51002
Type subroutine
Call processfam(sexchek, mztwin, gt, thresh, wrk, wrk2, nped, pedigree, num, nfound, numloc, nobs, buffer, nid, higen, ord, key1, key2, plevel)
ModuleNone
Notes
 All members of pedigree now read in, error check and sort

tabid

Name of routine: tabid
Source lines: 51006 - 51046
Type subroutine
Call tabid(curid, nid, indx, id, counts, incr, idpos)
ModuleNone
Notes
  
 Tabulate alphanumeric IDs in order of appearance
  

addsexes

Name of routine: addsexes
Source lines: 51051 - 51294
Type subroutine
Call addsexes(mztwin, gt, thresh, pedigree, num, buffer, key1, ord, nerr, plevel)
ModuleNone
Notes
 
 Check consistency of sexes, allowing for MZ twins
 and mating cycles

famsort

Name of routine: famsort
Source lines: 51301 - 51453
Type subroutine
Call famsort(pedigree, num, nfound, nid, id, pid, fa, mo, key1, ord, higen, nerr, plevel)
ModuleNone
Notes
 
 Work out generation number ord(), then sort family on
 founder status, generation number, parental ID,
 and personal ID giving their position in ord().
 Returns the ranking in ord(), and the depth of the pedigree in higen
 

mkdummy

Name of routine: mkdummy
Source lines: 51457 - 51483
Type subroutine
Call mkdummy(num, nfound, sx, numloc, buffer)
ModuleNone
Notes
 Create dummy records for added individals

asstyp

Name of routine: asstyp
Source lines: 51487 - 51511
Type subroutine
Call asstyp(nloci, loctyp, locpos, totloc, coltyp)
ModuleNone
Notes
 Assign a locus type to every column of data file

addvar

Name of routine: addvar
Source lines: 51515 - 51592
Type subroutine
Call addvar(wrk, wrk2, dclass, newloc, dataset, plevel)
ModuleNone
Notes
  
 Add extra blank columns to the dataset
  

addtmpvar

Name of routine: addtmpvar
Source lines: 51596 - 51616
Type subroutine
Call addtmpvar(tmpnam, dataset, tmppos, ifail)
ModuleNone
Notes
 Create a temporary quantitative variable

wrkout

Name of routine: wrkout
Source lines: 51620 - 51659
Type subroutine
Call wrkout(wrk, wrk2, ped, dataset, nped, nobs)
ModuleNone
Notes
 Write out current pedigree to a work file, updating number of records

pedin

Name of routine: pedin
Source lines: 51665 - 51723
Type subroutine
Call pedin(wrk, wrk2, nped, nobs, numloc, numcol, dataset)
ModuleNone
Notes
 Read pedigree back in from work files
 May allocate extra blank columns in dataset%plocus for later use
   by numcol > numloc

replacedata

Name of routine: replacedata
Source lines: 51731 - 52048
Type subroutine
Call replacedata(port, typ, nloci, loc, lochash, loctyp, locpos, chosen, hashtab, dataset, longest, plevel)
ModuleNone
Notes
 Read in data updates from a file
 file format: ped id loc1 loc2 ... locN, with header giving locus names
 uses hash to match up ids in file and current dataset
 and to match locus names in file to current dataset
 typ=1 overwrite all =2 update if missing =3 compare

concat

Name of routine: concat
Source lines: 52053 - 52085
Type subroutine
Call concat(dirnam, filnam)
ModuleNone
Notes
 Prefix filnam with a dirnam
 If filnam starts with ~/, expand this instead of dirnam

extprefix

Name of routine: extprefix
Source lines: 52089 - 52108
Type subroutine
Call extprefix(filnam, suffix)
ModuleNone
Notes
 Extract prefix from filnam

extsuffix

Name of routine: extsuffix
Source lines: 52112 - 52125
Type subroutine
Call extsuffix(filnam, suffix)
ModuleNone
Notes
 Extract suffix from filnam

extpath

Name of routine: extpath
Source lines: 52129 - 52146
Type subroutine
Call extpath(filnam)
ModuleNone
Notes
 Extract path from filnam 

slash

Name of routine: slash
Source lines: 52151 - 52164
Type subroutine
Call slash(dirnam, lend)
ModuleNone
Notes
 Test what character used to separate directories
 and append to directory

display

Name of routine: display
Source lines: 52168 - 52199
Type subroutine
Call display(str)
ModuleNone
Notes
 Print a string, stripping out C-style escapes

cat

Name of routine: cat
Source lines: 52203 - 52227
Type subroutine
Call cat(fil)
ModuleNone
Notes
 Display contents of a file

head

Name of routine: head
Source lines: 52231 - 52254
Type subroutine
Call head(fil, nlin)
ModuleNone
Notes
 Display first N lines of a file

countfields

Name of routine: countfields
Source lines: 52259 - 52410
Type subroutine
Call countfields(fil, exclude_comments, plevel)
ModuleNone
Notes
 Utility to count number of columns in a file
   simpler scanner than args

ftranspose

Name of routine: ftranspose
Source lines: 52414 - 52435
Type subroutine
Call ftranspose(fil, misval, plevel)
ModuleNone
Notes
 Utility routine to transpose contents of a file: multipass

ftranspose1

Name of routine: ftranspose1
Source lines: 52439 - 52526
Type subroutine
Call ftranspose1(port, fil, misval, longest, plevel)
ModuleNone
Notes
 Buffered out-of-core transpose

fprinter

Name of routine: fprinter
Source lines: 52530 - 52800
Type subroutine
Call fprinter(nwords, words, linbuf, plevel)
ModuleNone
Notes
 Utility to extract columns from a file

print_sstate

Name of routine: print_sstate
Source lines: 52810 - 52845
Type subroutine
Call print_sstate(port, stype, iskip, ispan, sstring, sstring2, linbuf, inspan, nrec, sstate)
ModuleNone
Notes
 Current line print status based on search strategy and state
   sstate action
   0      nothing
   1      found search string
   2      in search block /start/, /end/
   3      end of search block
   4      in search block /start/, Np ; inspan=line count in block

csvline

Name of routine: csvline
Source lines: 52849 - 52870
Type subroutine
Call csvline(outsep, printn, linenumber, nwords, words)
ModuleNone
Notes
 one line of character separated output

wrinverse

Name of routine: wrinverse
Source lines: 52876 - 53006
Type subroutine
Call wrinverse(fil, typ, ridge_constant, invalg, plevel)
ModuleNone
Notes
 Invert a matrix read from text file, where each line
   comprises a row index, col index, and element value.
   for use with programs such as Wombat

fisherp

Name of routine: fisherp
Source lines: 53010 - 53064
Type subroutine
Call fisherp(fil, firstcol)
ModuleNone
Notes
 Fisher combination of P values on each line of a file

tometasoft

Name of routine: tometasoft
Source lines: 53070 - 53252
Type subroutine
Call tometasoft(lin, plevel)
ModuleNone
Notes
 Combine multiple files (one per study) containing beta, se into single wide
 format for the Metasoft program
 the master list of loci is contained in loc

sibloci

Name of routine: sibloci
Source lines: 53257 - 53295
Type subroutine
Call sibloci(ostr, nloci, loc, loctyp, outpos, group, map, locnotes)
ModuleNone
Notes
 write Sib-pair locus declarations 

fimpmap

Name of routine: fimpmap
Source lines: 53300 - 53373
Type subroutine
Call fimpmap(ostr, chip, dataset)
ModuleNone
Notes
 Write FImpute SNPinfo file
 Note requires 2 or fewer alleles

onchip

Name of routine: onchip
Source lines: 53377 - 53404
Type subroutine
Call onchip(trait, gene, nchips, traittable, chip_fnd, dataset)
ModuleNone
Notes
 Indicate categories that include typed second trait

wrmap

Name of routine: wrmap
Source lines: 53427 - 53734
Type subroutine
Call wrmap(ostr, typ, mapf, nloci, loc, loctyp, locnotes, nord, locord, group, map)
ModuleNone
Notes
  
 Write map
  
 10 = table for Sib-pair output
  0 = LINKAGE
  1 = LINKAGE plus dummy binary trait
  2 = GENEHUNTER plus dummy binary trait
  3 = GENEHUNTER
  4 = MENDEL
 14 = MENDEL free format
 20 = MENDEL .var file
 21 = MENDEL SNP DEF file
  5 = ASPEX
  6 = MERLIN
  7 = LOKI
  8 = STRUCTURE
  9 = SOLAR
 11 = MORGAN
 12 = Haploview
 13 = PLINK    
  

pedhead

Name of routine: pedhead
Source lines: 53739 - 53805
Type subroutine
Call pedhead(strm, typ, pedmask, name_widths, name_formats, nwid, nloci, loc, loctyp)
ModuleNone
Notes
 
 Write out pedigree header with locus names
 either multiline (typ=1) or simple
 

onestripe

Name of routine: onestripe
Source lines: 53809 - 53846
Type subroutine
Call onestripe(strm, linenum, totlines, width, string, truncate)
ModuleNone
Notes
 Writing a string within a given rectangle: one line

pedout

Name of routine: pedout
Source lines: 53861 - 54070
Type subroutine
Call pedout(strm, header, pedmask, fieldsep, allsep, imp, nwid, ndec, sexcode, misval, nrc, skip, filter, show_cat, nloci, loc, loctyp, locpos, locnotes, dataset)
ModuleNone
Notes
 
 Write out GAS style pedigree
 header=print variable names as header
 pedmask=control printing of ped,id,fa,mo,sex fields
 fieldsep=field separator
 allsep=allele separator
 imp=show imputed genotypes
 nwid,ndec=format for quantitative trait values
 misval=missing data token
 nrc=number of records to print
 skip=number of records to skip at beginning
 filter=(1=show all) (2=flagged)
 show_cat=(1=levels) (2=labels)

wrlink

Name of routine: wrlink
Source lines: 54087 - 54317
Type subroutine
Call wrlink(strm, typ, imp, addummy, liabclass, renumall, twinning, twintype, nwid, ndec, nloci, loctyp, locpos, nord, locord, dataset)
ModuleNone
Notes
 
 write out Linkage type file pre- or post- Makeped style

 style     typ property
 --------- --- --------
 lin, pre  1
 ppd       2   extra pedigree pointer fields
 gh        3   MISS='-', ordering binary_trait1, marker1...markerN, quantitative traits
 asp, tcl  4   marker names prepended to file
 hap       5   SNP alleles coded ACGT 1234
 mer       6   If present, zygosity indicator in column 6: 1,3,5...for each MZ set
 
 pre: ped id fa mo sex ...
 ppd: ped.n id.n fa.n mo.n child1.n patsibid.n matsibid.n sex proband.n ...
      where ped.n, id.n are sequential numerical ID number
 

wrphe

Name of routine: wrphe
Source lines: 54323 - 54397
Type subroutine
Call wrphe(strm, typ, nwid, ndec, nloci, loc, loctyp, locpos, dataset)
ModuleNone
Notes
  
 write out Mapmaker-Sibs/FBAT/etc phenotype file
 whitespace delimited ped id trait1...traitN  
 write out Mapmaker-Sibs phenotype file
  

wrcsv

Name of routine: wrcsv
Source lines: 54410 - 54682
Type subroutine
Call wrcsv(strm, typ, imp, nwid, ndec, sep, allsep, misval, gmisval, twinning, twintype, nloci, loc, loctyp, locpos, locnotes, nord, locord, dataset)
ModuleNone
Notes
  
 Write out pedigree as character-delimited
 typ
 1   full pedigree
 2   id,fa,mo,sex,ped,mztwin,hhid (for SOLAR)
 3   ped, id, phenotype_data
 4   id, phenotype_data
 5   ped, id, genotype_data
 6   id, genotype_data
 10  full pedigree with mztwin, na=' ' (for MENDEL 8.0)
 11  full pedigree with mztwin, na='.' (for SAS)
  

wrmorg

Name of routine: wrmorg
Source lines: 54689 - 54845
Type subroutine
Call wrmorg(strm, typ, nwid, ndec, nloci, loc, loctyp, locpos, smlfreq, smlpen, dataset)
ModuleNone
Notes
  
 Write out pedigree for Morgan
 typ
 1   pedigree and traits
 2   id, markers
  

wrfish

Name of routine: wrfish
Source lines: 54849 - 54971
Type subroutine
Call wrfish(strm, ndec, twinning, twintype, nloci, loctyp, locpos, nord, locord, dataset, fstyle, plevel)
ModuleNone
Notes
  
 write out FISHER or MENDEL type pedigree file
  

wrdot

Name of routine: wrdot
Source lines: 54975 - 55111
Type subroutine
Call wrdot(strm, trait, gene, loctyp, nwid, ndec, allsep, dotfixedsep, dotcrossings, dotnodesep, dotranksep, dotboxsize, trcoly, trcoln, trcolx, gcolor, dataset)
ModuleNone
Notes
  
 Describe pedigree using dot graphics language
  

wrarl

Name of routine: wrarl
Source lines: 55115 - 55264
Type subroutine
Call wrarl(strm, popind, typ, nloci, loc, loctyp, locpos, dataset)
ModuleNone
Notes
 write out Arlequin data file (haplotype or genotype data)

wrprd

Name of routine: wrprd
Source lines: 55268 - 55312
Type subroutine
Call wrprd(strm, typ, trait, nloci, loc, loctyp, locpos, dataset)
ModuleNone
Notes
 write out data file used by Jonathon Pritchard's structure program

wrbeagle

Name of routine: wrbeagle
Source lines: 55317 - 55433
Type subroutine
Call wrbeagle(strm, typ, dataset)
ModuleNone
Notes
 write out data file used by Browning and Browning's Beagle program
 exclude MZ cotwins

filter_snp

Name of routine: filter_snp
Source lines: 55437 - 55464
Type subroutine
Call filter_snp(trait, dataset)
ModuleNone
Notes
 filter markers on indicator trait

wrsnp_col

Name of routine: wrsnp_col
Source lines: 55473 - 55574
Type subroutine
Call wrsnp_col(typ, strm, trait, pheno, sep, misval, dataset)
ModuleNone
Notes
 Write out SNPs as ID-major dosages
   typ=1 row ID and column headers
   typ=2 unadorned
 For FImpute genotype files, pheno = array/source 

 reference allele now defaults to annotation if present 20180828

wrsnp_row

Name of routine: wrsnp_row
Source lines: 55582 - 55667
Type subroutine
Call wrsnp_row(typ, strm, trait, sep, misval, dataset)
ModuleNone
Notes
 Write out SNP-major data file with
   typ=1 SNP and column names 
   typ=2 no SNP and column names 
   typ=3 integer genotype encoding used by ROADTRIPS
         genotypes are -9,0,1,2

wrsnp2

Name of routine: wrsnp2
Source lines: 55672 - 55747
Type subroutine
Call wrsnp2(strm, trait, dataset)
ModuleNone
Notes
 Write out PLINK's SNP-major .tped data file format
   genotypes are 0 0,1 1,1 2,2 2 as required by MQLS_XM

wrsnp3

Name of routine: wrsnp3
Source lines: 55754 - 55826
Type subroutine
Call wrsnp3(strm, trait, dataset)
ModuleNone
Notes
 Write out CHIAMO/IMPUTE etc genotype probability file
 
 20 rs1 1000 A C 1 0 0 1 0 0
 20 rs2 2000 G T 1 0 0 0 1 0

wrsnp4

Name of routine: wrsnp4
Source lines: 55832 - 55895
Type subroutine
Call wrsnp4(strm, trait, dose, key, dataset)
ModuleNone
Notes
 Write out SNP-major data file with
 real allelic dose encoding used by WOMBAT
 imputing any missing genotypes

wrpap

Name of routine: wrpap
Source lines: 55899 - 56044
Type subroutine
Call wrpap(trip, phen, nloci, loc, loctyp, locpos, dataset)
ModuleNone
Notes
 Write out old-style PAP pedigree

wrcri

Name of routine: wrcri
Source lines: 56048 - 56115
Type subroutine
Call wrcri(strm, nloci, loc, loctyp, locpos, locord, dataset)
ModuleNone
Notes
  
 Write out .gen pedigree file for CRI-MAP
  

wrvcf

Name of routine: wrvcf
Source lines: 56119 - 56324
Type subroutine
Call wrvcf(strm, typ, trait, filnam, allele_buffer, nord, dataset, plevel)
ModuleNone
Notes
 Write VCF GT format 

wrbed

Name of routine: wrbed
Source lines: 56328 - 56502
Type subroutine
Call wrbed(strm, filnam, trait, censor, allele_buffer, dataset)
ModuleNone
Notes
 Write PLINK .bed format (also used by MENDEL 10.0+)

simdata

Name of routine: simdata
Source lines: 56506 - 56565
Type subroutine
Call simdata(strm, nped, ngen, nminoff, nmaxoff, totloc)
ModuleNone
Notes
 Write a file of simulated pedigrees

showdata

Name of routine: showdata
Source lines: 56569 - 56703
Type subroutine
Call showdata(fped, fid, larg, words, nloci, loc, loctyp, locpos, locnotes, dataset, pedmask, nwid, ndec, sexcode, misval, show_cat, fieldsep, allsep, pstyle)
ModuleNone
Notes
  
 Write out data for particular pedigree or particular person
  

wrind

Name of routine: wrind
Source lines: 56707 - 56800
Type subroutine
Call wrind(idx, nloci, loc, loctyp, locpos, dataset, pedmask, nwid, ndec, misval, allsep, pstyle)
ModuleNone
Notes
  
 Write out data for an individual
  

wrvert

Name of routine: wrvert
Source lines: 56804 - 56887
Type subroutine
Call wrvert(nloci, loc, loctyp, locpos, locnotes, dataset, nwid, ndec, allsep)
ModuleNone
Notes
  
 Write out data for individuals vertically
  

prgtp

Name of routine: prgtp
Source lines: 56891 - 56905
Type subroutine
Call prgtp(idx, gene, dataset, gtp)
ModuleNone
Notes
 print one genotype from dataset

wrid

Name of routine: wrid
Source lines: 56910 - 56930
Type subroutine
Call wrid(just, id, chid, sx)
ModuleNone
Notes
  
 Write id as justified (l,c,r) string, possibly indicating sex
 as male [101] or female (102)
  

wrpercent

Name of routine: wrpercent
Source lines: 56934 - 56944
Type function
Call wrpercent(num, den)
ModuleNone
Notes
 Write out a percentage

wrpercentd

Name of routine: wrpercentd
Source lines: 56946 - 56956
Type function
Call wrpercentd(num, den)
ModuleNone

wrpercentl

Name of routine: wrpercentl
Source lines: 56958 - 56968
Type function
Call wrpercentl(num, den)
ModuleNone

wrtrait

Name of routine: wrtrait
Source lines: 56972 - 57050
Type subroutine
Call wrtrait(val, str, typ, catlabels, nwid, ndec)
ModuleNone
Notes
  
 Write out trait value to a string
  

get_notes

Name of routine: get_notes
Source lines: 57054 - 57070
Type function
Call get_notes(loc, locnote)
ModuleNone
Notes
 Extract annotations from locnotes or from macro variable

get_snpallele1

Name of routine: get_snpallele1
Source lines: 57075 - 57088
Type subroutine
Call get_snpallele1(locnote, alleles)
ModuleNone
Notes

 Extract alleles from locus annotation of form "A/B" to string "AB"

get_snpallele2

Name of routine: get_snpallele2
Source lines: 57092 - 57113
Type subroutine
Call get_snpallele2(locnote, allele_buffer)
ModuleNone
Notes
 Extract alleles from locus annotation of form "A/B" to allele data structure

wrgtp

Name of routine: wrgtp
Source lines: 57119 - 57179
Type subroutine
Call wrgtp(all1, all2, gtp, allsep, locnote, typ)
ModuleNone
Notes
 Write out a genotype
   typ 1=unobserved and observed same style
   typ 2=unobserved genotypes separated by ":", observed " "

wrall

Name of routine: wrall
Source lines: 57183 - 57200
Type subroutine
Call wrall(iall, allel)
ModuleNone
Notes
 Write an allele 

juststr

Name of routine: juststr
Source lines: 57204 - 57231
Type subroutine
Call juststr(just,string,length)
ModuleNone
Notes
 Justify a string of characters within a string

ascend

Name of routine: ascend
Source lines: 57235 - 57242
Type subroutine
Call ascend(n, ia)
ModuleNone
Notes
 
 Initialize array with value of index
 

connect

Name of routine: connect
Source lines: 57246 - 57346
Type subroutine
Call connect(num, fa, mo, set, nsub, maxgrp)
ModuleNone
Notes
 See if all members of a pedigree are connected

addlist

Name of routine: addlist
Source lines: 57351 - 57361
Type subroutine
Call addlist(pos, idx, set)
ModuleNone
Notes
 Shift an individual from the list of ungrouped individuals
 to the appropriate group (subpedigree) nucleating around the index person.

findlist

Name of routine: findlist
Source lines: 57365 - 57380
Type subroutine
Call findlist(trget, num, set, pos)
ModuleNone
Notes
 Find list number <target>

badloop

Name of routine: badloop
Source lines: 57384 - 57452
Type subroutine
Call badloop(pedigree, num, id, key, fa, mo, nerr)
ModuleNone
Notes
 Find pathological loops in current pedigree

wrsubped

Name of routine: wrsubped
Source lines: 57456 - 57494
Type subroutine
Call wrsubped(pedigree, num, id, key, set, nsub, maxgrp, plevel)
ModuleNone
Notes
 List the members of pedigree(s)

gener

Name of routine: gener
Source lines: 57500 - 57672
Type subroutine
Call gener(pedigree, num, fa, mo, nsub, set, ord, higen, nerr, plevel)
ModuleNone
Notes
 Work out generation number ord().
 Visit every person in each subpedigree in turn.
 The missing value for generation must be a large negative value.

dogen

Name of routine: dogen
Source lines: 57677 - 57814
Type subroutine
Call dogen(dataset, trait, typ, plevel)
ModuleNone
Notes
 Write out pedigrees as list of nuclear families plus marry-ins by
 generation number

wrgen

Name of routine: wrgen
Source lines: 57819 - 57876
Type subroutine
Call wrgen(ped, dataset, curped, set, higen, ord)
ModuleNone
Notes
 Write out structure and generation numbers
   List of sibships by generation number

tidydata

Name of routine: tidydata
Source lines: 57880 - 57927
Type subroutine
Call tidydata(nloci, loctyp, locpos, dataset, tottyp)
ModuleNone
Notes
 Round up allele sizes etc

duplicates

Name of routine: duplicates
Source lines: 57931 - 57966
Type subroutine
Call duplicates(dataset, plevel)
ModuleNone
Notes
 Check for duplicate pedigrees or records

showdups

Name of routine: showdups
Source lines: 57970 - 57998
Type subroutine
Call showdups(pos, ncopies, pedname, pedpos, dataset, plevel)
ModuleNone
Notes
 Print the duplicates for current pedigree

testhap

Name of routine: testhap
Source lines: 58002 - 58207
Type subroutine
Call testhap(typ, nloci, loc, loctyp, locpos, dataset, inconsist, plevel)
ModuleNone
Notes
 Check haploid markers 1=Y 2=Mit

testsex

Name of routine: testsex
Source lines: 58234 - 58610
Type subroutine
Call testsex(seximpute, sexcrit, sexmarker, heterror, nloci, loc, lochash, loctyp, locpos, dataset, allele_buffer, inconsist, plevel)
ModuleNone
Notes
 Check sex using sex-linked markers assuming false het call rate z

 Male outcomes     A        AB         B
                 p(1-z)     z         q(1-z)

 Female outcomes   AA       AB         BB
                pp(1-z) 2pq+z(1-2pq)  qq(1-z)

 LR(G=AB) = Pr(AB|Sex=M)/Pr(AB|Sex=Female)
                  z
          = -----------------------
               2pq+z(1-2pq)
          = z/(2pq+z(1-2pq))

 LR(G=AA) = Pr(A|Sex=M)/Pr(AA|Sex=Female)
                  p
          = -----------------------
                 p^2
          = 1/p

 Absence of Y-haplotype data can be female sex or ungenotyped
 With core exome data at least, a subset of Y snps regularly appear 
 typed in females, but Scott Gordon points out there is still strongly
 informative bimodality in total typed per individual.

imputesex

Name of routine: imputesex
Source lines: 58615 - 58817
Type subroutine
Call imputesex(seximpute, dataset, plevel)
ModuleNone
Notes
 
 Test consistency of sexes
 Assign consistent sexes where missing, allowing for possible MZ twins

mzgtp

Name of routine: mzgtp
Source lines: 58821 - 58980
Type subroutine
Call mzgtp(mztwin, gt, thresh, nloci, loc, loctyp, locpos, dataset, inconsist, plevel)
ModuleNone
Notes
 Test monozygotic twins

dropt2

Name of routine: dropt2
Source lines: 58985 - 59178
Type subroutine
Call dropt2(mztwin, gt, thresh, typ, nloci, loc, loctyp, locpos, dataset, plevel)
ModuleNone
Notes
  
 Delete MZ twin with least phenotype information out of pair
 or clean MZ genotypes
  

countmz

Name of routine: countmz
Source lines: 59182 - 59294
Type subroutine
Call countmz(mztwin, gt, thresh, dataset, plevel)
ModuleNone
Notes
 Count up MZ twins, triplets, quads, higher

mzfind

Name of routine: mzfind
Source lines: 59299 - 59502
Type subroutine
Call mzfind(typ, mztrait, mistyping, minmarkers, nloci, loc, loctyp, locpos, locstat, dataset, plevel)
ModuleNone
Notes
 Find MZ twins/duplicates based on genotype concordance
 Abort pairwise comparison after <nfailure> mismatches
 

mztest

Name of routine: mztest
Source lines: 59507 - 59544
Type subroutine
Call mztest(id1, id2, nmark, mark, dataset, nfailure, nonmatch, typed, istwin)
ModuleNone
Notes
 Test if pair are genetically identical, aborting if
   nfailure nonmatches

mzdiscord

Name of routine: mzdiscord
Source lines: 59549 - 59575
Type subroutine
Call mzdiscord(id1, id2, nmark, markid, mark, dataset)
ModuleNone
Notes
 If pair are assumed genetically identical, score SNPs for
   discordance saving to locstat

prdiscord

Name of routine: prdiscord
Source lines: 59579 - 59633
Type subroutine
Call prdiscord(id1, id2, nloci, loc, loctyp, locpos, locnotes, dataset, plevel)
ModuleNone
Notes
 Genotype diff for two individuals

duptest

Name of routine: duptest
Source lines: 59637 - 59754
Type subroutine
Call duptest(typ, nloci, loc, loctyp, locpos, dataset, thresh, mintyp, plevel)
ModuleNone
Notes
 Test only identical individual IDs as genetic duplicates

testage

Name of routine: testage
Source lines: 59758 - 59813
Type subroutine
Call testage(typ, locnam, trait, thresh, dataset, droperr)
ModuleNone
Notes
 Test ages or DOB for consistency

testpage

Name of routine: testpage
Source lines: 59817 - 59864
Type subroutine
Call testpage(typ, trait, ped, idx, parent, thresh, dataset, droperr)
ModuleNone
Notes
 Test a parent

ckibs

Name of routine: ckibs
Source lines: 59869 - 59975
Type subroutine
Call ckibs(nloci, loctyp, locpos, allele_buffer, dataset)
ModuleNone
Notes
 Check if multilocus ibs sharing for pairs of sibs is consistent
 with purported relationship.  Again as per Bishop et al 1990

momentibs

Name of routine: momentibs
Source lines: 59983 - 60159
Type subroutine
Call momentibs(typ, trait, gt, thresh, nloci, loc, loctyp, locpos, dataset, plevel)
ModuleNone
Notes
 Estimate kinship coefficients based on overall ibs sharing
 Shrinkage estimator of Endelman and Jannink [2012]
 Either founders only (typ=1), all individuals (typ=2), 
 all individuals written to kinmat (typ=3), 
 or subsetted on a phenotype (typ=4)

ibskin

Name of routine: ibskin
Source lines: 60167 - 60374
Type subroutine
Call ibskin(typ, trait, gt, thresh, nloci, loc, loctyp, locpos, dataset, plevel)
ModuleNone
Notes
 Estimate kinship coefficients based on overall ibs sharing
 EM algorithm of Choi et al Genet Epidemiol 33:668-678
 Either founders only (typ=1), all individuals (typ=2), 
 within pedigrees (typ=3), subsetted on a phenotype (typ=4),
 or all v. index individual (typ=5).

empkin

Name of routine: empkin
Source lines: 60380 - 60487
Type subroutine
Call empkin(ped, dataset, kin, plevel)
ModuleNone
Notes
 Estimate kinship based on overall ibs sharing
 EM algorithm of Choi et al Genet Epidemiol 33:668-678
 Saves empirical kinship matrix for current pedigree

ibskin_one

Name of routine: ibskin_one
Source lines: 60492 - 60612
Type subroutine
Call ibskin_one(peri, perj, nmark, mark, locpos, alleles, dataset, useful, ibscoef)
ModuleNone
Notes
 Estimate kinship coefficients based on overall ibs sharing
 One pair of relatives

emibskin

Name of routine: emibskin
Source lines: 60616 - 60664
Type subroutine
Call emibskin(nmark, nused, ibscoef, k0, k1, k2, plevel)
ModuleNone
Notes
 EM approach of Choi et al 2009

bluefreq

Name of routine: bluefreq
Source lines: 60672 - 60784
Type subroutine
Call bluefreq(gene, filter, gt, thresh, dataset, allele_buffer, plevel)
ModuleNone
Notes
 BLUE allele frequency estimator of McPeek et al 2004

 a = (1' L^(-1) 1)^(-1) 1' L^(-1) Z
 Var(a) = 0.5 * (1' L^(-1) 1)^(-1) a(1-a)
 Z=ith allele count L=NRM
 

bigblue

Name of routine: bigblue
Source lines: 60793 - 60890
Type subroutine
Call bigblue(gene, filter, gt, thresh, dataset, allele_buffer, plevel)
ModuleNone
Notes
 BLUE allele frequency estimator of McPeek et al 2004
 using empirical kinship matrix for entire sample

 a = (1' L^(-1) 1)^(-1) 1' L^(-1) Z
 Var(a) = 0.5 * (1' L^(-1) 1)^(-1) a(1-a)
 Z=ith allele count L=NRM
 

save_bluefreqs

Name of routine: save_bluefreqs
Source lines: 60894 - 60946
Type subroutine
Call save_bluefreqs(filter, allele_buffer, totobs, ns, ds, plevel)
ModuleNone
Notes
 Save BLUE estimates to allele_buffer
 

domqls

Name of routine: domqls
Source lines: 60950 - 61333
Type subroutine
Call domqls(typ, trait, gt, thresh, gene, locnam, prev, nulltyp, dataset, allele_buffer, iter, pval, plevel)
ModuleNone
Notes
 MQLS of Bourgain et al 2003, Thornton et al 2007
 

big_mqls

Name of routine: big_mqls
Source lines: 61338 - 61670
Type subroutine
Call big_mqls(typ, trait, gt, thresh, gene, locnam, prev, nulltyp, dataset, allele_buffer, pval, plevel)
ModuleNone
Notes
 MQLS of Bourgain et al 2003, Thornton et al 2007
   using empirical kinship matrix for entire sample
 

corchi

Name of routine: corchi
Source lines: 61675 - 61988
Type subroutine
Call corchi(kintyp, trait, loctyp, gene, locnam, hashtab, dataset, allele_buffer, iter, pval, plevel)
ModuleNone
Notes
 WQLS association chi-square 
 extending Bourgain et al 2003 to categorical traits with more than 2 levels
 

loadphenos

Name of routine: loadphenos
Source lines: 61992 - 62043
Type subroutine
Call loadphenos(trait, loctyp, gene, offset, num, allele_buffer, dataset, ncats, traitcols, traittable, phenos, genos)
ModuleNone
Notes
 Set up phenotype and genotype matrices

corchi_one

Name of routine: corchi_one
Source lines: 62048 - 62073
Type subroutine
Call corchi_one(nobs, ncats, traitcols, phenos, genos, ainv, u11, uscore, u12, u22)
ModuleNone
Notes
 S = u2' I21~ u2
 I21 = U22-(U21' U11~ U21)

freq

Name of routine: freq
Source lines: 62081 - 62228
Type subroutine
Call freq(gene, loctyp, fndr, dataset, allele_buffer)
ModuleNone
Notes
  
 Count alleles in entire sample -- codominant system
 Either unweighted or weighted by number of founders in pedigree
  
 If imputation has been done and fndr=2, then return the
 count of alleles in the founders, both observed and imputed
  

tab

Name of routine: tab
Source lines: 62233 - 62268
Type subroutine
Call tab(curr, allele_buffer, wei)
ModuleNone
Notes
  
 update table of counts of alleles -- binary search and insertion sort
 if allele_buffer too small, increase size
  

wrfreq

Name of routine: wrfreq
Source lines: 62272 - 62540
Type subroutine
Call wrfreq(strm, locnam, group, mappos, locnote, allele_buffer, fstyle)
ModuleNone
Notes
  
 Write out frequencies in 20 different styles
  

get_refalleles

Name of routine: get_refalleles
Source lines: 62545 - 62574
Type subroutine
Call get_refalleles(locnote, all1, all2)
ModuleNone
Notes
 Get set of reference alleles from an annotation of form [x/y] where x,y ~ {ACGT}
 y may be comma-delimited set of alternates - only return first

set_refalleles

Name of routine: set_refalleles
Source lines: 62578 - 62595
Type subroutine
Call set_refalleles(all1, all2, locnote)
ModuleNone
Notes
 Set reference alleles as an annotation of form [x/y] where x,y ~ {ACGT}

getchr

Name of routine: getchr
Source lines: 62600 - 62654
Type subroutine
Call getchr(locnam, locnote, chr)
ModuleNone
Notes
 Get chromosome number from a locus name of form "DnnSn" ^[Dd][0-9]+[Ss]$
 or an annotation of form "chr NN" \<[Cc][Hh][Rr][ :]*[0-9]+\>

thischr

Name of routine: thischr
Source lines: 62658 - 62687
Type subroutine
Call thischr(string, eos, pos, chr)
ModuleNone
Notes
 Read a chromosome number from a string after the start position [1-9]|[1-4][0-9]|X|Y

chrnum

Name of routine: chrnum
Source lines: 62691 - 62711
Type function
Call chrnum(chr)
ModuleNone
Notes
 Convert the chromosome number to an integer

precis

Name of routine: precis
Source lines: 62716 - 62750
Type subroutine
Call precis(numal, allele_freqs, ndec)
ModuleNone
Notes
  
 remove rounding errors in allele frequencies printed out to precision ndec
 from f3.1 to f9.7
  

uninf

Name of routine: uninf
Source lines: 62754 - 62765
Type function
Call uninf(numal, allele_freqs)
ModuleNone
Notes
  
 Frequency of uninformative matings for marker locus
  

getfreq

Name of routine: getfreq
Source lines: 62769 - 62790
Type function
Call getfreq(allele, allele_set)
ModuleNone
Notes
 
 find allele frequency
  

getnam

Name of routine: getnam
Source lines: 62794 - 62822
Type function
Call getnam(rall, allele_set)
ModuleNone
Notes
  
 find index for allele
  

get_namedgeno

Name of routine: get_namedgeno
Source lines: 62826 - 62840
Type subroutine
Call get_namedgeno(idx, gene, gen2, dataset, allele_set, g1, g2)
ModuleNone
Notes
  
 find indices for i'th individual's genotype
  

match

Name of routine: match
Source lines: 62844 - 62865
Type subroutine
Call match(ival,num,key,pos)
ModuleNone
Notes
  
 Binary search for position of value in an ascending sorted array -- integer
  

dmatch

Name of routine: dmatch
Source lines: 62869 - 62890
Type subroutine
Call dmatch(val, num, key, pos)
ModuleNone
Notes
  
 Binary search for position of value in an ascending sorted array -- double precision
  

actped

Name of routine: actped
Source lines: 62898 - 63055
Type subroutine
Call actped(typ, red, pedfil, nloci, loc, loctyp, locpos, outpos, locnotes, typed, locstat, dataset, plevel)
ModuleNone
Notes
  
 summarize current pedigree file
 typ=1 as for info
     2 numbers typed at each locus
     3 numbers typed at active loci
     4 numbers missing at active loci

sumped

Name of routine: sumped
Source lines: 63059 - 63121
Type subroutine
Call sumped(nloci, loctyp, locpos, dataset)
ModuleNone
Notes
 Summary statistics on families
    

countships

Name of routine: countships
Source lines: 63125 - 63142
Type function
Call countships(ped, dataset)
ModuleNone
Notes
 Count matings/sibships in current family

listpeds

Name of routine: listpeds
Source lines: 63146 - 63194
Type subroutine
Call listpeds(typ, dataset, nwords, words)
ModuleNone
Notes
 List all pedigree IDs

make_idlist

Name of routine: make_idlist
Source lines: 63198 - 63247
Type subroutine
Call make_idlist(dataset, nids, key, icount, nextcopy)
ModuleNone
Notes
 Tabulate all active IDs

listids

Name of routine: listids
Source lines: 63251 - 63331
Type subroutine
Call listids(dataset, ithresh, trait, plevel)
ModuleNone
Notes
 Tabulate all active IDs and write an indicator variable if requested

listchroms

Name of routine: listchroms
Source lines: 63335 - 63429
Type subroutine
Call listchroms(nloci, loc, loctyp, map, group)
ModuleNone
Notes
 Table of number of markers per chromosome

testmap

Name of routine: testmap
Source lines: 63433 - 63612
Type subroutine
Call testmap(typ, thresh, nloci, loc, loctyp, locpos, locnotes, group, map, locstat, dataset, plevel)
ModuleNone
Notes
 check for identical map positions

show_spectrum

Name of routine: show_spectrum
Source lines: 63616 - 63702
Type subroutine
Call show_spectrum(dataset)
ModuleNone
Notes
 Summary table for allelic spectrum

check

Name of routine: check
Source lines: 63715 - 64053
Type subroutine
Call check(checkall, nloci, loc, loctyp, locpos, locnotes, locstat, dataset, droperr, ndiscard, inconsist, plevel)
ModuleNone
Notes
 check for simple inconsistencies between child and parent
 if requested, delete any problem genotypes (up to and including
 all genotypes for a nuclear family)
  
 error                                     action if droperr
 ----------------------------------------  ----------------------------
 11=single parent-offspring inconsistency  delete child genotype
 12=Multiple p-o inconsistencies           delete all nuclear fam genos
 13=Inconsistencies between siblings       delete all nuclear fam genos
 14=More than 4 alleles segregating        delete all nuclear fam genos
  

addall

Name of routine: addall
Source lines: 64057 - 64073
Type subroutine
Call addall(iall, nall, allmax, allele)
ModuleNone
Notes
  
 identify parental alleles in nuclear family
  

nuchek

Name of routine: nuchek
Source lines: 64077 - 64164
Type subroutine
Call nuchek(xlinkd, ptyped, p11, p12, p21, p22, nkids, set, xmale, nall, allele, thiserr)
ModuleNone
Notes
  
 nuclear family consistency check (untyped parents)
  

famerr

Name of routine: famerr
Source lines: 64168 - 64204
Type subroutine
Call famerr(locnam, gene, xlinkd, ped, dataset, currf, currm, badchild, sta, fin, errtyp, plevel)
ModuleNone
Notes
  
 Write out nuclear family error
  

inderr

Name of routine: inderr
Source lines: 64208 - 64227
Type subroutine
Call inderr(idx, locnam, gene, gen2, dataset)
ModuleNone
Notes
  
 write genotype for an individual flagged as a Mendelian error
  

remove

Name of routine: remove
Source lines: 64231 - 64244
Type subroutine
Call remove(idx, gene, dataset, ndiscard)
ModuleNone
Notes
  
 Remove a genotype from data 
  

remfam

Name of routine: remfam
Source lines: 64248 - 64264
Type subroutine
Call remfam(currf, currm, sta, fin, gene, dataset, ndiscard)
ModuleNone
Notes
  
 drop a nuclear family's genotypes
  

parcon

Name of routine: parcon
Source lines: 64270 - 64289
Type function
Call parcon(c1, c2, p11, p12, p21, p22, xmale)
ModuleNone
Notes
  
 Tests if child genotype consistent with parental genotypes:
 parcon=4*Pr(Child_genotype|Father_genotype,Mother_genotype)
 if xmale  TRUE then X-linked locus *and* male child
  

opcon

Name of routine: opcon
Source lines: 64293 - 64300
Type function
Call opcon(c1,c2,p1,p2)
ModuleNone
Notes
  
 test if child genotype consistent with one parental genotype
  

shipcon

Name of routine: shipcon
Source lines: 64304 - 64321
Type function
Call shipcon(pg1, pg2, mg1, mg2, nkids, set, xmale)
ModuleNone
Notes
 test consistency of a sibship with parents

couple

Name of routine: couple
Source lines: 64326 - 64343
Type subroutine
Call couple(idx,tot,rang,i1,i2)
ModuleNone
Notes
  
 Enumerate all combinations of i ~ I(1..range) with itself
 If index=tot then return last tuple
  

whall

Name of routine: whall
Source lines: 64347 - 64362
Type function
Call whall(iall,nall,allele)
ModuleNone
Notes
  
 Find index of allele segregating in nuclear family
  

describe

Name of routine: describe
Source lines: 64366 - 64632
Type subroutine
Call describe(locnam, gene, xlinkd, ped, dataset, currf, currm, sta, fin, mesg)
ModuleNone
Notes
  
 write out genotypes in nuclear family and grandparents
  

famset

Name of routine: famset
Source lines: 64637 - 64797
Type subroutine
Call famset(ped, dataset, currf, currm, sta, fin, gene, set, gset)
ModuleNone
Notes
 Write out phenoset for a nuclear family (plus grandparents and halfsibs)
 Useful in detecting sources of long distance Mendelian inconsistencies.

indset

Name of routine: indset
Source lines: 64801 - 64844
Type subroutine
Call indset(idx, gene, pedoffset, dataset, set, gset)
ModuleNone
Notes
 write out phenoset for an individual

allinset

Name of routine: allinset
Source lines: 64848 - 64864
Type function
Call allinset(idx, iall, ngeno, gset)
ModuleNone
Notes
 see if particular allele in phenoset for idx person

cntbad

Name of routine: cntbad
Source lines: 64868 - 64880
Type subroutine
Call cntbad(idx, ngeno, gset)
ModuleNone
Notes
 If phenoset contains zero legal genotypes, reconstruct last state

wroddall

Name of routine: wroddall
Source lines: 64884 - 64904
Type subroutine
Call wroddall(pedigree, parent, child, iall, partyp)
ModuleNone
Notes
 If find an odd-allele-out, write out its location

start

Name of routine: start
Source lines: 64909 - 65029
Type subroutine
Call start(maxtry, nloci, loc, loctyp, locpos, dataset, allele_buffer, inconsist, plevel)
ModuleNone
Notes
  
 If Lange-Goradia algorithm not used, initialize genotypes for random walk
 algorithms via a conditional gene dropping algorithm
  

workpointers

Name of routine: workpointers
Source lines: 65033 - 65058
Type subroutine
Call workpointers(ped, dataset, fa, mo, imztwin)
ModuleNone
Notes
 make parental pointers offset for local work array

dattoset

Name of routine: dattoset
Source lines: 65062 - 65090
Type subroutine
Call dattoset(sta, fin, gene, dataset, allele_buffer, set)
ModuleNone
Notes
 transfer genotypes to working array

startone

Name of routine: startone
Source lines: 65094 - 65178
Type subroutine
Call startone(maxtry, allele_buffer, num, nfound, fa, mo, sex, set, sibd, key, failid, plevel)
ModuleNone
Notes
 start genotypes for one pedigree

genof3

Name of routine: genof3
Source lines: 65184 - 65277
Type subroutine
Call genof3(idx, fa, mo, xmale, set, sibd, key, failid)
ModuleNone
Notes
  
 Drop ibd-alleles conditional on observed markers
 and randomly where marker genotype not observed -- restart
 if later generates inconsistency
  

fillin

Name of routine: fillin
Source lines: 65281 - 65333
Type subroutine
Call fillin(allele_buffer, num, nfound, set, sibd, key, sta, fin, gene, dataset)
ModuleNone
Notes
  
 infer missing genotypes based on sibd values after run of start
  

found

Name of routine: found
Source lines: 65337 - 65348
Type subroutine
Call found(cumfrq, allele)
ModuleNone
Notes
  
 founder frequency
  

countp

Name of routine: countp
Source lines: 65352 - 65370
Type subroutine
Call countp(trait, dataset, typed)
ModuleNone
Notes
  
 Give count of individuals typed at one phenotype
  

coutyp

Name of routine: coutyp
Source lines: 65374 - 65413
Type subroutine
Call coutyp(nloci, loctyp, locpos, dataset, eligible, typed)
ModuleNone
Notes
  
 Give counts of typed individuals for each locus
  

thetaf

Name of routine: thetaf
Source lines: 65423 - 65440
Type function
Call thetaf(het, n)
ModuleNone
Notes
  
 Xu and Fu 2004 correction for thetaf=4Nu=1/2(1/F^2-1)
 where F is the observed homozygosity for the locus is:
 1/2 (1/F^2-1) = a thetaf + b sqrt(thetaf)
 where
 thetaf <=10                        >10
    a   1.1313+3.4882/n+28.2878/n^2ltyp,  1.1675+3.3232/n+63.698/n^2
    b   0.3998                      0.2569
  

mutage

Name of routine: mutage
Source lines: 65444 - 65456
Type subroutine
Call mutage(p, ne, r)
ModuleNone
Notes
 Age of an allele (Ohta, Nei, Rannala & Slatkin)

qtlpars

Name of routine: qtlpars
Source lines: 65460 - 65505
Type subroutine
Call qtlpars(p,m1,m2,m3,sd1,sd2,sd3)
ModuleNone
Notes
  
 Calculate variances for a given SML model
  

ccpen

Name of routine: ccpen
Source lines: 65511 - 65527
Type subroutine
Call ccpen(prev, pca, pco, typ)
ModuleNone
Notes
  
 Calculate penetrances for a particular prevalence and 
 case and control allele frequencies, assuming multiplicative model
 Controls are unaffected (1), or population (2)
  

grrpen

Name of routine: grrpen
Source lines: 65531 - 65564
Type subroutine
Call grrpen(model, prev, q, grr)
ModuleNone
Notes
  
 Calculate penetrances for a particular prevalence and genotypic RR
  

recrisk

Name of routine: recrisk
Source lines: 65568 - 65658
Type subroutine
Call recrisk(q,f1,f2,f3)
ModuleNone
Notes
  
 Calculate recurrence risks and risk ratios for given SML model
  

doito

Name of routine: doito
Source lines: 65662 - 65714
Type subroutine
Call doito(typ, pars)
ModuleNone
Notes
  
 Calculate GPE for a relative: ITO method
  

ito

Name of routine: ito
Source lines: 65718 - 65757
Type subroutine
Call ito(rel, q, r)
ModuleNone
Notes
 ITO calculation

tetcor

Name of routine: tetcor
Source lines: 65762 - 65774
Type function
Call tetcor(prev, prrr)
ModuleNone
Notes
 MFT heritability
  Tetrachoric correlation for given prevalence and recurrence risk ratio

brent_tet

Name of routine: brent_tet
Source lines: 65778 - 65786
Type function
Call brent_tet(r)
ModuleNone
Notes
 likelihood function for tetrachoric r

polycor

Name of routine: polycor
Source lines: 65790 - 65845
Type subroutine
Call polycor(nr, nc, tab, polyr, assocX2, modelX2)
ModuleNone
Notes
 Two-stage polychoric r - fixed thresholds

brent_polyr

Name of routine: brent_polyr
Source lines: 65850 - 65874
Type function
Call brent_polyr(r)
ModuleNone
Notes
 Likelihood function for 1-dim ML estimation of polychoric r, 
 fixed threshholds in module brent_mft

dataset_uses

Name of routine: dataset_uses
Source lines: 65879 - 65895
Type function
Call dataset_uses(dataset)
ModuleNone

dataset_uses

Name of routine: dataset_uses
Source lines: 65897 - 65913
Type function
Call dataset_uses(dataset)
ModuleNone

macsub

Name of routine: macsub
Source lines: 65918 - 66029
Type subroutine
Call macsub(narg, words, commands, plevel)
ModuleNone
Notes
 Perform simple macro substitutions on contents of command buffer

macloop

Name of routine: macloop
Source lines: 66039 - 66176
Type subroutine
Call macloop(lin, nloci, loc, loctyp, commands, plevel)
ModuleNone
Notes
 Expand an iterator list of tokens in a command
 These implicit loops are signalled by a list surrounded by braces
 Implemented as a naive immediate macro expansion so:

   {1 2} + 1 -> 1 + 1; 2 + 1
   {1 : 3} -> 1;2;3
   {1 2} + {1 2} -> 1 + {1 2}; 2 + {1 2} requiring further evaluation

macvar

Name of routine: macvar
Source lines: 66181 - 66260
Type subroutine
Call macvar(lin, commands, plevel)
ModuleNone
Notes
 Perform simple macro variable substitutions on contents of command buffer
 cf macro functions which are handled by macsub

preparser

Name of routine: preparser
Source lines: 66266 - 66316
Type subroutine
Call preparser(first, narg, words)
ModuleNone
Notes
 Other syntax transformations
   replace category labels in expressions with corresponding values
   eg 'Hair_colour == red' -> 'Hair_colour == 1'

parser

Name of routine: parser
Source lines: 66327 - 66465
Type subroutine
Call parser(nterm, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 Evaluate and apply simple expressions either
  
 (1) pure arithmetic, so no effect on pedigree file
 (2) Dry run, so can test if will lead to a legal effect on pedigree file
         all variables set to MISS
 (3) Pedigree operation -- individual-wise calculation and update
  
 The parser
  

simpev

Name of routine: simpev
Source lines: 66469 - 66706
Type subroutine
Call simpev(sta, fin, nterm, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 The non-compound evaluator
  

wrans

Name of routine: wrans
Source lines: 66710 - 66749
Type subroutine
Call wrans(prefix, nterm, expr, wtyp, wtag, val)
ModuleNone
Notes
  
 write out results of command line expression evaluation
  

legall

Name of routine: legall
Source lines: 66753 - 66767
Type function
Call legall(xall)
ModuleNone
Notes
  
 the legal range of alleles
  

isdata

Name of routine: isdata
Source lines: 66771 - 66776
Type function
Call isdata(idx)
ModuleNone
Notes
  
 Is a stack element a number, variable or operator
  

isenv

Name of routine: isenv
Source lines: 66780 - 66785
Type function
Call isenv(idx)
ModuleNone
Notes
 Is a stack element an automatic variable

isvar

Name of routine: isvar
Source lines: 66789 - 66794
Type function
Call isvar(idx)
ModuleNone
Notes
 Is a stack element data

isop

Name of routine: isop
Source lines: 66798 - 66803
Type function
Call isop(idx)
ModuleNone
Notes
 Is a stack element an operator

isvec

Name of routine: isvec
Source lines: 66807 - 66812
Type function
Call isvec(idx)
ModuleNone
Notes
 Is a stack element a genotype - both values of interest
  

ismis

Name of routine: ismis
Source lines: 66816 - 66821
Type function
Call ismis(idx)
ModuleNone
Notes
  
 Is a stack element missing data
  

addcolon

Name of routine: addcolon
Source lines: 66825 - 66860
Type subroutine
Call addcolon(nterm, wtyp, wtag, expr)
ModuleNone
Notes
 Convert (expr) (expr) to (expr : expr)

compop

Name of routine: compop
Source lines: 66864 - 66912
Type subroutine
Call compop(pos, sta, fin, nterm, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 compound operators eg <= >= == ^=
  

zerop

Name of routine: zerop
Source lines: 66916 - 66958
Type subroutine
Call zerop(pos, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 zero argument functions
  

unop

Name of routine: unop
Source lines: 66962 - 67121
Type subroutine
Call unop(pos, sta, fin, nterm, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 unary operators
  

binop

Name of routine: binop
Source lines: 67125 - 67356
Type subroutine
Call binop(pos, sta, fin, nterm, wtyp, wtag, expr, error)
ModuleNone
Notes
  
 binary operators
  

typwords

Name of routine: typwords
Source lines: 67375 - 67440
Type subroutine
Call typwords(farg, larg, words, nloci, loc, lochash, loctyp, wtyp, wtag, expr, actn)
ModuleNone
Notes
  
 Evaluate type of each term in expression word(farg...larg) and actn
 actn=0 error  =1 purely arithmetic  =2 legal
  
 Types are:         wtyp     wtag        expr
                    ----     --------    --------
 tokens             0        0...TOKNUM    -
 env                1        1...ENVNUM   (value)
 constant           2                      value
 trait data         2        1...NLOCI    (value)
 constant genotype  3                      value, value
 genotype data      3        1...NLOCI    (value, value)
 MISS               4                      MISS
 missing trait      4        1...NLOCI     MISS
 MISS genotype      5                      MISS/MISS
 missing trait      5        1...NLOCI     MISS/MISS
 NUM                6                      -
  

dryrun

Name of routine: dryrun
Source lines: 67445 - 67456
Type subroutine
Call dryrun(farg, larg, wtyp)
ModuleNone
Notes
  
 If checking arguments via dry run of parser,
 replace variable values with (generic) NUM
  

pull

Name of routine: pull
Source lines: 67460 - 67478
Type subroutine
Call pull(pos, dec, fin, nterm, typ, tag, expr)
ModuleNone
Notes
  
 Pull up expr
  

isgeno

Name of routine: isgeno
Source lines: 67482 - 67515
Type function
Call isgeno(string)
ModuleNone
Notes
  
  See if a string is a valid genotype
  

getgeno

Name of routine: getgeno
Source lines: 67519 - 67562
Type subroutine
Call getgeno(string, a1, a2, wtyp)
ModuleNone
Notes
  
  Get a valid genotype
  

incpos

Name of routine: incpos
Source lines: 67566 - 67575
Type subroutine
Call incpos(pos, minpos, maxpos)
ModuleNone
Notes
  
 Increment counter mod maxpos
  

getrelval

Name of routine: getrelval
Source lines: 67579 - 67831
Type subroutine
Call getrelval(relate, summary, locnam, loctyp, trait, sumval, dataset, plevel)
ModuleNone
Notes
 Get values for trait in relatives

priallval

Name of routine: priallval
Source lines: 67835 - 67912
Type subroutine
Call priallval(summary, trait, loctyp, ped, sumval, totobs, dataset, plevel)
ModuleNone
Notes
 Output single summary value for entire pedigree
 

prirelval

Name of routine: prirelval
Source lines: 67916 - 68090
Type subroutine
Call prirelval(relate, summary, trait, loctyp, ped, nobs, relid, sumval, totobs, dataset, plevel)
ModuleNone
Notes
 Output values for each eligible person
 

evalped

Name of routine: evalped
Source lines: 68094 - 68419
Type subroutine
Call evalped(narg, words, nloci, loc, lochash, loctyp, locpos, locnotes, locstat, wtyp, wtag, expr, allele_buffer, dataset, chek, imp, maxtry, droperr, plevel)
ModuleNone
Notes
  
 Evaluate expression for each pedigree member
  

findth

Name of routine: findth
Source lines: 68423 - 68458
Type subroutine
Call findth(nterm, wtyp, wtag, posif, posth, posel, posen)
ModuleNone
Notes
  
 Find if/then/else
  

findend

Name of routine: findend
Source lines: 68462 - 68493
Type subroutine
Call findend(sta, fin, nterm, wtyp, wtag, posen)
ModuleNone
Notes
 Find end of block

findwh

Name of routine: findwh
Source lines: 68497 - 68510
Type function
Call findwh(farg, larg, narg, args)
ModuleNone
Notes
  
 Find the start of a "where" clause on command line
  

findword

Name of routine: findword
Source lines: 68514 - 68528
Type function
Call findword(word, farg, larg, narg, args)
ModuleNone
Notes
  
 Find a keyword -- exact match
  

findbracket

Name of routine: findbracket
Source lines: 68534 - 68556
Type subroutine
Call findbracket(lb, rb, lin, sta, fin, istat)
ModuleNone
Notes
  
 Find matching bracket in string starting at a left bracket
   if unmatched, returns to end of line
   rb may equal lb, brackets may be nested
  

loadvar

Name of routine: loadvar
Source lines: 68563 - 68625
Type subroutine
Call loadvar(idx, nloci, loctyp, locpos, dataset, sta, fin, wtyp, wtag, expr)
ModuleNone
Notes
  
 Load variable values for ith individual
 code y and n as 1 and 0
 tot records number of active records evaluated to date
 nped records number of active pedigrees evaluated to date
  

doselect

Name of routine: doselect
Source lines: 68629 - 68767
Type subroutine
Call doselect(typ, nprob, farg, larg, words, nloci, loc, lochash, loctyp, locpos, wtyp, wtag, expr, dataset, nobs, plevel)
ModuleNone
Notes
  
 Select pedigrees where probands meet a given criterion v2
  

edit

Name of routine: edit
Source lines: 68771 - 68882
Type subroutine
Call edit(tped, tid, gene, loc, loctyp, all1, all2, dataset, plevel)
ModuleNone
Notes
 Edit alleles for particular gene for particular person

copydata

Name of routine: copydata
Source lines: 68888 - 68997
Type subroutine
Call copydata(typ, ped1, id1, ped2, id2, nloci, loc, loctyp, locpos, dataset, hashtab, plevel)
ModuleNone
Notes
 Copy data for person A to person B
 typ=1 overwrite at B if A nonmissing for that variable
 typ=2 insert data only where B is missing for that variable

mergeloci

Name of routine: mergeloci
Source lines: 69001 - 69179
Type subroutine
Call mergeloci(first, second, thresh, nloci, loc, loctyp, locpos, locnotes, group, map, dataset, plevel)
ModuleNone
Notes
 Merge genotype data for two loci together eg same map position

selped

Name of routine: selped
Source lines: 69183 - 69237
Type subroutine
Call selped(typ, farg, larg, words, dataset, plevel)
ModuleNone
Notes
  
 include or exclude a list of pedigrees
  

selped_fil

Name of routine: selped_fil
Source lines: 69241 - 69307
Type subroutine
Call selped_fil(typ, port, hashtab, dataset, plevel)
ModuleNone
Notes
 select pedigrees listed in file

unsel

Name of routine: unsel
Source lines: 69311 - 69366
Type subroutine
Call unsel(dataset, rollback, plevel)
ModuleNone
Notes
  
 unselect
  

docount

Name of routine: docount
Source lines: 69370 - 69642
Type subroutine
Call docount(typ, farg, larg, words, nloci, loc, lochash, loctyp, locpos, locnotes, wtyp, wtag, expr, dataset, pedmask, nwid, ndec, sexcode, misval, fieldsep, allsep, show_cat, pstyle, plevel)
ModuleNone
Notes
  
 Count or print individuals per pedigree fulfilling criterion
  

seldel

Name of routine: seldel
Source lines: 69646 - 69765
Type subroutine
Call seldel(nord, locord, farg, larg, words, nloci, loc, lochash, loctyp, locpos, wtyp, wtag, expr, dataset, plevel)
ModuleNone
Notes
  
 Delete data for individuals fulfilling criterion
  

prexpr

Name of routine: prexpr
Source lines: 69769 - 69801
Type subroutine
Call prexpr(typ, nprob, farg, larg, words)
ModuleNone
Notes
  
 Echo action to be performed
  

hashids

Name of routine: hashids
Source lines: 69805 - 69822
Type subroutine
Call hashids(typ, dataset, hashtab, load, plevel)
ModuleNone
Notes
 Hash IDs

dohashids

Name of routine: dohashids
Source lines: 69824 - 69908
Type subroutine
Call dohashids(typ, dataset, hashtab, load, hasher, matcher, plevel)
ModuleNone

hashprint

Name of routine: hashprint
Source lines: 69910 - 69956
Type subroutine
Call hashprint(hashtab, dataset, loc, plevel)
ModuleNone

matchid

Name of routine: matchid
Source lines: 69960 - 70011
Type subroutine
Call matchid(keytyp, idstr1, idstr2, dataset, hashtab, iaddress, plevel)
ModuleNone
Notes
 Search for ID using hash

findids

Name of routine: findids
Source lines: 70015 - 70130
Type subroutine
Call findids(port, lin, pedcol, idcol, hashtab, dataset, plevel)
ModuleNone
Notes
 Match list of IDs from file

searchid

Name of routine: searchid
Source lines: 70134 - 70156
Type subroutine
Call searchid(sstrings, dataset)
ModuleNone
Notes
 Wild card searching IDs

sextable

Name of routine: sextable
Source lines: 70160 - 70187
Type subroutine
Call sextable(dataset)
ModuleNone
Notes
 Tabulate sexes

xtab

Name of routine: xtab
Source lines: 70194 - 70290
Type subroutine
Call xtab(analys, mistyp, sample_weight, nloc, loclist, nloci, loc, locpos, loctyp, locnotes, dataset, iter, nwid, ndec, pval, plevel)
ModuleNone
Notes
  
 N-way cross-tabulation
   analys=1 simple cross-tab
          2 K-W test
          3 polychoric correlation
  

onetab

Name of routine: onetab
Source lines: 70294 - 70339
Type subroutine
Call onetab(loc, loctyp, locnote, table, nmiss, nwid, ndec)
ModuleNone
Notes
  
 print summary of one-way table
  

listab

Name of routine: listab
Source lines: 70343 - 70397
Type subroutine
Call listab(nloc, loclist, loc, loctyp, locnotes, table, nmiss, nwid, ndec)
ModuleNone
Notes
  
 print listwise contingency table
  

wrtab

Name of routine: wrtab
Source lines: 70401 - 70689
Type subroutine
Call wrtab(analys, mistyp, nloc, loclist, loc, loctyp, locnotes, table, nmiss, iter, nwid, ndec, pval)
ModuleNone
Notes
  
 print RxC contingency table
  

kwtest

Name of routine: kwtest
Source lines: 70693 - 70783
Type subroutine
Call kwtest(nloc, loclist, loc, loctyp, locnotes, martable1, martable2, table, nwid, ndec, pval)
ModuleNone
Notes
 Kruskal-Wallis test

histogram

Name of routine: histogram
Source lines: 70787 - 70819
Type subroutine
Call histogram(trait, nloci, loc, locpos, loctyp, histcat, dataset, nwid, ndec, outfil, plevel)
ModuleNone
Notes
 plot a histogram
 

logrank

Name of routine: logrank
Source lines: 70823 - 71002
Type subroutine
Call logrank(typ, nloc, loclist, nloci, loc, loctyp, locpos, locnotes, dataset, nwid, ndec, lrstat, df, pval, plevel)
ModuleNone
Notes
 Logrank test: table 1..(nloc-2)=covariate levels (nloc-1)=time nloc=censor 

simlogrank

Name of routine: simlogrank
Source lines: 71006 - 71332
Type subroutine
Call simlogrank(locnam, gene, onset, censor, iter, mincnt, norder, dataset, allele_buffer, pval, plevel)
ModuleNone
Notes
 Logrank association test: gene time censor 

survtab

Name of routine: survtab
Source lines: 71336 - 71360
Type subroutine
Call survtab(timelev, ngroups, table, dij, cij, nij, ni, di)
ModuleNone
Notes
 Life table logrank test

calclogrank

Name of routine: calclogrank
Source lines: 71364 - 71423
Type subroutine
Call calclogrank(timelev, ngroups, ns2, di, ni, naff, cij, dij, nij, ediff, vardiff, vinv, lrstat, df)
ModuleNone
Notes
 Calculate log rank statistic

simtrend

Name of routine: simtrend
Source lines: 71433 - 71663
Type subroutine
Call simtrend(typ, locnam, gene, trait, iter, mincnt, norder, dataset, allele_buffer, pval, plevel)
ModuleNone
Notes
 Nonparametric SNP association test for trend

    An exact (permutation) version of the
    Jonckheere-Terpstra test, but gene dropping.  It uses the statistic

    Sum_{k<l} Sum_{ij} I(X_{ik} < X_{jl}) + 0.5 I(X_{ik} =  X_{jl}), 
    where i, j are observations in groups k and l respectively.

groupgenos

Name of routine: groupgenos
Source lines: 71667 - 71685
Type subroutine
Call groupgenos(nobs, geno, ngroups, gstrata)
ModuleNone
Notes
 partition ordered list of genotypes returning boundaries of each subset

terpstra

Name of routine: terpstra
Source lines: 71690 - 71715
Type subroutine
Call terpstra(ngroups, gstrata, nobs, pheno, tau)
ModuleNone
Notes
    Sum_{k<l} Sum_{ij} I(X_{ik} < X_{jl}) + 0.5 I(X_{ik} =  X_{jl}), 
    where i, j are observations in groups k and l respectively.

pedtab

Name of routine: pedtab
Source lines: 71719 - 71785
Type subroutine
Call pedtab(trait, nloci, loc, loctyp, locpos, locnotes, dataset, nwid, ndec, plevel)
ModuleNone
Notes
 One-way tabulation by pedigree

fitloglin

Name of routine: fitloglin
Source lines: 71789 - 72231
Type subroutine
Call fitloglin(sta, fin, terms, nloci, loc, lochash, loctyp, locpos, locnotes, dataset, mlik, mpar, pval, nwid, ndec, plevel)
ModuleNone
Notes
 Fit poisson model to a contingency table

strattyp

Name of routine: strattyp
Source lines: 72236 - 72410
Type subroutine
Call strattyp(trait, nloci, loc, loctyp, locpos, locnotes, locord, dataset, locstat, plevel)
ModuleNone
Notes
  
 Tabulate counts of typed individuals for each locus versus 
 stratifying variables
  

dohwe

Name of routine: dohwe
Source lines: 72414 - 72719
Type subroutine
Call dohwe(locnam, gene, loctyp, iter, mincnt, hwefnd, norder, dataset, outp, restrand, plevel)
ModuleNone
Notes
  
 Monte-Carlo test for HWE
  

tabgen

Name of routine: tabgen
Source lines: 72726 - 72744
Type subroutine
Call tabgen(a1, a2, xmale, ngcount, gcount)
ModuleNone
Notes
  
 Increment counts of genotypes and alleles for HWE test
 Storage of allele counts in gcount(,2) indexed from 1..nall
 Genotypes indexed from 1..ngtp by gcount(,1).
 Males contribute to allele counts but not genotype counts
  

hwep

Name of routine: hwep
Source lines: 72748 - 72802
Type subroutine
Call hwep(numal)
ModuleNone
Notes
  
 Calculate HWE Chi-square for table entered on command line
  

hwechi

Name of routine: hwechi
Source lines: 72806 - 72849
Type function
Call hwechi(numal, ngcount, gcount, tot, totmal)
ModuleNone
Notes
  
 Calculate Gibbs chi-square for HWE
  

hwe2

Name of routine: hwe2
Source lines: 72854 - 72881
Type subroutine
Call hwe2(n11, n12, n22, pa, pvalue)
ModuleNone
Notes
  
 calculate hwe test for diallelic autosomal marker
  

dhwe2

Name of routine: dhwe2
Source lines: 72885 - 72899
Type function
Call dhwe2(n11, n12, n22)
ModuleNone
Notes
  
 hypergeometric for diallelic genotypes under hwe
  

domar

Name of routine: domar
Source lines: 72903 - 73007
Type subroutine
Call domar(gene, dataset, allele_buffer, plevel)
ModuleNone
Notes
 Do ibs sharing in parents

margen

Name of routine: margen
Source lines: 73011 - 73103
Type subroutine
Call margen(gene, dataset, allele_buffer, iter, plevel)
ModuleNone
Notes
 Tabulate maternal v. paternal genotypes

doplot

Name of routine: doplot
Source lines: 73109 - 73201
Type subroutine
Call doplot(fil, typ, xtrait, ytrait, ztrait, xlab, ylab, zlab, pedfil, dataset)
ModuleNone
Notes
  
 Produce a scatterplot of two traits
 typ=1 scatterplot
    =2 dotplot (xtrait is categorical)
  

dohist

Name of routine: dohist
Source lines: 73205 - 73302
Type subroutine
Call dohist(locnam, histcat, cat, table, nwid, ndec, outfil)
ModuleNone
Notes
  
 Produce a histogram with histcat intervals from sorted tabulation
  

sumucsc

Name of routine: sumucsc
Source lines: 73306 - 73323
Type subroutine
Call sumucsc(chr)
ModuleNone
Notes
 Summarize test statistics for UCSC browser

tabstat

Name of routine: tabstat
Source lines: 73327 - 73441
Type subroutine
Call tabstat(plevel)
ModuleNone
Notes
 Summarize test statistics

histstat

Name of routine: histstat
Source lines: 73445 - 73473
Type subroutine
Call histstat()
ModuleNone
Notes
 Histogram of test statistics
     

sumstat

Name of routine: sumstat
Source lines: 73477 - 73542
Type subroutine
Call sumstat(numval, plevel)
ModuleNone
Notes
 Show ranked test statistics

rankstat

Name of routine: rankstat
Source lines: 73546 - 73560
Type subroutine
Call rankstat(nvar)
ModuleNone
Notes
 Rank the test statistics (nvar=no. nonmissing values)

combine_stats

Name of routine: combine_stats
Source lines: 73564 - 73645
Type subroutine
Call combine_stats(nord, pval, plevel)
ModuleNone
Notes
  
 Combine P-values from a region
  

get_stats

Name of routine: get_stats
Source lines: 73650 - 73687
Type subroutine
Call get_stats(statnam)
ModuleNone
Notes
 Extract statistics from locus annotation
   pick nth column or name=value pairs in text

dumpstats

Name of routine: dumpstats
Source lines: 73691 - 73723
Type subroutine
Call dumpstats(strm)
ModuleNone
Notes
  
 Dump all P-values to a file
  

todistmix

Name of routine: todistmix
Source lines: 73727 - 73763
Type subroutine
Call todistmix(strm, selchr, dataset, allele_buffer)
ModuleNone
Notes
 Dump stats for DISTmix

sumplot

Name of routine: sumplot
Source lines: 73767 - 73824
Type subroutine
Call sumplot(fil)
ModuleNone
Notes
  
 Produce a plot of P-values
  

qqplot

Name of routine: qqplot
Source lines: 73828 - 73868
Type subroutine
Call qqplot(fil)
ModuleNone
Notes
  
 Produce a Q-Q (quantile-quantile) plot of P-values
  

selstat

Name of routine: selstat
Source lines: 73872 - 73891
Type subroutine
Call selstat(message, thresh, gt, plevel)
ModuleNone
Notes
 Select loci (wloc) based on test on value of locstat

traceplot

Name of routine: traceplot
Source lines: 73895 - 73926
Type subroutine
Call traceplot(fil, nobs, nmult, yvals)
ModuleNone
Notes
  
 Produce a MCMC trace
  

filliben

Name of routine: filliben
Source lines: 73934 - 73989
Type subroutine
Call filliben(table, plevel)
ModuleNone
Notes
  
 Filliben correlation here testing for normality
  
   m(i) = 1 - m(n) for i = 1
   m(i) = (i - 0.3175)/(n + 0.365) for i = 2, 3, ..., n-1
   m(i) = 0.5**(1/n) for i = n
  

symtest

Name of routine: symtest
Source lines: 73997 - 74061
Type subroutine
Call symtest(table, plevel)
ModuleNone
Notes
  
 David & Johnson's Jr test for symmetry of a distribution
 Resek Busi Stat 1975; 546-551
 Doksum Biometrika 1977; 64: 473-487
  
 Standard error of Jr based on simulations under Gaussian true distribution
  

unidens

Name of routine: unidens
Source lines: 74074 - 74202
Type subroutine
Call unidens(num, xvals, xmode, plevel)
ModuleNone
Notes
 Unimodal density estimation using modified PAVA algorithm
 adapted from code written by Mary Meyer
 Statistica Sinica 11(2001), 1159-1174
    AN ALTERNATIVE UNIMODAL DENSITY ESTIMATOR
         WITH A CONSISTENT ESTIMATE OF THE MODE
                                         Mary C. Meyer
                                       University of Georgia
       
 starts with unimodal interval and then does LCM and GCM on either side
 Approach is a NPMLE modified to handle the unknown mode case - with penalty on mode

evdtailp

Name of routine: evdtailp
Source lines: 74212 - 74231
Type function
Call evdtailp(xpos, n, mm, xvals, xnew)
ModuleNone
Notes
 Tail estimation procedure of Davis and Resnick (1984; Ann Stat 12:1467-87)
 Pareto tail estimate from order statistics per extreme value theory.
 xvals(1:(m+2)) contains the ordered m highest out of n values 
 where xvals(1) is work space, xvals(2) = b = the n-m'th order statistic,
 a is the tail index, here estimated using Hill's (1975) estimator.
 xpos is the rank of xnew in the distribution, so that if b <= 0, then
 returns xpos/n

clcmcn

Name of routine: clcmcn
Source lines: 74235 - 74244
Type function
Call clcmcn(b,c)
ModuleNone
Notes
  
 calculate McNemar statistic
  

binz

Name of routine: binz
Source lines: 74248 - 74257
Type function
Call binz(x, n, e)
ModuleNone
Notes
  
 normal approx binomial deviate
  

ftdev

Name of routine: ftdev
Source lines: 74261 - 74266
Type function
Call ftdev(o,e)
ModuleNone
Notes
 
 Freeman-Tukey deviates
 

clcpos

Name of routine: clcpos
Source lines: 74271 - 74280
Type function
Call clcpos(i,j)
ModuleNone
Notes
  
 find index of coefficient for pair i,j in a lower triangular matrix
 stored as a 1-D array
  

big_clcpos

Name of routine: big_clcpos
Source lines: 74285 - 74294
Type function
Call big_clcpos(i,j)
ModuleNone
Notes
  
 find index of coefficient for pair i,j in a lower triangular matrix
 stored as a big 1-D array
  

copy

Name of routine: copy
Source lines: 74298 - 74305
Type subroutine
Call copy(n, ia, ib)
ModuleNone
Notes
  
 Copy integer array A to integer array B
  

filltri

Name of routine: filltri
Source lines: 74309 - 74328
Type subroutine
Call filltri(n, nn, a, dval, oval)
ModuleNone
Notes
  
 Load a lower triangular matrix
  

ln

Name of routine: ln
Source lines: 74332 - 74340
Type function
Call ln(x)
ModuleNone
Notes
  
 zero-trapped log
  

logit

Name of routine: logit
Source lines: 74344 - 74354
Type function
Call logit(p)
ModuleNone
Notes
  
 logit of p
  

alogit

Name of routine: alogit
Source lines: 74358 - 74362
Type function
Call alogit(x)
ModuleNone
Notes
  
 Reverse logit
  

inht

Name of routine: inht
Source lines: 74366 - 74370
Type function
Call inht(x)
ModuleNone
Notes
  
 Inverse hyperbolic tan
  

fishzse

Name of routine: fishzse
Source lines: 74374 - 74378
Type function
Call fishzse(n)
ModuleNone
Notes
 Standard error for Fisher-Z transformed correlation coefficient

fishzci

Name of routine: fishzci
Source lines: 74382 - 74393
Type subroutine
Call fishzci(r, n, rlo, rhi)
ModuleNone
Notes
 95%CI via Fisher-Z transform for correlation coefficient

sech

Name of routine: sech
Source lines: 74397 - 74401
Type function
Call sech(x)
ModuleNone
Notes
 Hyperbolic secant

cortest

Name of routine: cortest
Source lines: 74407 - 74419
Type function
Call cortest(r1, r2, n1, n2)
ModuleNone
Notes
 Test equality of two correlation coefficients via LRTS 
 (Brandner 1933; Stuart & Ord Volume 2, Exercise 26.21)
 Direction of test is retained

rtheta

Name of routine: rtheta
Source lines: 74423 - 74427
Type function
Call rtheta(x)
ModuleNone
Notes
  
 ibd correlation to recombination fraction
  

wrpropci

Name of routine: wrpropci
Source lines: 74432 - 74442
Type subroutine
Call wrpropci(num, den, width)
ModuleNone
Notes
  
 Confidence intervals around a proportion: approach of Wilson (Agresti
 & Coull) -- wrapper 
  

propci

Name of routine: propci
Source lines: 74446 - 74474
Type subroutine
Call propci(num, den, inwidth, phat, ll, ul)
ModuleNone
Notes
 Actual Wilson algorithm

moment

Name of routine: moment
Source lines: 74478 - 74488
Type subroutine
Call moment(n, x, mean, ss)
ModuleNone
Notes
  
 accumulate mean and sum-of-squares following AS41
  

dssp

Name of routine: dssp
Source lines: 74492 - 74514
Type subroutine
Call dssp(nvar, nobs, iwt, x, mean, cov)
ModuleNone
Notes
  
 accumulate means and SSCP following AS41
  

covcor

Name of routine: covcor
Source lines: 74518 - 74538
Type subroutine
Call covcor(nvar, nobs, cov)
ModuleNone
Notes
  
 Standardize covariance matrix (variances left on diagonal)
  

thincov

Name of routine: thincov
Source lines: 74542 - 74577
Type subroutine
Call thincov(nfull, nreduced, active, cov)
ModuleNone
Notes
 Thin a covariance matrix
 

predmat

Name of routine: predmat
Source lines: 74585 - 74628
Type subroutine
Call predmat(nfull, yindicator, cov, xval, yp)
ModuleNone
Notes
 Predicting values for subset (indexed by yindicator)
 given covariance matrix and values for complementary subset.
 X values are stored counting backwards in xval(nfull-ny+1:nfull)
 (the observed values for the predicted group are stored xval(1:ny)
 On output, yp contains ny (sum(active)) predicted values.

iquadmult

Name of routine: iquadmult
Source lines: 74632 - 74667
Type subroutine
Call iquadmult(n, y, s, res)
ModuleNone
Notes
 Use AS164 to evaluate quadratic y' S~ y where S not necessarily full rank

loglin

Name of routine: loglin
Source lines: 74671 - 74752
Type subroutine
Call loglin(ncells, totpars, npars, counts, model, offset, b, cov, lrts)
ModuleNone
Notes
  
 Use AS164 to fit a log-linear model
  

emllm

Name of routine: emllm
Source lines: 74757 - 74873
Type subroutine
Call emllm(ncells, nfull, totpars, npars, counts, scatter, model, ex, oldex, full, offset, b, cov, lrts, plevel)
ModuleNone
Notes
  
 Use AS164 and EM algorithm to fit a log-linear model to incomplete
 tables
  

gl

Name of routine: gl
Source lines: 74877 - 74919
Type subroutine
Call gl(nr, nc, design, sta, levels, reps, droplev)
ModuleNone
Notes
  
 Appropriate design matrix for factor
  

logccs

Name of routine: logccs
Source lines: 74923 - 75128
Type subroutine
Call logccs(nstrata, nobs, nv, nv1, ivar, nca, nct, z, b, cov, chi2, st, ifault, plevel)
ModuleNone
Notes
 AS162 - Conditional logistic regression. Converted to Fortran 95

twidl

Name of routine: twidl
Source lines: 75133 - 75181
Type subroutine
Call twidl(x, y, z, done, p, n2)
ModuleNone
Notes
 this generates all combinations of m out of n.
 CACM algorithm 382

segrat

Name of routine: segrat
Source lines: 75185 - 75432
Type subroutine
Call segrat(locnam, trait, dataset)
ModuleNone
Notes
  
 Binary trait prevalences and recurrence risks.
  

catseg

Name of routine: catseg
Source lines: 75436 - 75646
Type subroutine
Call catseg(typ, trait, dataset, jdraw, iter, plevel)
ModuleNone
Notes
 Familial association for categorical or ordinal trait

famcatass

Name of routine: famcatass
Source lines: 75650 - 75905
Type subroutine
Call famcatass(typ, trait, traitlevels, traittable, dataset, npairs, crosstables, corstat)
ModuleNone
Notes
 Pairwise familial Cohen Kappa (typ=1) or polychoric correlation (typ=2)

twincon

Name of routine: twincon
Source lines: 75909 - 76116
Type subroutine
Call twincon(locnam, trait, mztwin, gt, thresh, dataset, plevel)
ModuleNone
Notes
  
 Classical twin analysis: binary trait prevalences and recurrence risks
  

concest

Name of routine: concest
Source lines: 76120 - 76144
Type subroutine
Call concest(group, concord, npairs, prev, con, locon, hicon)
ModuleNone
Notes
 Summary statistics for recurrence risk calculation

conchi

Name of routine: conchi
Source lines: 76148 - 76164
Type subroutine
Call conchi(a, b, c, d, lrts)
ModuleNone
Notes
 LRTS for equality of 2x2

tarone

Name of routine: tarone
Source lines: 76168 - 76260
Type subroutine
Call tarone(trait, dataset, plevel)
ModuleNone
Notes
 Test for extrabinomial variation

davie

Name of routine: davie
Source lines: 76264 - 76379
Type subroutine
Call davie(loc1, trait, loc2, proband, dataset, plevel)
ModuleNone
Notes
  
  Segregation ratios using Davie 1976
  

davstat

Name of routine: davstat
Source lines: 76383 - 76415
Type subroutine
Call davstat(typ, pos, sta, npro, trait, dataset, class, j, q, t, r)
ModuleNone
Notes
  
 Accumulate counts needed for Davie formula in current family
  

davwri

Name of routine: davwri
Source lines: 76419 - 76448
Type subroutine
Call davwri(ped, currf, currm, pos, sta, npro, trait, dataset)
ModuleNone
Notes
  
 print prop affected per sibship
  

marseg

Name of routine: marseg
Source lines: 76461 - 76607
Type subroutine
Call marseg(gene, locnam, typ, dataset, allele_buffer, plevel)
ModuleNone
Notes
  
 Simple segregation tabulations for a codominant marker
 Phase the genotypes if requested

 So either
   Father Mother Child
   ng     ng     na*na

 or
   mating        Child
   ng*(ng+1)/2   ng

famimp

Name of routine: famimp
Source lines: 76612 - 76837
Type subroutine
Call famimp(locnam, trait, dataset, plevel)
ModuleNone
Notes
 Simple family based imputation of age/yob/etc
 ego ~ midparent + sibs + spouses + offspring

famcor

Name of routine: famcor
Source lines: 76841 - 77034
Type subroutine
Call famcor(locnam, trait, dataset, jdraw, iter, plevel)
ModuleNone
Notes
  
 Quantitative trait relatives means and covariances
  

fammeans

Name of routine: fammeans
Source lines: 77039 - 77137
Type subroutine
Call fammeans(trait, dataset, nobserved, obs_indx, plevel)
ModuleNone
Notes
 Simple descriptive statistics for a quantitative trait
 sets up dataset%untyped

famcovar

Name of routine: famcovar
Source lines: 77141 - 77347
Type subroutine
Call famcovar(trait, dataset, npairs, mu, cvar, cov)
ModuleNone
Notes
 Pairwise familial correlations 

sibvar

Name of routine: sibvar
Source lines: 77351 - 77476
Type subroutine
Call sibvar(trait, dataset, plevel)
ModuleNone
Notes
 Sibship variance tests

twincor

Name of routine: twincor
Source lines: 77480 - 77688
Type subroutine
Call twincor(locnam, trait, mztwin, gt, thresh, dataset, plevel)
ModuleNone
Notes
 Classical twin analysis contrasting monozygotic twins v. other siblings.

corr

Name of routine: corr
Source lines: 77698 - 77720
Type subroutine
Call corr(typ, x1, x2, nclass, npairs, mean, var, cov)
ModuleNone
Notes
  
 update means and sums of squares and products
  
 1=Marital 2=Grandparent-Grandchild 3=Half-sib
 4=Parent-Offspring 5=Full-sib 6=MZ-Twin
 7=father-son 8=father-daugher 9=mother-son 10=mother-daughter
 11=brother 12=sister 13=brother-sister
 14=MZ-Males 15=MZ-Females
  

corrstd

Name of routine: corrstd
Source lines: 77724 - 77740
Type subroutine
Call corrstd(nclass, npairs, var, cov)
ModuleNone
Notes
  
 cor to cov for classes
  

docov

Name of routine: docov
Source lines: 77747 - 77860
Type subroutine
Call docov(typ, nterms, terms, nloci, loc, loctyp, locpos, dataset)
ModuleNone
Notes
  
 Means and covariances for multiple trait
 typ=1 means and correlations
     2 means and covariances
     3 plus PCA
  

domix

Name of routine: domix
Source lines: 77864 - 77920
Type subroutine
Call domix(locnam, trait, nmix, typ, histcat, outfil, dataset, logl, df, nwid, ndec, plevel)
ModuleNone
Notes
 Fit mixture of distributions to quantitative trait

fitmix

Name of routine: fitmix
Source lines: 77924 - 77999
Type subroutine
Call fitmix(nmix, typ, table, prob, den, alpha, mean, sd, logl, df, plevel)
ModuleNone
Notes
 Fit mixture of distributions to tabulated data

mixture

Name of routine: mixture
Source lines: 78004 - 78198
Type subroutine
Call mixture(a, k, m, x, n, alpha, mean, sd, f, g, nobs, logl, ifail, plevel)
ModuleNone
Notes
 Fit mixture of distributions
 Algorithm AS 203 (Appl Stat 1984; 33:327-332)

regress

Name of routine: regress
Source lines: 78209 - 78571
Type subroutine
Call regress(typ, nterms, terms, nloci, loc, loctyp, locpos, gene, genemod, allele_buffer, dataset, mlik, mpar, pval, plevel)
ModuleNone
Notes
  
 linear regression analysis of quantitative trait
   typ
   -2  SNP regression
   -1  run silently
    0  regression summary table
    1  calculate residuals
    2  imputation
    3  predicted value
  

binreg

Name of routine: binreg
Source lines: 78576 - 79100
Type subroutine
Call binreg(ilink, nterms, terms, nloci, loc, loctyp, locpos, offset, censor, gene, genemod, allele_buffer, mcp, useimp, fixshape, iter, mincnt, dataset, wshap, mlik, mpar, statval, pval, plevel)
ModuleNone
Notes
  
 Binomial (ilink=2), Poisson (ilink=3),
 Weibull (ilink=4), Exponential (ilink=5), EVD (ilink=6) regression analysis
  

fitbin

Name of routine: fitbin
Source lines: 79104 - 79150
Type subroutine
Call fitbin(ilink, nobs, nter, ncov, it, x2, r, b, y, v, offval, x, shap, ierr, plevel)
ModuleNone
Notes
  
 Perform binomial (ilink=2) or poisson (ilink=3) regression IRLS,
  

binirls

Name of routine: binirls
Source lines: 79154 - 79227
Type subroutine
Call binirls(ilink, nobs, nter, nel, x2, r, b, y, v, offval, x, shap, ierr, plevel)
ModuleNone
Notes
  
 One iteration of IRLS for binomial or poisson regression
  

glmscale

Name of routine: glmscale
Source lines: 79231 - 79267
Type subroutine
Call glmscale(ilink, nobs, nter, b, y, offval, x, shap, scaleval)
ModuleNone
Notes
  
 Scale parameter for GLM
  

weishape

Name of routine: weishape
Source lines: 79272 - 79305
Type subroutine
Call weishape(nobs, naff, nter, b, y, offval, x, alpha, alpha2)
ModuleNone
Notes
  
 Estimate shape for Weibull distribution
 Use relaxation methods and hard limit on step size
  

rcp

Name of routine: rcp
Source lines: 79309 - 79367
Type subroutine
Call rcp(typ, nr, nc, narg, args, iter)
ModuleNone
Notes
  
 Simulation P for RxC contingency table read from stdin
  

poltest

Name of routine: poltest
Source lines: 79371 - 79429
Type subroutine
Call poltest(nr, nc, tble)
ModuleNone
Notes
 Polychoric r and LRTS for RxC contingency table

rctest

Name of routine: rctest
Source lines: 79433 - 79539
Type subroutine
Call rctest(nr, nc, tble, e, iter)
ModuleNone
Notes
  
 LRTS and Permutation P for RxC contingency table
  

simchi

Name of routine: simchi
Source lines: 79543 - 79611
Type subroutine
Call simchi(nr, rows, nc, cols, tble, e, obschi, tot, iter, pval)
ModuleNone
Notes
  
 MCMC a RxC contingency table retaining given margins
  

upchi

Name of routine: upchi
Source lines: 79615 - 79631
Type subroutine
Call upchi(ncells, tble, e, lrts)
ModuleNone
Notes
  
 LRTS for contingency table in MCMC
  

rclrts

Name of routine: rclrts
Source lines: 79635 - 79681
Type subroutine
Call rclrts(nr, nc, tble, e, lrts, df)
ModuleNone
Notes
 Contingency table LRTS

mkchoose

Name of routine: mkchoose
Source lines: 79685 - 79697
Type subroutine
Call mkchoose(ni, eligible , nelig)
ModuleNone
Notes
  
 Load an array with indices of eligible choices (eg nonmissing alleles)
  

choose

Name of routine: choose
Source lines: 79702 - 79714
Type subroutine
Call choose(nch, ni, idx)
ModuleNone
Notes
  
 Shuffle array of indices so can randomly select combination from
 as first r elements
  

uniqid

Name of routine: uniqid
Source lines: 79718 - 79763
Type subroutine
Call uniqid(typ, dataset, plevel)
ModuleNone
Notes
 Make every individual and pedigree ID a unique number

prunep

Name of routine: prunep
Source lines: 79767 - 79935
Type subroutine
Call prunep(wrk, wrk2, locnam, trait, gt, thresh, dataset, plevel)
ModuleNone
Notes
  
 Prune pedigree to ancestors shared by affecteds
  

relations

Name of routine: relations
Source lines: 79939 - 80071
Type subroutine
Call relations(tped, tid, dataset, loc, loctyp, plevel)
ModuleNone
Notes
  
 Write relatives of index

prrel

Name of routine: prrel
Source lines: 80075 - 80107
Type subroutine
Call prrel(iclass, ped, dataset, key, eop, loc, loctyp)
ModuleNone
Notes
 print list of relatives

appval

Name of routine: appval
Source lines: 80111 - 80155
Type subroutine
Call appval(idx, loc, loctyp, dataset)
ModuleNone
Notes
 append locus value if asked

pairlink

Name of routine: pairlink
Source lines: 80159 - 80276
Type subroutine
Call pairlink(ped, idx, dataset, plevel)
ModuleNone
Notes
 Show relationship to ego: Djikstra's shortest path algorithm

conlen

Name of routine: conlen
Source lines: 80280 - 80296
Type function
Call conlen(i, j, ped, dataset)
ModuleNone
Notes
 Are i and j a parent-offspring pair?

findloop

Name of routine: findloop
Source lines: 80312 - 80518
Type subroutine
Call findloop(trait, dataset, plevel)
ModuleNone
Notes
 Find loops

 Marriage node representation
 Traverses depth-first with backtracking
 Trades time for space ;)

 Data structure:
 nodal backlink typelink

 nodal is the list of vertices 1..maxact are   individuals with edge to mating
                               maxact+1... are matings with edges to parents
 backlink contains the "thread" or point stack, and also the mark (negative)
 typelink shows direction of edge  

wricas

Name of routine: wricas
Source lines: 80524 - 80613
Type subroutine
Call wricas(typ, newped, wrk, wrk2, trait, dataset)
ModuleNone
Notes
 extract unrelated (typ=1) or all (typ=2) individuals with information  
   for a criterion trait
   As of 20151205, does not generate new pedigree IDs unless asked

nuclear

Name of routine: nuclear
Source lines: 80617 - 80678
Type subroutine
Call nuclear(wrk, wrk2, typ, maxsibs, dataset)
ModuleNone
Notes
 convert into nuclear families, duplicating individuals as needed

onefam

Name of routine: onefam
Source lines: 80682 - 80811
Type subroutine
Call onefam(wrk, wrk2, typ, maxsibs, ped, dataset, nuc, newoffset, currf, currm, sta, fin)
ModuleNone
Notes
 Write out current nuclear family -- with or without grandparents

disjoin

Name of routine: disjoin
Source lines: 80817 - 80934
Type subroutine
Call disjoin(wrk, wrk2, dataset, plevel)
ModuleNone
Notes
 chop into disjoint subpedigrees
 note that the pointers in set(,2) do not follow the sort order of
 the pedigree, as connect() moves both up and down the generations

joinped

Name of routine: joinped
Source lines: 80940 - 81260
Type subroutine
Call joinped(wrk, wrk2, typ, farg, larg, words, nloci, loc, locpos, loctyp, locnotes, locstat, dataset, chek, droperr, plevel)
ModuleNone
Notes
 join families together by duplicated individuals 
   (assuming unique individual IDs)
 had to exempt automatic variables from test of phenotype discordance 20180828

pedsort

Name of routine: pedsort
Source lines: 81264 - 81380
Type subroutine
Call pedsort(ped, dataset, nerr, plevel)
ModuleNone
Notes
 Sort a pedigree in a dataset

doanova

Name of routine: doanova
Source lines: 81384 - 81731
Type subroutine
Call doanova(trait, locnam, gene, genetyp, iter, mincnt, norder, assfnd, conibd, dataset, freqfnd, use_fixfreq, fixfreq_buffer, allele_buffer2, pval, plevel, typ)
ModuleNone
Notes
  
 Additive allelic model for association with a quantitative trait
  

qtdt

Name of routine: qtdt
Source lines: 81737 - 82123
Type subroutine
Call qtdt(trait, locnam, gene, genetyp, freqfnd, iter, mincnt, use2, typ, dataset, pval, plevel)
ModuleNone
Notes
  
 Quantitative trait TDT following Gauderman 2003 25(4): 327-338

 E(Y_i) = a_MTi + beta Z(G_i)
  

cpganova

Name of routine: cpganova
Source lines: 82128 - 82359
Type subroutine
Call cpganova(trait, locnam, gene, genetyp, iter, mincnt, freqfnd, dataset, plevel)
ModuleNone
Notes
  
 Additive allelic model for association with a quantitative trait
 Conditional on parental genotypes
  

haploid_count

Name of routine: haploid_count
Source lines: 82365 - 82398
Type subroutine
Call haploid_count(nloc, loclist, loc, locpos, loctyp, dataset, haplotable)
ModuleNone
Notes
 MC approach to association to haploid markers

 Enumerate haplotypes for haploid SNPs

set_hval

Name of routine: set_hval
Source lines: 82402 - 82439
Type subroutine
Call set_hval(nloc, loclist, loc, locpos, loctyp, haplotable, hval, dataset, plevel)
ModuleNone
Notes
 encode observed haplotypes

fillin_yha

Name of routine: fillin_yha
Source lines: 82443 - 82491
Type subroutine
Call fillin_yha(haplotable, hval, dataset, plevel)
ModuleNone
Notes
 fill in missing haplotypes and check for mutation/error

fillin_mit

Name of routine: fillin_mit
Source lines: 82495 - 82539
Type subroutine
Call fillin_mit(haplotable, hval, dataset, plevel)
ModuleNone
Notes
 Mitochondrial

haploid_freq

Name of routine: haploid_freq
Source lines: 82543 - 82732
Type subroutine
Call haploid_freq(nloc, loclist, loc, locpos, loctyp, dataset, plevel, typ)
ModuleNone
Notes
  
 Count of haplotypes from haploid markers
  

haploid_aov

Name of routine: haploid_aov
Source lines: 82736 - 83041
Type subroutine
Call haploid_aov(trait, nloc, loclist, loc, locpos, loctyp, iter, mincnt, dataset, pval, plevel, typ)
ModuleNone
Notes
 MC approach to association to haploid markers

haploid_ass

Name of routine: haploid_ass
Source lines: 83045 - 83425
Type subroutine
Call haploid_ass(trait, nloc, loclist, loc, locpos, loctyp, locnotes, assoc_stat, iter, mincnt, dataset, pval, plevel, typ)
ModuleNone
Notes
  
 Count of marker alleles/genotypes in cases and controls -- haploid marker(s)
  

doassoc

Name of routine: doassoc
Source lines: 83429 - 84171
Type subroutine
Call doassoc(trait, loc, loctyp, locnote, locnam, gene, genetyp, assoc_stat, iter, mincnt, norder, assfnd, gt, thresh, conibd, dataset, freqfnd, use_fixfreq, fixfreq_buffer, allele_buffer2, prevalence, pval, sumstat, plevel, typ)
ModuleNone
Notes
  
 Count of marker alleles/genotypes in cases and controls -- codominant system
  

pearson

Name of routine: pearson
Source lines: 84178 - 84205
Type function
Call pearson(sta, fin, nlev, nca, cntall)
ModuleNone
Notes
 Chi-square measures of association in flat contingency tables

 Pearson chi-sq for slice of RxC table 
 (uses cntall(,1:traitlevels+1), nca(1:traitlevels))
  

gibbs

Name of routine: gibbs
Source lines: 84210 - 84239
Type function
Call gibbs(sta, fin, nlev, nca, cntall)
ModuleNone
Notes
  
 Gibbs chi-sq for slice of RxC table 
 (uses cntall(,1:traitlevels+1), nca(1:traitlevels))
  

twobyk

Name of routine: twobyk
Source lines: 84243 - 84264
Type function
Call twobyk(sta, fin, cntall, pexp)
ModuleNone
Notes
  
 Pearson chi-sq for 2xK table (uses only cntall(,1-3))
  

rctdt

Name of routine: rctdt
Source lines: 84277 - 84654
Type subroutine
Call rctdt(trait, locnam, gene, genetyp, iter, mincnt, gt, thresh, fbatimp, freqfnd, dataset, plevel)
ModuleNone
Notes
  
 perform sibship association permutation test
  
 Combines TDT with SDT: appropriate permutation set for each sibship
  
 If both parents genotyped, then each child can be drawn from 13,14,23,24
 If one or no parents genotyped, but may be reconstructed, then draw
 from mixture of obligate genotypes (those usable to reconstruct the missing
 parents) and 13,14,23,24.
 If cannot unequivocally reconstruct parental genotypes
 draw only from obligate (observed) genotypes among children
  

parimp

Name of routine: parimp
Source lines: 84658 - 84776
Type subroutine
Call parimp(pg1, pg2, mg1, mg2, sta, fin, set, parall)
ModuleNone
Notes
  
 Make list of possible parental genotypes for this sibship
  

rctperm

Name of routine: rctperm
Source lines: 84788 - 84874
Type subroutine
Call rctperm(ifam, sibships, set)
ModuleNone
Notes
  
 Simulate the null distribution of sibship genotypes
 Parental alleles imputed via the children must be transmitted
 at least once to that sibship
 Furthermore, if two imputed alleles are the same in the two parents,
 then these must be transmitted together to at least one child
 And (Jun 2008), if only A/A and A/B segregating in sibship, 
 need to also condition on total number of each type of
 genotype in sibship for -/- x -/- and A/B x -/- matings
 (sticking point is A/B x A/B possibility)
  

ranall

Name of routine: ranall
Source lines: 84878 - 84891
Type function
Call ranall(par)
ModuleNone
Notes
  
 Randomly transmit nonmissing alleles
  

conoff

Name of routine: conoff
Source lines: 84896 - 84909
Type subroutine
Call conoff(tr, par, imputd, off)
ModuleNone
Notes
  
 Conditional parent-offspring transmission
 Flag whether an imputed parental allele is transmitted
  

rctsim

Name of routine: rctsim
Source lines: 84913 - 84942
Type subroutine
Call rctsim(nfam, sibships, aff, set, numal, trans)
ModuleNone
Notes
  
 One simulation of entire set of informative nuclear families
  

rctuse

Name of routine: rctuse
Source lines: 84946 - 84996
Type function
Call rctuse(pg1, pg2, mg1, mg2, ptyped, parall, contrib, naff)
ModuleNone
Notes
  
 test if useful for RC-TDT/FBAT
  

sibass

Name of routine: sibass
Source lines: 85001 - 85168
Type subroutine
Call sibass(trait, locnam, gene, allele_buffer, dataset, iter, typ, pval, plevel)
ModuleNone
Notes
 Tabulate sibship affection by genotype for fast test of total
 association

whitehead

Name of routine: whitehead
Source lines: 85172 - 85471
Type subroutine
Call whitehead(trait, gt, thresh, locnam, gene, loctyp, allele_buffer, stratloc, stratvar, strattyp, stratlabels, dataset, pval, ptype, plevel)
ModuleNone
Notes
 Random effects stratified proportional odds model of Whitehead and Whitehead

vcfcascon

Name of routine: vcfcascon
Source lines: 85475 - 85862
Type subroutine
Call vcfcascon(trait, gt, thresh, assfnd, vcf_ac, vcf_an, vcf_het, vcf_hom, port, dataset, plevel)
ModuleNone
Notes
 Read summary allele counts from a VCF file and do case-population comparison

rarecarrier

Name of routine: rarecarrier
Source lines: 85866 - 85964
Type subroutine
Call rarecarrier(mark, thresh, dataset, plevel)
ModuleNone
Notes
 Recode rare allele carriers for currently active markers to a marker

rarecascon

Name of routine: rarecascon
Source lines: 85968 - 86123
Type subroutine
Call rarecascon(trait, thresh, dataset, plevel)
ModuleNone
Notes
 Enumerate rare alleles in cases and controls for currently active markers

simped

Name of routine: simped
Source lines: 86128 - 86190
Type subroutine
Call simped(ped, dataset, allele_buffer, set)
ModuleNone
Notes
  
  Simulate (gene-dropping) genotypes at a single autosomal locus
  in a pedigree of arbitrary complexity
  

xsimped

Name of routine: xsimped
Source lines: 86195 - 86268
Type subroutine
Call xsimped(ped, dataset, allele_buffer, set)
ModuleNone
Notes
  
  Simulate (gene-dropping) genotypes at a single X-linked locus
  in a pedigree of arbitrary complexity
  

csimped

Name of routine: csimped
Source lines: 86275 - 86339
Type subroutine
Call csimped(ped, dataset, untyped, set, xlinkd)
ModuleNone
Notes
  
 Simulate (gene-dropping) genotypes at a single codominant locus
 Conditioning on typed ``founder'' genotypes (true founders/marry-ins
 plus individuals without typed parents) heading informative
 chains of descent
  

genoff

Name of routine: genoff
Source lines: 86343 - 86369
Type subroutine
Call genoff(idx, fa, mo, set)
ModuleNone
Notes
  
 transmit genes from parents to child
  

mumson

Name of routine: mumson
Source lines: 86373 - 86385
Type subroutine
Call mumson(idx, mo, set)
ModuleNone
Notes
  
 Transmit single X-linked allele from mother to son
  

gencopy

Name of routine: gencopy
Source lines: 86389 - 86394
Type subroutine
Call gencopy(idx, origin, set)
ModuleNone
Notes
 Copy genotype from MZ cotwin to ego

simhaploid

Name of routine: simhaploid
Source lines: 86398 - 86426
Type subroutine
Call simhaploid(typ, ped, dataset, nhaps, cumhaps, hval)
ModuleNone
Notes
  
 Simulate Y or mitochondrial haplotypes 
  

fsimped

Name of routine: fsimped
Source lines: 86431 - 86559
Type subroutine
Call fsimped(it, pedigree, num, nfound, id, fa, mo, imztwin, set, sibd, untyped, key, plevel)
ModuleNone
Notes
  
 Simulate pedigree conditional on all founders (all must be typed) and
 typed nonfounders
  

genof4

Name of routine: genof4
Source lines: 86566 - 86651
Type subroutine
Call genof4(idx, fa, mo, imztwin, set, sibd, untyped, key, failid)
ModuleNone
Notes
  
  Drop ibd-alleles conditional on observed markers
  and randomly where marker genotype not observed -- restart
  if later generates inconsistency
  This version assumes all founders are typed
  

fill2

Name of routine: fill2
Source lines: 86656 - 86681
Type subroutine
Call fill2(num, set, sibd, untyped, key)
ModuleNone
Notes
  
 infer missing genotypes based on sibd values after run of fsimped
 assume all founders are typed
  

cisimped

Name of routine: cisimped
Source lines: 86686 - 86736
Type subroutine
Call cisimped(ped, gene, allele_buffer, allele_buffer2, dataset, set)
ModuleNone
Notes
 Simulate a single marker consistent with ibd sharing at a target marker locus
 If there are missing genotypes, call should be preceded by call to newstart()

sample

Name of routine: sample
Source lines: 86740 - 86795
Type subroutine
Call sample(trait, ped, dataset, typ)
ModuleNone
Notes
 Sample with or without replacement from the trait values within an entire pedigree
 

drop

Name of routine: drop
Source lines: 86815 - 87040
Type subroutine
Call drop(it, ped, dataset, cntmat, numal, gfrq, set, sibd, set2, key, iprop, plevel)
ModuleNone
Notes
 Modified random walk simulation (one iteration) of pedigree missing
 genotypes (Metropolis-Hastings algorithm) -- proposal uses founder
 allele mutations propagated throughout then pedigree conditional
 on (identity by) descent, swapping ibd origins for heterozygotes,
 alternated with a randomization of descent conditional on marker
 genotype. This procedure has the advantage of being quick,
 but the proposal probabilities are not always symmetric, so they
 are combined with additional local proposals
  
 It is alternated with a locally updating Gibbs sampler. This jointly
 simulates Untyped x Untyped founder matings genotypes conditional on
 offspring and other spouses; other genotypes individual-by-individual,
 conditional on parental, spouse and child genotypes.
  
 set and sibd (set2 and sibd2) are genotypes for current pedigree only
 only fa and mo need to be redirected


simnuc

Name of routine: simnuc
Source lines: 87049 - 87121
Type subroutine
Call simnuc(par1, par2, num, nfound, fa, mo, numal, gfrq, set)
ModuleNone
Notes
  
  Gibbs sampler for codominant marker locus
  Simulate parental genotypes for untyped x untyped
  mating conditional on offspring genotypes
  or for untyped nonfounders conditional on offspring, spouses
  and parents. Family may be contained within larger pedigree, and
  multiple spouses are possible
  

nuclik

Name of routine: nuclik
Source lines: 87127 - 87191
Type subroutine
Call nuclik(par1, par2, sta, fin, fa, mo, numal, gfrq, set, targt)
ModuleNone
Notes
  
 Nuclik is run twice, once to calculate the total likelihood <totlik> of the
 legal genotypes (with target=1), the second time to select a
 parental genotypes with target ~ U(0,totlik).
  

foulik

Name of routine: foulik
Source lines: 87198 - 87245
Type subroutine
Call foulik(idx, fa, mo, sta, fin, numal, gfrq, set, targt)
ModuleNone
Notes
  
 Founder codominant locus conditional likelihood
 foulik is run twice, once to calculate the total likelihood <totlik> of the
 legal genotypes (with target=1), the second time to select a genotype,
 with target ~ U(0,totlik).
  

onelik

Name of routine: onelik
Source lines: 87252 - 87296
Type subroutine
Call onelik(idx, fa, mo, sta, fin, set, targt)
ModuleNone
Notes
  
 nonfounder codominant locus conditional likelihood
 onelik is run twice, once to calculate the total likelihood <totlik> of the
 legal genotypes (with target=1), the second time to select a genotype,
 with target ~ U(0,totlik).
  

simpar

Name of routine: simpar
Source lines: 87303 - 87345
Type subroutine
Call simpar(par1, par2, numal, num, nfound, fa, mo, set)
ModuleNone
Notes
  
  Propose parental genotypes for untyped x untyped
  mating conditional on offspring genotypes
  Family may be contained within larger pedigree, and
  multiple spouses are possible
  

inuclik

Name of routine: inuclik
Source lines: 87352 - 87397
Type subroutine
Call inuclik(par1, par2, sta, fin, numal, fa, mo, set, targt, totp)
ModuleNone
Notes
  
 inuclik is an integer version of nuclik
 inuclik is run twice, once to calculate the total number <totp> of the
 legal genotypes (with target=MAXG*MAXG), the second time to select a
 parental genotype.
  

mutate

Name of routine: mutate
Source lines: 87404 - 87447
Type subroutine
Call mutate(numal, num, nfound, set, sibd, set2, untyped)
ModuleNone
Notes
  
 Mutate 1-4 allele in untyped founders.  Can never fail, due "backmutation".
  
 (1) mutate an allele never transmitted to a typed individual
 (2) swap parent of origin if have no offspring sharing ibd-allele
  

switch

Name of routine: switch
Source lines: 87451 - 87570
Type subroutine
Call switch(num, nfound, id, fa, mo, set, sibd, set2, untyped)
ModuleNone
Notes
  
 Do a switch of grandparent of origin of alleles = switch lineage
  

cpibd

Name of routine: cpibd
Source lines: 87577 - 87597
Type subroutine
Call cpibd(i, j, sibd, sibd2, imiss)
ModuleNone
Notes
  
 Copy ibd for a pair of relatives.
 Person j has a typing-genotype at sibd2, person i does not.
 The typing-allele corresponding to that shared at sibd()
 is "transmitted" to person i from person j.
  

update

Name of routine: update
Source lines: 87601 - 87614
Type subroutine
Call update(idx, all1, all2, set)
ModuleNone
Notes
  
 update new genotype
  

simibd

Name of routine: simibd
Source lines: 87621 - 87717
Type subroutine
Call simibd(typ, pedigree, num, nfound, fa, mo, imztwin, set, sibd)
ModuleNone
Notes
  
  Given genotypes at a single locus in a pedigree of arbitrary complexity,
  generate ibd by gene dropping a perfectly informative marker a la
  John Blangero.
  Type=1 unconditional, =2, conditional on observed markers
  

genof2

Name of routine: genof2
Source lines: 87725 - 87786
Type subroutine
Call genof2(pedigree, idx, fa, mo, imztwin, set, sibd, ifault)
ModuleNone
Notes
  
 transmit ibd-marker from parents to child,
 test if consistent with observed marker
 In this version 12/99, the sibd pairs are ordered by the collating
 order of the marker alleles they represent and
 not the collating order of the sibd allele.
  

wrhbd

Name of routine: wrhbd
Source lines: 87790 - 88015
Type subroutine
Call wrhbd(gene, trait, iter, burnin, allele_buffer, dataset, plevel)
ModuleNone
Notes
 Monte-Carlo approach to estimating one-locus homozygosity by descent

mcgpe

Name of routine: mcgpe
Source lines: 88019 - 88239
Type subroutine
Call mcgpe(gene, trait, iter, burnin, allele_buffer, dataset, plevel)
ModuleNone
Notes
  
 MCMC for genotype probability estimates and allele doses
  

mcfreq

Name of routine: mcfreq
Source lines: 88243 - 88459
Type subroutine
Call mcfreq(gene, iter, emiter, dataset, allele_buffer, plevel)
ModuleNone
Notes
  
 MCEM for pedigree allele frequencies
  

newstart

Name of routine: newstart
Source lines: 88463 - 88615
Type subroutine
Call newstart(gene, allele_buffer, dataset, plevel)
ModuleNone
Notes
 Call drop to shuffle the unobserved genotypes

cntprop

Name of routine: cntprop
Source lines: 88619 - 88627
Type subroutine
Call cntprop(iprop, proprate, proptyp)
ModuleNone
Notes
  
 Increment counts of MCMC proposal type
  

wrprop

Name of routine: wrprop
Source lines: 88631 - 88646
Type subroutine
Call wrprop(ilabel, proprate, proptyp)
ModuleNone
Notes
  
 Summary of MCMC proposals from drop()
  

tabmat

Name of routine: tabmat
Source lines: 88650 - 88667
Type subroutine
Call tabmat(ped, dataset, cntmat)
ModuleNone
Notes
  
 count the untyped founder x founder matings for use by Metropolis algs
  

nucseg

Name of routine: nucseg
Source lines: 88689 - 88929
Type subroutine
Call nucseg(trait, locnam, gene, genetyp, freqfnd, spec_candal, dataset, pval, plevel)
ModuleNone
Notes
  
 Approach of Schaid and Sommer (1993), amplified by Knapp et al (1995)
  
 MM x MM   MM x MN   MM x NN   MN x MN    MN x NN    NN x NN
   MM      MM   MN     MN      MM MN NN   MN   NN      NN
   n1      n2   n3     n4      n5 n6 n7   n8   n9      n10
  
 a=4*n1 + 3*n2 + 3*n3 + 2*n4 + 2*n5 + 2*n6 + 2*n7 + n8 + n9
 b=n2 + n3 + 2*n4 + 2*n5 + 2*n6 + 2*n7 + 3*n8 + 3*n9 + 4*n10
 c=n1 + n2 + n5
 d=n3 + n4 + n6 + n8
  
 providing n-c-d!=0 and a-2c-d!=0 then
  
 p=(a-2*c-d)/2n
 r1= (1-p)*d/(2*p*(n-c-d))
 r2= (1-p)^2 c/(p^2*(n-c-d))
  
 Here, actually done as the log-linear model, as the closed form
 standard error formulae are ugly
  

dohomoz

Name of routine: dohomoz
Source lines: 88933 - 89127
Type subroutine
Call dohomoz(trait, locnam, gene, genetyp, freqfnd, iter, mincnt, norder, gt, thresh, dataset, pval, plevel)
ModuleNone
Notes
  
 marker homozygosity in all subjects or just probands -- codominant system
  

sibpair

Name of routine: sibpair
Source lines: 89140 - 89716
Type subroutine
Call sibpair(tranam, trait, locnam, gene, mappos, typ, sibm, sibr, sibv, mcp, iter, mincnt, weight, dataset, allele_buffer, pval, plevel)
ModuleNone
Notes
  
 perform Haseman-Elston sib-pair regression: univariate
 using squared difference or centred cross-product
 and ibds estimated from the entire sibship
 if missing parental genotypes
  
 typ
  1   Original Haseman-Elston
  2   Haseman-Elston II
  3   Sham and Purcell
  4   Visscher and Hopper
  

sibcor

Name of routine: sibcor
Source lines: 89720 - 89824
Type subroutine
Call sibcor(trait, typ, dataset, muy, vay, rf, rh, npairs, bigship, plevel)
ModuleNone
Notes
  
 Estimate sibling and half-sib intraclass correlations
  

nucibd

Name of routine: nucibd
Source lines: 89836 - 90035
Type subroutine
Call nucibd(gene, setoffset, fa, mo, sta, fin, set, untyped, allele_buffer, ibd)
ModuleNone
Notes
  
 Routines to calculate ibd sharing using full sibship information
 where parent(s) untyped.
  
 ibd(1..nsib*(nsib+1)/2)
 prall(5) probs for 1..4 observed alleles plus all others
  
 1. enumerate alleles segregating among children
 2. generate short list of genotypes for parents
 3. sum up ibd sharing for each pair of sibs for each genotype freq
  

shibd

Name of routine: shibd
Source lines: 90039 - 90090
Type function
Call shibd(c11, c12, c21, c22, p11, p12, p21, p22)
ModuleNone
Notes
  
 Calculate ibd sharing for full sibs when parental genotypes known
  

regwt

Name of routine: regwt
Source lines: 90094 - 90109
Type function
Call regwt(weight, i, j, dataset)
ModuleNone
Notes
  
 Calculate regression weight
  

hibd

Name of routine: hibd
Source lines: 90114 - 90172
Type function
Call hibd(c11, c12, c21, c22, p11, p12, pc1, pc2, p21, p22)
ModuleNone
Notes
  
 estimate ibd score for a pair of half-sibs -- parents known
 tabulations of number of genes expected shared ibd
  

twopoi

Name of routine: twopoi
Source lines: 90181 - 90313
Type subroutine
Call twopoi(mark1, loc1, mark2, loc2, allele_buffer1, allele_buffer2, dataset, plevel)
ModuleNone
Notes
  
 perform Elston & Keats sib pair linkage analysis
 between two codominant markers
  
 recombination fraction c= 0.5 (1-sqrt(r))
 where r is the correlation between mean ibd at marker1 and mean ibd at
 marker2 for all sib pairings
  

countall

Name of routine: countall
Source lines: 90317 - 90348
Type subroutine
Call countall(p1, p2, p3, p4, nallele, nmiss)
ModuleNone
Notes
  
 Count alleles in pair of relatives or spouses
  

doasp

Name of routine: doasp
Source lines: 90352 - 90590
Type subroutine
Call doasp(trait, locnam, gene, gt, thresh, allele_buffer, dataset, pval, plevel)
ModuleNone
Notes
 Do ibs sharing ASP analysis as per Lange 1986 and Bishop 1990

sshare

Name of routine: sshare
Source lines: 90594 - 90605
Type subroutine
Call sshare(g1, g2, g3, g4, zibs)
ModuleNone
Notes
  
 Return IBS sharing for relative pair 
  

dopenrose

Name of routine: dopenrose
Source lines: 90609 - 90731
Type subroutine
Call dopenrose(loc1, trait, typ1, loc2, gene, typ2, dataset, iter, plevel)
ModuleNone
Notes
 Penrose sib pair linkage analysis

shipsiz

Name of routine: shipsiz
Source lines: 90735 - 90762
Type subroutine
Call shipsiz(dataset, bigship)
ModuleNone
Notes
  
 Find biggest active sibship
  

doapm

Name of routine: doapm
Source lines: 90766 - 91351
Type subroutine
Call doapm(trait, locnam, gene, typ, iter, burnin, gt, thresh, dataset, allele_buffer, pvalout, plevel)
ModuleNone
Notes
  
 Perform Monte-Carlo based APM analysis
  

loadset

Name of routine: loadset
Source lines: 91355 - 91399
Type subroutine
Call loadset(gene, ped, allele_buffer, dataset, set, nuntyp)
ModuleNone
Notes
 Copy genotypes from pedigree to set

pedibd

Name of routine: pedibd
Source lines: 91403 - 91432
Type subroutine
Call pedibd(typ, ped, dataset, set, sibd)
ModuleNone
Notes
 Pedigree structure type call to simibd

makewt

Name of routine: makewt
Source lines: 91438 - 91456
Type function
Call makewt(typ, naff, unaff, var)
ModuleNone
Notes
  
 Calculate some plausible weights to allow combination of APM statistics
 from different pedigrees
 type=1 pair=AA, 2 AU, 3 UU, 4 GPM, 5 W-H
  

clcibs

Name of routine: clcibs
Source lines: 91460 - 91572
Type subroutine
Call clcibs(naff, unaff, aff, allele_buffer, set, z)
ModuleNone
Notes
  
 Calculate ibs statistic
  

delta

Name of routine: delta
Source lines: 91576 - 91581
Type function
Call delta(g1,g2)
ModuleNone
Notes
  
 measure of IBS sharing
  

clcibd

Name of routine: clcibd
Source lines: 91585 - 91649
Type subroutine
Call clcibd(naff, unaff, aff, sibd, zibd)
ModuleNone
Notes
  
 calculate ibd sharing statistic based on simulated ibd
  

share

Name of routine: share
Source lines: 91653 - 91667
Type subroutine
Call share(g1, g2, g3, g4, zibd)
ModuleNone
Notes
  
 Return IBD sharing for relative pair based on ibd-alleles
  

simil

Name of routine: simil
Source lines: 91689 - 91750
Type function
Call simil(nfound, naff, aff, sibd, key)
ModuleNone
Notes
  
 Whittemore's & Halpern's (Biometrics 1994; 50:118-127) measure
 of ibd sharing for multiple relatives
  
 for a set of N individuals, enumerate 2**N vectors containing
 one ibd-allele from each person.  For each such set u_i, calculate
 a measure of overall similarity as the number of [additional] "nontrivial"
 permutations of that set that leave u unchanged.  For example, if
 3 individuals are {1/2} {1/3} {1/2}, there are 8 u's, which give a total
 abc  Legal permutations (excl obs)   of 10 possible permutations, with
 111  5    acb, bac, bca, cab, cba    a mean of 10/8.  If a 4th relative
 112  1    bac                        was ibd-genotype {4/5}, the mean
 131  1    cba                        would be 10/16.  The mean score (S)
 132  0                               is used to derive a standardized
 211  1    acb                        score [S-E(S)]/SD(S), as in the APM
 212  1    cba                        method, although direct enumeration
 231  0                               is of course feasible for small N.
 232  1    cba
  
 Randomized version
  

clreg

Name of routine: clreg
Source lines: 91756 - 92043
Type subroutine
Call clreg(typ, styp, nterms, terms, nloci, loc, loctyp, locpos, gene, genemod, allele_buffer, dataset, mlik, mpar, statval, pval, plevel)
ModuleNone
Notes
  
 Conditional logistic regression version of 20151026
 Stratum variable is either pedigree, sibship or (new)
   stratifying variable (which may cross pedigrees)
  

getstrata

Name of routine: getstrata
Source lines: 92053 - 92141
Type subroutine
Call getstrata(styp, dataset, nstrata, strata, stratpos)
ModuleNone
Notes
 Locate beginnings and ends of strata 
   stratpos is position of ith individual
   strata    0    1   2   3
             0    3   5   7
   stratpos   2 4 7 1 5 3 6
   from data:  
              B A C A B C A

dohrr

Name of routine: dohrr
Source lines: 92145 - 92466
Type subroutine
Call dohrr(trait, locnam, gene, iter, mincnt, gt, thresh, dataset, allele_buffer, pval, plevel)
ModuleNone
Notes
 Haplotype Relative Risk

dotdt

Name of routine: dotdt
Source lines: 92470 - 92903
Type subroutine
Call dotdt(trait, locnam, gene, genetyp, freqfnd, iter, mincnt, use2, typ, cutoff, gt, thresh, dataset, pval, plevel)
ModuleNone
Notes
 Monte-Carlo approach to various TDTs

tdtuse

Name of routine: tdtuse
Source lines: 92907 - 92926
Type function
Call tdtuse(pg1, pg2, mg1, mg2, naff, use2, xlinkd)
ModuleNone
Notes
 test if useful for TDT

shuffle

Name of routine: shuffle
Source lines: 92932 - 92999
Type subroutine
Call shuffle(nallele, cntall, tot, cutoff, tdt, mxiter, mincnt, pvalue)
ModuleNone
Notes
 randomization test for allelic TDT -- shuffle table ITER times
 using TOT swaps per shuffle
 Genotype counts: all1, all2, #all1 trans, #all2 trans

clctdt

Name of routine: clctdt
Source lines: 93003 - 93022
Type function
Call clctdt(ngcount, gcount, cutoff)
ModuleNone
Notes
 calculate symmetry pearson chi-square

clcchi

Name of routine: clcchi
Source lines: 93026 - 93047
Type function
Call clcchi(ngcount, gcount, cutoff)
ModuleNone
Notes
 calculate g.o.f. LR chi-square

trans

Name of routine: trans
Source lines: 93052 - 93141
Type subroutine
Call trans(pg1, pg2, mg1, mg2, cg1, cg2, tr1, tr2, nt1, nt2, typ)
ModuleNone
Notes
 Test the 4 possible unions of gametes 1 2 3 4 -> 13 14 23 24
 if typ=0 return both parental contributions, else 2=pat, 1=mat

xtrans

Name of routine: xtrans
Source lines: 93145 - 93165
Type subroutine
Call xtrans(mg1, mg2, cg1, cg2, tr1, tr2, nt1, nt2)
ModuleNone
Notes
 Transmission of X-linked marker to a male

incpo

Name of routine: incpo
Source lines: 93169 - 93191
Type subroutine
Call incpo(tr, nt, nall, cntall)
ModuleNone
Notes
 Increment counts of transmitted and nontransmitted alleles: parentwise

incr

Name of routine: incr
Source lines: 93196 - 93222
Type subroutine
Call incr(tr1, tr2, nt1, nt2, ngcount, gcount)
ModuleNone
Notes
 Increment counts of transmitted and expected genotypes
 Revised after reading Thomas 1999

insgen

Name of routine: insgen
Source lines: 93227 - 93271
Type subroutine
Call insgen(a1, a2, ngcount, gcount, typ, haplo)
ModuleNone
Notes
 update counts of genotypes or haplotypes for cases or controls --
 binary search and insertion sort

ldp

Name of routine: ldp
Source lines: 93275 - 93333
Type subroutine
Call ldp(numal, numal2, plevel)
ModuleNone
Notes
 Do LD analysis for unphased data

cubicld

Name of routine: cubicld
Source lines: 93337 - 93512
Type subroutine
Call cubicld(loc1, loc2, typ, counts, pval, sumtyp, plevel)
ModuleNone
Notes
 Two SNPs, unphased and phased data

cubiclik

Name of routine: cubiclik
Source lines: 93516 - 93593
Type subroutine
Call cubiclik(typ, nunph, nph, praw, counts, h1, h2, h3, h4, ex, lik, eh)
ModuleNone
Notes
 Likelihood for pairwise SNP LD table under given level of LD

ld2

Name of routine: ld2
Source lines: 93597 - 93910
Type subroutine
Call ld2(loc1, numal, name1, loc2, numal2, name2, typ, ngcat, nhcat, nxcat, counts, pval, sumtyp, plevel)
ModuleNone
Notes
 Do LD analysis for unphased and phased data

haptogen

Name of routine: haptogen
Source lines: 93914 - 93961
Type subroutine
Call haptogen(numal, numal2, scatter, typ, xlinkd)
ModuleNone
Notes
 Map haplotypes to genotypes 1=phase unknown 2=phase KNOWN

twohwe

Name of routine: twohwe
Source lines: 93965 - 94017
Type subroutine
Call twohwe(numal, numal2, nfull, totpars, model, typ, xlinkd)
ModuleNone
Notes
 Double HWE

twofrq

Name of routine: twofrq
Source lines: 94021 - 94095
Type subroutine
Call twofrq(numal, numal2, ncells, counts, typ, xlinkd)
ModuleNone
Notes
 Marginal allele frequencies two loci

ldtab

Name of routine: ldtab
Source lines: 94099 - 94166
Type subroutine
Call ldtab(numal, numal2, counts, ex, typ, xlinkd)
ModuleNone
Notes
 Show table of genotypes and haplotypes

twold

Name of routine: twold
Source lines: 94171 - 94506
Type subroutine
Call twold(zrec, maxhap, gene1, loc1, ltyp1, gene2, loc2, ltyp2, allele_buffer1, allele_buffer2, dataset, iter, pval, sumtyp, plevel)
ModuleNone
Notes
 Two locus linkage disequilibrium: autosomal or X-linked loci
 identify typed founders or nonfounders who have untyped parents

inchap

Name of routine: inchap
Source lines: 94511 - 94549
Type subroutine
Call inchap(g11, g12, g21, g22, ngcat, npg, allele_buffer1, allele_buffer2, counts, typ)
ModuleNone
Notes
 increment count of phased or unphased genotype, haplotype
 contingency table is partitioned 1..ngcat...ngcat+npg...

tabhap

Name of routine: tabhap
Source lines: 94553 - 94569
Type subroutine
Call tabhap(g1, g2, allele_buffer1, allele_buffer2, tble)
ModuleNone
Notes
 straight haplotype count

useld

Name of routine: useld
Source lines: 94573 - 94597
Type function
Call useld(c1, c2, c3, c4, f1, f2, f3, f4, m1, m2, m3, m4)
ModuleNone
Notes
 Check if useful triad for haplotype inference

ldtest

Name of routine: ldtest
Source lines: 94601 - 94720
Type subroutine
Call ldtest(loc1, allele_buffer1, loc2, allele_buffer2, tble, iter, pval, plevel)
ModuleNone
Notes
  
 LRTS and Permutation P for haplotype table
  

compld

Name of routine: compld
Source lines: 94724 - 94830
Type subroutine
Call compld(gene1, gene2, newgene, cutoff, allele_buffer1, allele_buffer2, dataset)
ModuleNone
Notes
 Infer haplotypes for SNPs in complete LD

moskvina

Name of routine: moskvina
Source lines: 94835 - 94946
Type subroutine
Call moskvina(window, alpha, maxhap, nloci, loc, loctyp, locpos, locord, map, dataset, efftests, plevel)
ModuleNone
Notes
 An improved correction for multiple testing
 Moskvina V, Schmidt KM (2008) Genet Epidemiol 32: 567-573

moskld

Name of routine: moskld
Source lines: 94950 - 94975
Type subroutine
Call moskld(maxhap, loc1, loc2, loc, locpos, loctyp, allele_buffer1, dataset, r)
ModuleNone
Notes
 wrapper for twold

stand

Name of routine: stand
Source lines: 94980 - 95039
Type subroutine
Call stand(trait, dataset, typ)
ModuleNone
Notes
 Standardization of quantitative trait overall or *within* family
 as required by the approach of Commenge

lifetab

Name of routine: lifetab
Source lines: 95042 - 95425
Type subroutine
Call lifetab(date1, date2, censor, covar, covtyp, width1, width2, typ, dataset, plevel)
ModuleNone
Notes

prodlim

Name of routine: prodlim
Source lines: 95433 - 95564
Type subroutine
Call prodlim(trait, censor, dataset, typ, resid, plevel)
ModuleNone
Notes
 Kaplan-Meier estimator of survival function and the Nelson-Aalen
 estimator of cumulative hazard.
 The Nelson-Aalen estimator is used to produce residuals, if requested.
 These are the deviance residuals of Therneau et al Biometrika 1990:
 equivalent to a variance-stabilized transformed martingale residual.

dorank

Name of routine: dorank
Source lines: 95572 - 95647
Type subroutine
Call dorank(trget, trait, typ, dataset)
ModuleNone
Notes
 Rank trait values
 1=rank all
 2=within family rank
 3=Blom score all
 4=within family Blom score

quantnorm

Name of routine: quantnorm
Source lines: 95653 - 95783
Type subroutine
Call quantnorm(nloc, loclist, loc, locpos, loctyp, dataset, plevel)
ModuleNone
Notes
 Quantile normalization
   missing values are dealt with reuse of nearest value rather than 
   linear interpolation

wrsim

Name of routine: wrsim
Source lines: 95788 - 95884
Type subroutine
Call wrsim(typ, mark, gene, allele_buffer, allele_buffer2, dataset, plevel)
ModuleNone
Notes
 Simulate a single marker, either unconditionally, or
 consistent with ibd sharing at a given locus

wrsimq

Name of routine: wrsimq
Source lines: 95890 - 96001
Type subroutine
Call wrsimq(typ, trait, loctyp, prevalence, h2, gene, allele_buffer, allele_buffer2, dataset, plevel)
ModuleNone
Notes
 Simulate a quantitative trait of given heritability,
 either unconditionally, or
 consistent with complete linkage to a given locus

wrsimqtl

Name of routine: wrsimqtl
Source lines: 96006 - 96222
Type subroutine
Call wrsimqtl(trait, gene, smlfreq, smlpen, h2, dataset, plevel)
ModuleNone
Notes
 Simulate QTL genotypes conditional on binary trait values, heritability and 
 marginal QTL penetrances by rejection sampling 

permdata

Name of routine: permdata
Source lines: 96226 - 96248
Type subroutine
Call permdata(trait, dataset)
ModuleNone
Notes
 Permute trait values within pedigrees

dateconv

Name of routine: dateconv
Source lines: 96252 - 96308
Type subroutine
Call dateconv(locnam, trait, dataset, typ)
ModuleNone
Notes
 Convert to/from Julian etc

combine

Name of routine: combine
Source lines: 96312 - 96338
Type subroutine
Call combine(crit, recto, nf, recfro, allele_buffer)
ModuleNone
Notes
 identify rare alleles at a marker locus and list for combination

swapalleles

Name of routine: swapalleles
Source lines: 96342 - 96391
Type subroutine
Call swapalleles(loc, gene, allele_buffer, dataset, plevel)
ModuleNone
Notes
 swap diallelic marker alleles eg 1->2 2->1

renumb

Name of routine: renumb
Source lines: 96395 - 96449
Type subroutine
Call renumb(loc, gene, typ, allele_buffer, dataset)
ModuleNone
Notes
 renumber alleles to consecutive integers

recode

Name of routine: recode
Source lines: 96454 - 96604
Type subroutine
Call recode(loc, gene, loctyp, nto, recto, nf, recfro, dataset, plevel)
ModuleNone
Notes
 recode alleles or values for particular locus --
 replace all "from" values with "to" values

refgeno

Name of routine: refgeno
Source lines: 96611 - 96659
Type subroutine
Call refgeno(loc, gene, loctyp, locnote, allele_buffer, dataset, plevel)
ModuleNone
Notes
 Replace missing genotypes with reference allele homozygote
 Most useful when sequence data (wt by omission)
 Filtering on trait performed by setting dataset%untyped using filter_snp()
 before call.

recast

Name of routine: recast
Source lines: 96663 - 96732
Type subroutine
Call recast(typ, trait, dataset, plevel)
ModuleNone
Notes
 Recast aff or cat to qua or qua to aff or cat

snpenc

Name of routine: snpenc
Source lines: 96736 - 96789
Type subroutine
Call snpenc(gene, trait, typ, dataset)
ModuleNone
Notes
 Dummy encode a SNP 1=add 2=dom 3=rec 

wribs

Name of routine: wribs
Source lines: 96793 - 96941
Type subroutine
Call wribs(trait, gt, thresh, nloci, loc, loctyp, locpos, dataset, plevel)
ModuleNone
Notes
 Multipoint IBS sharing for all pairs

ibspca

Name of routine: ibspca
Source lines: 96945 - 97160
Type subroutine
Call ibspca(typ, nloci, loc, loctyp, locpos, ncomps, loadvars, dataset, plevel)
ModuleNone
Notes
 Principal components or classical MDS analysis of multipoint IBS sharing

wribd

Name of routine: wribd
Source lines: 97166 - 97340
Type subroutine
Call wribd(nmark, mark, loc, loctyp, locpos, dataset, burnin, iter, typ, plevel)
ModuleNone
Notes
 Monte-Carlo approach to estimating IBD sharing at a marker
   typ=1 as lower triangular matrix
       2 pairwise 

markeribd

Name of routine: markeribd
Source lines: 97344 - 97540
Type subroutine
Call markeribd(gene, iter, burnin, allele_buffer, ped, dataset, ibdcount, ibdvar, plevel)
ModuleNone
Notes
 Monte-Carlo approach to estimating IBD sharing at a marker for a pedigree

dokin

Name of routine: dokin
Source lines: 97544 - 97693
Type subroutine
Call dokin(typ, dataset)
ModuleNone
Notes
 Write kinship coefficients

kinship

Name of routine: kinship
Source lines: 97697 - 97743
Type subroutine
Call kinship(ped, dataset, kin)
ModuleNone
Notes
 Calculate kinship coefficient

frater

Name of routine: frater
Source lines: 97747 - 97775
Type subroutine
Call frater(ped, dataset, kin, dom)
ModuleNone
Notes
 Calculate coefficient of fraternity

delta7

Name of routine: delta7
Source lines: 97780 - 97815
Type function
Call delta7(peri, perj, ped, dataset, kin)
ModuleNone
Notes
 Coefficient of fraternity for one pair of relatives
 peri and perj are relative to start of current pedigree

inbreeding

Name of routine: inbreeding
Source lines: 97819 - 97855
Type subroutine
Call inbreeding(ped, dataset, iter, fvalues, estimator)
ModuleNone
Notes
 Estimate inbreeding coefficient for pedigree

exact_inbreeding

Name of routine: exact_inbreeding
Source lines: 97859 - 97891
Type subroutine
Call exact_inbreeding(ped, dataset, kin, fvalues)
ModuleNone
Notes
 kinship based version

drop_inbreeding

Name of routine: drop_inbreeding
Source lines: 97895 - 97969
Type subroutine
Call drop_inbreeding(ped, dataset, iter, fvalues)
ModuleNone
Notes
 MC version

doinbred

Name of routine: doinbred
Source lines: 97973 - 98067
Type subroutine
Call doinbred(iter, dataset, trait, plevel)
ModuleNone
Notes
 inbreeding for all active pedigrees

invkin

Name of routine: invkin
Source lines: 98072 - 98121
Type subroutine
Call invkin(ped, dataset, ainv)
ModuleNone
Notes

 A~ = (T~)' D~ T~

segerr

Name of routine: segerr
Source lines: 98126 - 98167
Type subroutine
Call segerr(ped, dataset, rsd)
ModuleNone
Notes
 Calculate standard deviation of segregation error
 (used for gametic model breeding value calculation)

casekin

Name of routine: casekin
Source lines: 98171 - 98420
Type subroutine
Call casekin(locnam, trait, gt, thresh, dataset, statval, pval, iter, plevel)
ModuleNone
Notes
 Give kinships among affecteds

ancest

Name of routine: ancest
Source lines: 98425 - 98553
Type subroutine
Call ancest(locnam, trait, gt, thresh, dataset, plevel)
ModuleNone
Notes
 Find the ancestor(s) shared by the maximum number of affecteds
 Also calculate inbreeding among all cases within each family

wrdesc

Name of routine: wrdesc
Source lines: 98557 - 98572
Type subroutine
Call wrdesc(pedigree, cid, sx, ndesc, ntot)
ModuleNone
Notes
 write person and number of descendants

mksegmod

Name of routine: mksegmod
Source lines: 98576 - 98969
Type subroutine
Call mksegmod(narg, words, trait, gt, thresh, offset, censor, nvar, varlist, nloci, loc, lochash, loctyp, priran, nqtl, linkf, modtyp, shap)
ModuleNone
Notes
 Parse a mixed model

preseg

Name of routine: preseg
Source lines: 98973 - 99029
Type subroutine
Call preseg(nvar, fixed, loc, loctyp, gene, allele_buffer, covariates)
ModuleNone
Notes
 Names and preliminary estimates for fixed effects part of mixed model

segsim

Name of routine: segsim
Source lines: 99036 - 100078
Type subroutine
Call segsim(linkf, modtyp, shap, trait, gt, thresh, offset, censor, nvar, fixed, gene, genemod, allele_buffer, nloci, loc, loctyp, locpos, burnin, iter, nbatch, nsamples, tune, nchain, nqtl, dataset, mlik, mpar, priran, mcalg, plevel)
ModuleNone
Notes
 Mixed model MCMC: simulate genotypes at 1..N unlinked QTLs
                            Gaussian breeding values
                            family intercepts
                            regression coefficients for fixed effects

genfreq

Name of routine: genfreq
Source lines: 100082 - 100093
Type subroutine
Call genfreq(pall, qtl_buffer)
ModuleNone
Notes
 QTL genotypic log frequencies

oneprop

Name of routine: oneprop
Source lines: 100098 - 100234
Type subroutine
Call oneprop(it, typ, mcalg, linkf, modtyp, nchain, nqtl, nfix, ncol, totobs, nprops, ncomp, tune, yvar, qtl_buffer, prop_buffer, nfam, families, dataset, empmu, empvar, lik, newlik, plevel)
ModuleNone
Notes
 One iteration of the sampler: either parameters or random effects
 Give "empirical" estimates of random effects variances

mhprop

Name of routine: mhprop
Source lines: 100239 - 100325
Type subroutine
Call mhprop(iprop, linkf, modtyp, nchain, nqtl, nfix, ncol, tune, yvar, qtl_buffer, nfam, families, dataset, lik, newlik, plevel)
ModuleNone
Notes

 Metropolis sampler for global parameters

slprop

Name of routine: slprop
Source lines: 100330 - 100458
Type subroutine
Call slprop(iprop, linkf, modtyp, nchain, nqtl, nfix, ncol, qtl_buffer, nfam, families, dataset, lik, newlik, plevel)
ModuleNone
Notes
 end-of-mhprop

 Slice sampler for global parameters

parprop

Name of routine: parprop
Source lines: 100464 - 100490
Type subroutine
Call parprop(typ, tune, yvar, oobounds)
ModuleNone
Notes
 end-of-slprop

 Make a proposal for one QTL model parameter for Metropolis sampler
 oobounds!=0 when proposal is illegal

parbounds

Name of routine: parbounds
Source lines: 100496 - 100517
Type subroutine
Call parbounds(typ, oobounds)
ModuleNone
Notes
 end-of-parprop

 Check Metropolis proposal
 oobounds!=0 when proposal is illegal

qtlmod

Name of routine: qtlmod
Source lines: 100531 - 100618
Type subroutine
Call qtlmod(linkf, modtyp, nqtl, qtl_buffer)
ModuleNone
Notes
 end-of-parbounds

 QTL allelic deviations, allele and genotype frequencies
 For identity link models, use  
   pA, mu, totvar, a2, d2, h2, c2 to calculate all other parameters
 For other GLMs, use
   VA etc
 model pars 1=P(all) 2=a 3=d 4=AA 5=AB 6=BB
            7=mu 8=totvar 9=VA 10=VD 11=VG 12=VC 13=VS 14=VE
            15=sdG 16=sdC 17=sdS 18=sdE
            19=a2 20=d2 21=h2 22=c2 23=s2 24=e2
            25..MAXPAR=Betas

chkbin

Name of routine: chkbin
Source lines: 100622 - 100640
Type subroutine
Call chkbin(nqtl, oobounds)
ModuleNone
Notes
 check bounds on linear binomial model terms

triprop

Name of routine: triprop
Source lines: 100645 - 100656
Type subroutine
Call triprop(tune, p)
ModuleNone
Notes
 end-of-chkbin

 Circularized triangular random proportion

linfun

Name of routine: linfun
Source lines: 100662 - 100686
Type subroutine
Call linfun(linkf, y, thresh)
ModuleNone
Notes
 end-of-triprop

 link function for binary data
 linkf=1 identity 2 logit 3 probit 4 MFT 5=Log

dens

Name of routine: dens
Source lines: 100691 - 100735
Type function
Call dens(x, mu, sd, shap, cens, modtyp)
ModuleNone
Notes
 end-of-linfun

 Poisson or Binomial or Gaussian log density for FPM

pedlik

Name of routine: pedlik
Source lines: 100741 - 100779
Type subroutine
Call pedlik(linkf, modtyp, nchain, nqtl, nfix, ncol, qtl_buffer, nfam, families, dataset, lik, oobounds, plevel)
ModuleNone
Notes
 end-of-dens

 Calculate likelihood under FPM for entire sample of pedigrees
 over all chains (replicates)

seglik

Name of routine: seglik
Source lines: 100784 - 100836
Type subroutine
Call seglik(linkf, modtyp, ichain, nqtl, nfix, qtl_buffer, family, dataset, plevel)
ModuleNone
Notes
 end-of-pedlik

 Calculate likelihood under FPM for one pedigree (one chain/replicate)

oneseg

Name of routine: oneseg
Source lines: 100842 - 101073
Type subroutine
Call oneseg(it, linkf, modtyp, ichain, nqtl, nfix, qtl_buffer, prop_buffer, family, dataset, mcalg, plevel)
ModuleNone
Notes
 end-of-seglik

 Update (gene-dropping) genotypes at one of N unlinked QTLs
 or Gaussian polygenotype or familial random intercept

oneslice

Name of routine: oneslice
Source lines: 101077 - 101214
Type subroutine
Call oneslice(ieff, linkf, modtyp, shap, ichain, nqtl, nfix, qtl_buffer, family, dataset, plevel)
ModuleNone
Notes
 Slice sampler updating Gaussian polygenotype

sliceprop

Name of routine: sliceprop
Source lines: 101219 - 101244
Type subroutine
Call sliceprop(ieff, idx, mztwin_proposal, twinlist, ichain, prop, family)
ModuleNone
Notes
 end-of-oneslice

 copy proposal to appropriate location

idxlik

Name of routine: idxlik
Source lines: 101250 - 101297
Type subroutine
Call idxlik(linkf, modtyp, shap, ichain, nqtl, nfix, qtl_buffer, family, dataset, lik, gtplik)
ModuleNone
Notes
 end-of-sliceprop

 Gaussian polygenotype likelihood contribution of individual idx (and
 affected relatives)

seglf

Name of routine: seglf
Source lines: 101301 - 101379
Type subroutine
Call seglf(typ, idx, ichain, linkf, modtyp, shap, nqtl, nfix, qtl_buffer, family, dataset, yp, lik, gtplik)
ModuleNone
Notes
 Likelihood contribution of a founder

seglnf

Name of routine: seglnf
Source lines: 101383 - 101450
Type subroutine
Call seglnf(typ, idx, ichain, curmo, linkf, modtyp, shap, nqtl, nfix, qtl_buffer, family, dataset, yp, lik, gtplik)
ModuleNone
Notes
 Likelihood contribution of a nonfounder

isimped

Name of routine: isimped
Source lines: 101455 - 101538
Type subroutine
Call isimped(ped, dataset, qtl_buffer, set)
ModuleNone
Notes
  Resimulate (gene-dropping) genotypes at a single autosomal locus
  in descendants of randomly selected index

simpol

Name of routine: simpol
Source lines: 101542 - 101624
Type subroutine
Call simpol(vsd, ichain, family)
ModuleNone
Notes
 Propose updated additive polygenic values in a pedigree

simmat

Name of routine: simmat
Source lines: 101629 - 101662
Type subroutine
Call simmat(vstep, ichain, family)
ModuleNone
Notes
 end-of-simpol

 Propose updated sibship/maternal effects in a pedigree

empval

Name of routine: empval
Source lines: 101668 - 101767
Type subroutine
Call empval(linkf, modtyp, nchain, nqtl, nfix, nfam, families, totobs, empmu, empvar)
ModuleNone
Notes
 end-of-simmat

 Get empirical estimates of random effects
 Tote up empirical statistics for random effects: VG, VC, VS, VE

initvc

Name of routine: initvc
Source lines: 101772 - 101839
Type subroutine
Call initvc(nchain, nfam, families)
ModuleNone
Notes
 end-of-empval

 Initialize additive genetic and/or maternal random effects

set2hap

Name of routine: set2hap
Source lines: 101845 - 101872
Type subroutine
Call set2hap(ichain, iqtl, num, set, hset, typ)
ModuleNone
Notes
 end-of-initvc

 Copy or swap genotypes from set to hset
 1=set->hset; 2=hset->set; 3=swap

fpmpred

Name of routine: fpmpred
Source lines: 101877 - 101913
Type subroutine
Call fpmpred(typ, idx, ichain, linkf, nqtl, nfix, family, yp, ypf)
ModuleNone
Notes
 end-of-set2hap

 FPM Linear predictor

updateblups

Name of routine: updateblups
Source lines: 101917 - 101979
Type subroutine
Call updateblups(whichblup, nvals, nchain, nfam, families)
ModuleNone
Notes
 Accumulate BLUP for additive genetic effects

dobatch

Name of routine: dobatch
Source lines: 101983 - 102012
Type subroutine
Call dobatch(nbatch, nvar, batch, batchse)
ModuleNone
Notes
 Produce batch estimates of Monte-Carlo error variance

wronep

Name of routine: wronep
Source lines: 102016 - 102049
Type subroutine
Call wronep(idx, it, ichain, yp, iqtl, nqtl, ieff, lik, family, dataset)
ModuleNone
Notes
 Print oneseg's proposed genotypes for one individual

wrfpm

Name of routine: wrfpm
Source lines: 102054 - 102144
Type subroutine
Call wrfpm(it, linkf, modtyp, ichain, nqtl, nfix, family, dataset)
ModuleNone
Notes
 end-of-wronep

 Print simulated genotypes from FPM iteration

wlscor

Name of routine: wlscor
Source lines: 102148 - 102196
Type subroutine
Call wlscor(cor, npairs, stderr)
ModuleNone
Notes
 WLS analysis of familial correlations

domft

Name of routine: domft
Source lines: 102200 - 102405
Type subroutine
Call domft(trait, prevalence, logrid, higrid, gridstep, dataset, mlik, mpar, herit, iter, typ, plevel)
ModuleNone
Notes
 MFT

sibqtl

Name of routine: sibqtl
Source lines: 102409 - 102670
Type subroutine
Call sibqtl(tranam, trait, locnam, gene, allele_buffer, dataset, pval, plevel, invalg, toler)
ModuleNone
Notes
 Variance components analysis

varcom

Name of routine: varcom
Source lines: 102678 - 103550
Type subroutine
Call varcom(modtyp, nterms, terms, nloci, loc, loctyp, locpos, gene, genemod, allele_buffer, nmark, mark, dataset, totobs, mlik, mpar, pval, plevel, burnin, iter, typ, invalg, optim, toler)
ModuleNone
Notes
 Variance components analysis
 modtyp 1=MVN 2=MFT 3=MFT_BOBYQA
 typ 1=CE 2=AE 3=ACE 4=ADE
     5=AQE (6=AQE emp kin for Q)
     7=CQE (8=AQE ibd inline in script)

covreg

Name of routine: covreg
Source lines: 103554 - 103595
Type subroutine
Call covreg()
ModuleNone
Notes
  
 Regression analysis to generate starting values for varcom
  

vcprofile

Name of routine: vcprofile
Source lines: 103599 - 103642
Type subroutine
Call vcprofile(modtyp, whichpar, vc_nfix, npar, parest, modlik, lo95, up95)
ModuleNone
Notes
 Function to give profile likelihood for given parameter of MVN model

brent_proflik

Name of routine: brent_proflik
Source lines: 103646 - 103656
Type function
Call brent_proflik(x)
ModuleNone
Notes
 Functions to give profile likelihood for A in AE model

brent_proflik_mft

Name of routine: brent_proflik_mft
Source lines: 103658 - 103668
Type function
Call brent_proflik_mft(x)
ModuleNone

vcov

Name of routine: vcov
Source lines: 103672 - 103722
Type subroutine
Call vcov(va, vq, ve, vcvmat)
ModuleNone
Notes
 GLS model VCOV for fixed effects part of MVN mixed model

thinibd

Name of routine: thinibd
Source lines: 103726 - 103757
Type subroutine
Call thinibd(ped, dataset, nobs, ibd1, ibd2)
ModuleNone
Notes
 Drop covariance matrix entries for unused records

syminv

Name of routine: syminv
Source lines: 103761 - 103803
Type subroutine
Call syminv(a, n, c, logdet, info)
ModuleNone
Notes
 Call to LINPACK routines to invert packed lower triangular symmetric matrix

geninv

Name of routine: geninv
Source lines: 103807 - 103844
Type subroutine
Call geninv(a, n, c, logdet, matrank, info)
ModuleNone
Notes
 Call to LINPACK routines to pseudo-invert packed lower triangular symmetric matrix

gibinv

Name of routine: gibinv
Source lines: 103869 - 103928
Type subroutine
Call gibinv(cov, n, invcov, logdet, iter, plevel)
ModuleNone
Notes
 D. A. Harville. Use of the Gibbs sampler to invert large, possibly
 sparse, positive definite matrices. Linear Algebra and its
 Applications, 289:203-224, 1999.

 Proposal of Harville is Gibbs sampler using just (3)
 1.  Set arbitrary starting values for z, z*
     for instance z_i=0, z*_i=i
 2.  Sample Phi as a vector containing independent draws according
     with definition (5) and (6):
       (5) E(Phi)=0 (6) E(Phi[k]*Phi[l])=I*delta(k,l)
 3.  Update z, z* by using equations (3)
       (3) z_i[k] = Phi_i[k]/sqrt(c_ii) -
                    Sum(z_j[k] c_ij, j=1,i-1)/c_ii -
                    Sum(z_j[k-1] c_ij, j=i+1,n)/c_ii
 4.  p = p + 1
 5.  Go to step 2 until abs(z'z*) < tol
 6.  Sample Phi as a vector containing independent draws according
     with definition (5) and (6)
 7.  Update z using equation (3)
 8.  Accumulate Cov(z) in s
 9.  Go to step 6 to compute the next round of iteration (B - p times)
 10. Set the final estimate: Inv(C) =  s/(B - p)

oneinv

Name of routine: oneinv
Source lines: 103932 - 103955
Type subroutine
Call oneinv(n, nn, cov, z)
ModuleNone
Notes
 One iteration of update of z

brent

Name of routine: brent
Source lines: 103982 - 104079
Type function
Call brent(ax, bx, f, tol)
ModuleNone
Notes
  
 Brent's one-dimensional minimizer
  
 The method used is a combination of golden section search and
 successive parabolic interpolation.  Convergence is never much
 slower than that for a Fibonacci search.  If F has a continuous
 second derivative which is positive at the minimum (which is not
 at AX or BX), then convergence is superlinear, and usually of the
 order of about 1.324....
  
 INPUT PARAMETERS
  
  AX    (real)  left endpoint of initial interval
  BX    (real) right endpoint of initial interval
  F     Real function of the form REAL FUNCTION F(X) which evaluates
          F(X)  for any  X in the interval  (AX,BX)
        Must be declared EXTERNAL in calling routine.
  TOL   (real) desired length of the interval of uncertainty of the
        final result ( .ge. 0.0)
  
 OUTPUT PARAMETERS
  
 FMIN   abcissa approximating the minimizer of F
 AX     lower bound for minimizer
 BX     upper bound for minimizer
  

polyinter

Name of routine: polyinter
Source lines: 104084 - 104139
Type subroutine
Call polyinter(idegree, nvals, yval, xval, varwt, maxx, maxy, plevel)
ModuleNone
Notes
 Fit curve and interpolates maximum of y
 Passes coefficients to brent_interp using AS164_class

brent_inter

Name of routine: brent_inter
Source lines: 104143 - 104152
Type function
Call brent_inter(x)
ModuleNone
Notes
 predicted value from regression equation

Name of routine:
Source lines: 104162 - 104204
Type subroutine
Call qdcrt (a, z)
ModuleNone
Notes
        QDCRT computes the roots of the real polynomial
              A(1) + A(2)*Z + A(3)*Z**2
     and stores the results in Z.  It is assumed that A(3) is nonzero.

     Converted to be compatible with ELF90 by Alan Miller
        amiller @ bigpond.net.au
        Latest revision - 27 February 1997

counthom

Name of routine: counthom
Source lines: 104208 - 104234
Type subroutine
Call counthom(gene, dataset, obshom)
ModuleNone
Notes
 Count proportion of observed homozygotes for a locus

globhom

Name of routine: globhom
Source lines: 104239 - 104465
Type subroutine
Call globhom(dataset, long_roh, trait, plevel)
ModuleNone
Notes
 Calculate observed and expected homozygosity for all individuals
 Save F_roh to quantitative variable

globhom_onelocus

Name of routine: globhom_onelocus
Source lines: 104469 - 104496
Type subroutine
Call globhom_onelocus(gene, loctyp, dataset, exphom)
ModuleNone
Notes
 Homozygosity contribution for ith locus

mulhom

Name of routine: mulhom
Source lines: 104501 - 104813
Type subroutine
Call mulhom(trait, gt, thresh, xlinkd, iter, mincnt, nloci, loc, loctyp, locpos, map, dataset, plevel)
ModuleNone
Notes
 Calculate observed and expected multipoint homozygosity
 Expected distribution simulated using given map

clcrun

Name of routine: clcrun
Source lines: 104817 - 104861
Type subroutine
Call clcrun(ped, dataset, nmark, hset, runlen, totrunlen, averun)
ModuleNone
Notes
 calculate average maximum run length of homozygosity

simhap

Name of routine: simhap
Source lines: 104865 - 104940
Type subroutine
Call simhap(nmark, recdist, alleles, ped, dataset, hset, plevel)
ModuleNone
Notes
 Drop haplotypes for all family members for given map

exclude

Name of routine: exclude
Source lines: 104945 - 104971
Type subroutine
Call exclude(imp, nloci, loc, loctyp, locpos, dataset, inconsist, imputd, plevel)
ModuleNone
Notes
 Excluding genotypes from parental phenoset
 Straight Lange & Goradia AJHG 1987 40: 250-256

exclude_onelocus

Name of routine: exclude_onelocus
Source lines: 104975 - 105047
Type subroutine
Call exclude_onelocus(imp, gene, loc, loctyp, dataset, inconsist, imputd, plevel)
ModuleNone
Notes
 Exclude at one locus

exclude_oneped

Name of routine: exclude_oneped
Source lines: 105051 - 105378
Type subroutine
Call exclude_oneped(imp, reduce, locnam, gene, xlinkd, ped, dataset, allele_buffer, set, gset, inconsist, imputd, plevel)
ModuleNone
Notes
 Do one pedigree at one locus

wrset

Name of routine: wrset
Source lines: 105382 - 105412
Type subroutine
Call wrset(locnam, ped, dataset, set, gset)
ModuleNone
Notes
 write out phenoset

exc

Name of routine: exc
Source lines: 105416 - 105550
Type subroutine
Call exc(locnam, xlinkd, gene, ped, dataset, set, gset, inconsist, plevel)
ModuleNone
Notes
 perform exclusion for the pedigree regardless of imputation level

landg

Name of routine: landg
Source lines: 105554 - 105672
Type subroutine
Call landg(xlinkd, currf, currm, sta, fin, sex, set, gset, change, incon)
ModuleNone
Notes
 2nd version of impute -- following Lange & Goradia, 1987

prune

Name of routine: prune
Source lines: 105676 - 105700
Type subroutine
Call prune(idx, ngeno, gset, keep)
ModuleNone
Notes
 Remove unwanted genotypes from phenoset

swapg

Name of routine: swapg
Source lines: 105704 - 105715
Type subroutine
Call swapg(idx, gset, j, k)
ModuleNone
Notes
 Swap two genotypes within a phenoset array

doblup

Name of routine: doblup
Source lines: 105719 - 105792
Type subroutine
Call doblup(locnam, trait, h2, dataset, plevel)
ModuleNone
Notes
 Calculate BLUPs for VC model

blup

Name of routine: blup
Source lines: 105796 - 105877
Type subroutine
Call blup(lam, trait, ped, dataset, ainv, bval, fmu)
ModuleNone
Notes
 Calculate BLUPs for current pedigree

hapassoc

Name of routine: hapassoc
Source lines: 105886 - 106327
Type subroutine
Call hapassoc(nmark, markers, loc, loctyp, locpos, locnotes, dataset, pval, plevel)
ModuleNone
Notes
 
 Association haplotype analysis for unphased data

 counts  ncells  ncat*(na1*(na1+1)/2)*(na2*(na2+1)/2)
 full    nfull   ncat*(nh1*(nh1+1)/2)*(nh2*(nh2+1)/2)
 scatter nfull*nobs
 model   nfull*(ncat + nh1 + nh2 + nh1*nh2 [ + ncat*nh1*nh2 ])

agl

Name of routine: agl
Source lines: 106336 - 106366
Type subroutine
Call agl(nr, nc, design, sta, nalleles, nstrata)
ModuleNone
Notes
  
 Appropriate design matrix columns for allelic model
 a1 a2  gen
 2  0   1/1
 1  1   1/2
 1  1   2/1
 0  2   2/2
  

hap2gen

Name of routine: hap2gen
Source lines: 106370 - 106421
Type subroutine
Call hap2gen(nrep, nmarkers, numals, scatter)
ModuleNone
Notes
 Phased genotype to unphased genotype mapping

wrmat

Name of routine: wrmat
Source lines: 106424 - 106435
Type subroutine
Call wrmat(nr, nc, mat)
ModuleNone
Notes
 Convenience routine

nearloc

Name of routine: nearloc
Source lines: 106441 - 106507
Type subroutine
Call nearloc(pos, thresh, maxcluster, nloci, loc, loctyp, group, map, nmark, mark, plevel)
ModuleNone
Notes
 The set of markers close to an index marker             A         B
 map distances are interpreted adjacently ie 10-5-15 = B unlinked 
                                                       C unlinked  10

dopeel

Name of routine: dopeel
Source lines: 106536 - 106602
Type subroutine
Call dopeel(typ, gene, trait, maxiter, allele_buffer, dataset, totlik, plevel)
ModuleNone
Notes
 Iterative peeling in pedigrees -- Description from thesis of Schelling 2004

 1. for each pedigree member i to initialize anterior values to the population genotype
    frequency and posterior values to unity subsequently calculate its 
    penetrance values.
 2. Then, for each connector i
  a) for families in which i is an offspring, its anterior value ai (ui )
     is calculated non-recursively using (2.16) and the current values of
     the required quantities.
  b) for families in which i is a parent, its posterior value pij (ui )
     through each mate j is calculated non-recursively using (2.17) and the
     current values of the required quantities.
 Repeat 2 until values converge

 Additionally, anterior, posterior and penetrance values may be scaled
 to sum to unity over genotype as described in Wang et al. (1996) to
 avoid numerical underflow. The log scaling factors Kai , Kgi and Kpij
 for the anterior, posterior and penetrance values are also calculated
 using the current values of the required quantities. They denote the
 accumulative log of the scaling factors for the anterior, posterior
 and penetrance values for member i with its mother mi and father pi .

 In 2.16 and 2.17, S denotes set of mates, C denotes set of full-sibs

 typ=1 likelihood
 typ=2 GPE

itpeel

Name of routine: itpeel
Source lines: 106606 - 107141
Type subroutine
Call itpeel(typ, ped, dataset, gene, allele_buffer, gfrq, transprob, trait, maxiter, lik, ifail, plevel)
ModuleNone
Notes
 pth ped

filltrans

Name of routine: filltrans
Source lines: 107145 - 107172
Type subroutine
Call filltrans(numal, ngeno, transprob)
ModuleNone
Notes
 Create table of transmission probabilities

postprod

Name of routine: postprod
Source lines: 107176 - 107196
Type function
Call postprod(idx, geno, nmates, mates, postp)
ModuleNone
Notes
 Product of posterior values for all matings of ego

postprodex

Name of routine: postprodex
Source lines: 107200 - 107224
Type function
Call postprodex(idx, except, geno, nmates, mates, postidx, postp)
ModuleNone
Notes
 Product of posterior values for all matings of ego save one

postscale

Name of routine: postscale
Source lines: 107228 - 107242
Type function
Call postscale(idx, nmates, mates, pscale)
ModuleNone
Notes
 Sum of posterior value scaling factors for all matings of ego

postscalex

Name of routine: postscalex
Source lines: 107246 - 107264
Type function
Call postscalex(idx, except, nmates, mates, postidx, pscale)
ModuleNone
Notes
 Sum of posterior value scaling factors for all matings of ego

nglist

Name of routine: nglist
Source lines: 107268 - 107276
Type function
Call nglist(gtp,ngeno)
ModuleNone
Notes
 Length of list of genotypes

glist

Name of routine: glist
Source lines: 107280 - 107288
Type function
Call glist(gtp, idx)
ModuleNone
Notes
 member of list of genotypes

itlik

Name of routine: itlik
Source lines: 107292 - 107325
Type subroutine
Call itlik(trget, ngeno, gtp, nmates, mates, antp, postp, ascale, pscale, lik)
ModuleNone
Notes
 Likelihood from iterative peeling

dopeel2

Name of routine: dopeel2
Source lines: 107333 - 107463
Type subroutine
Call dopeel2(typ, mark1, mark2, theta, maxiter, allele_buffer1, allele_buffer2, dataset, plevel)
ModuleNone
Notes
 Two locus version
 typ=1 likelihood
 typ=2 grid
 typ=3 GPE at r=0
 typ=4 first locus allelic dose, r=0

itpeel2

Name of routine: itpeel2
Source lines: 107467 - 108125
Type subroutine
Call itpeel2(typ, ped, dataset, mark1, mark2, allele_buffer1, allele_buffer2, ngeno, phased, gfrq, ngrid, grid, famlik, istat, maxiter, ifail, plevel)
ModuleNone
Notes
 Iterative peeling two codominant loci over grid of recombination fractions: pth ped

nglist2

Name of routine: nglist2
Source lines: 108129 - 108134
Type function
Call nglist2(gtp)
ModuleNone
Notes
 Length of list of genotypes

glist2

Name of routine: glist2
Source lines: 108138 - 108144
Type function
Call glist2(gtp, idx)
ModuleNone
Notes
 member of list of genotypes

transprob

Name of routine: transprob
Source lines: 108148 - 108164
Type function
Call transprob(geno, fgeno, mgeno, ngeno, phased, prec, pnrec)
ModuleNone
Notes
 Parent-offspring triad

transmit

Name of routine: transmit
Source lines: 108172 - 108185
Type function
Call transmit(p11, p12, p21, p22, c1, c2, prec, pnrec)
ModuleNone
Notes
 Transmission probabilities: two codominant loci, phased genotypes

 p11 | p12        c1
     |       =>
 p21 | p22        c2

itlik2

Name of routine: itlik2
Source lines: 108189 - 108222
Type subroutine
Call itlik2(trget, gtp, nmates, mates, antp, postp, ascale, pscale, lik)
ModuleNone
Notes
 Likelihood from iterative peeling

fillphase

Name of routine: fillphase
Source lines: 108226 - 108275
Type subroutine
Call fillphase(allele_buffer1, allele_buffer2, ngeno, phased, gfrq)
ModuleNone
Notes
 Phased genotype frequencies

dochol

Name of routine: dochol
Source lines: 108277 - 108308
Type subroutine
Call dochol(n)
ModuleNone

doeigen

Name of routine: doeigen
Source lines: 108310 - 108344
Type subroutine
Call doeigen(n)
ModuleNone

dcentre

Name of routine: dcentre
Source lines: 108349 - 108373
Type subroutine
Call dcentre(n, nn, x)
ModuleNone
Notes
 double centre a distance matrix (lower triangular form)
 used for MDS

twinken

Name of routine: twinken
Source lines: 108378 - 108613
Type subroutine
Call twinken(locnam, trait, cenloc, censor, mztwin, gt, thresh, dataset, iter, mincnt, norder, plevel)
ModuleNone
Notes
 Oakes' Kendall tau for bivariate survival analysis 
 contrasting monozygotic twins v. other siblings.

twinkencon

Name of routine: twinkencon
Source lines: 108617 - 108680
Type subroutine
Call twinkencon(maxpairs, sta, fin, plist, pairs, trait, censor, dataset, nc, nd, tau, taunorm)
ModuleNone
Notes
 Estimate Kendall tau for one set of pairs stored pairs(sta+1, fin)

eigen

Name of routine: eigen
Source lines: 108684 - 108711
Type subroutine
Call eigen(typ, n, a, z)
ModuleNone
Notes
 Wrapper for EISPACK real symmetric matrix routines

kininv

Name of routine: kininv
Source lines: 108807 - 108880
Type subroutine
Call kininv(a, n, ainv, logdet, ifail, plevel)
ModuleNone
Notes
 Wrapper for syminv and geninv or memoized