diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f16120a --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*.o +bin/ +obj/ +sandbox/ diff --git a/README.md b/README.md index 85575e3..358c27c 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,46 @@ # switchError Compute switch error rates + +This code was written by Olivier Delaneau with build environment and documentation contributions from Arjun Biddanda. + +## Building the executable + +The environment to build the software can be conducted by `conda env create -f env.yaml`. You can then subsequently run `conda activate switchError` and `make`, which should build the executable for you in `bin/switchError`. + +## Input File Definitions + +* "--gen": BCF formatted file of genotyped individuals [required] +* "--hap": BCF formatted file of individuals with estimated haplotypes [required] +* "--fam": PLINK formatted FAM file for evaluating IDs +* "--reg": BED-formatted region string for evaluating switch error rates [required] +* "--ps": Phase set information (more information [here](http://mathgen.stats.ox.ac.uk/genetics_software/shapeit/shapeit.html#readaware)) +* "--out": output prefix, the outputfiles have extensions `*.iser`, `*.vser`,`*.mser.gz` [required] +* "--maf": minor allele frequency cutoff + +## Output File Definitions + +1. `*.iser` + +The columns in order are: + * individual index + * individual name + * number of mendel errors + * number of opportunities for mendel errors + * number of typing errors + * number of opportunities for typing errors + * number of switch errors + * number of opportunities for switch errors + +2. `*.vser` + * variant-level index + * position of variant + * minor allele count + * minor allele frequency + * number of mendel errors + * number of opportunities for mendel errors + * number of typing errors + * number of opportunities for typing errors + * number of switch errors + * number of opportunities for switch errors + +Across both settings, we largely want to look at how to use the last two columns and their distribution across individuals. diff --git a/bin/placeholder.txt b/bin/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/bin/swithError b/bin/swithError deleted file mode 100755 index a5387a7..0000000 Binary files a/bin/swithError and /dev/null differ diff --git a/env.yaml b/env.yaml new file mode 100644 index 0000000..c8e43b9 --- /dev/null +++ b/env.yaml @@ -0,0 +1,16 @@ +name: switchError +channels: + - conda-forge + - bioconda + - hcc +dependencies: + - gxx + - libstdcxx-ng + - boost=1.75.0 + - automake + - cmake + - htslib + - r-mathlib + - libzlib + - git + diff --git a/makefile b/makefile index 29aa8b7..9e40a71 100644 --- a/makefile +++ b/makefile @@ -1,12 +1,12 @@ ########################################## # SET CORRECTLY THESE 6 PATHS TO COMPILE # ########################################## -BOOST_INC= -BOOST_LIB= -RMATH_INC= -RMATH_LIB= -HTSLD_INC= -HTSLD_LIB= +BOOST_INC=$(CONDA_PREFIX)/include +BOOST_LIB=$(CONDA_PREFIX)/lib +RMATH_INC=$(CONDA_PREFIX)/include +RMATH_LIB=$(CONDA_PREFIX)/lib +HTSLD_INC=$(CONDA_PREFIX)/include +HTSLD_LIB=$(CONDA_PREFIX)/lib #COMPILER MODE C++11 CXX=g++ -std=c++0x @@ -17,46 +17,26 @@ CXXFLAG_DBG=-g CXXFLAG_WRN=-Wall -Wextra -Wno-sign-compare -Wno-unused-local-typedefs -Wno-deprecated -Wno-unused-parameter #BASE LIBRARIES -LIB_FLAGS=-lz -lbz2 -lm -lpthread -llzma +LIB_FLAGS=-lz -lbz2 -lm -lpthread -llzma #FILE LISTS -BFILE=bin/swithError +BFILE=bin/switchError HFILE=$(shell find src -name *.h) TFILE=$(shell find lib -name *.h) CFILE=$(shell find src -name *.cpp) OFILE=$(shell for file in `find src -name *.cpp`; do echo obj/$$(basename $$file .cpp).o; done) VPATH=$(shell for file in `find src -name *.cpp`; do echo $$(dirname $$file); done) -#DEFAULT VERSION (I.E. UNIGE DESKTOP RELEASE VERSION) +#DEFAULT VERSION all: desktop #UNIGE DESKTOP RELEASE VERSION -desktop: RMATH_INC=$(HOME)/Tools/R-3.5.1/src/include -desktop: RMATH_LIB=$(HOME)/Tools/R-3.5.1/src/nmath/standalone -desktop: HTSLD_INC=$(HOME)/Tools/htslib-1.9 -desktop: HTSLD_LIB=$(HOME)/Tools/htslib-1.9 -desktop: BOOST_INC=/usr/include -desktop: BOOST_LIB=/usr/lib/x86_64-linux-gnu desktop: CXXFLAG=$(CXXFLAG_REL) $(CXXFLAG_WRN) desktop: IFLAG=-Ilib/OTools -Ilib -I$(RMATH_INC) -I$(HTSLD_INC) -I$(BOOST_INC) -desktop: LIB_FILES=$(RMATH_LIB)/libRmath.a $(HTSLD_LIB)/libhts.a $(BOOST_LIB)/libboost_iostreams.a $(BOOST_LIB)/libboost_program_options.a +desktop: LIB_FILES=-L$(RMATH_LIB)/ -lRmath -lboost_iostreams -lboost_program_options -lhts desktop: LDFLAG=$(CXXFLAG_REL) desktop: $(BFILE) -#UNIL SERVER RELEASE VERSION -dcb2: LIB_FLAGS=-lz -lbz2 -lm -lpthread -lcurl -lcrypto -lssl -llzma -dcb2: RMATH_INC=/software/R/3.4.2/include -dcb2: RMATH_LIB=/software/R/3.4.2/lib64 -dcb2: HTSLD_INC=/home/oldelan/lib/htslib-1.7 -dcb2: HTSLD_LIB=/home/oldelan/lib/htslib-1.7 -dcb2: BOOST_INC=/software/include -dcb2: BOOST_LIB=/software/lib64 -dcb2: CXXFLAG=$(CXXFLAG_REL) -dcb2: IFLAG=-Ilib -Ilib/OTools -I$(HTSLD_INC) -I$(BOOST_INC) -I$(RMATH_INC) -dcb2: LIB_FILES=$(HTSLD_LIB)/libhts.a $(BOOST_LIB)/libboost_iostreams.a $(BOOST_LIB)/libboost_program_options.a -dcb2: LDFLAG=$(CXXFLAG_REL) -dcb2: $(BFILE) - #COMPILATION RULES $(BFILE): $(OFILE) diff --git a/obj/data_base.o b/obj/data_base.o deleted file mode 100644 index 58fcf78..0000000 Binary files a/obj/data_base.o and /dev/null differ diff --git a/obj/data_mendel.o b/obj/data_mendel.o deleted file mode 100644 index bd4e71f..0000000 Binary files a/obj/data_mendel.o and /dev/null differ diff --git a/obj/data_read.o b/obj/data_read.o deleted file mode 100644 index bacfa77..0000000 Binary files a/obj/data_read.o and /dev/null differ diff --git a/obj/data_switch.o b/obj/data_switch.o deleted file mode 100644 index 408b281..0000000 Binary files a/obj/data_switch.o and /dev/null differ diff --git a/obj/data_write.o b/obj/data_write.o deleted file mode 100644 index 68d0a19..0000000 Binary files a/obj/data_write.o and /dev/null differ diff --git a/obj/placeholder.txt b/obj/placeholder.txt new file mode 100644 index 0000000..e69de29 diff --git a/obj/switchError.o b/obj/switchError.o deleted file mode 100644 index 41372fa..0000000 Binary files a/obj/switchError.o and /dev/null differ diff --git a/src/data_read.cpp b/src/data_read.cpp index 12eb09c..7db989d 100644 --- a/src/data_read.cpp +++ b/src/data_read.cpp @@ -22,7 +22,7 @@ void data::readPedigrees(string fped) { switch (type) { case 2: n_tri ++; break; case 1: n_duo ++; break; - default: n_tri ++; break; + default: n_unr ++; break; } } }