Documentation ¶
Index ¶
- func CMultMatColTimesColToCol(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, ...) crypto.CipherMatrix
- func CMultMatColTimesRowToCol(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, ...) crypto.CipherMatrix
- func CMultMatInnerProd(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, numThreads int) crypto.CipherMatrix
- func CMultMatInnerProdVector(cryptoParams *crypto.CryptoParams, M crypto.CipherMatrix, ...) crypto.CipherVector
- func CPMatMult0(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
- func CPMatMult1(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
- func CPMatMult2(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
- func CPMatMult2F(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
- func CPMatMult3(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
- func CPMatMult4(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense, ...) crypto.CipherMatrix
- func CPMatMult4CachedB(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, ...) crypto.CipherMatrix
- func CPMatMult4V2CachedB(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, ...) crypto.CipherMatrix
- func CPMatMult4V2CachedBParallel(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, ...) crypto.CipherMatrix
- func CPMultAccWithoutMRedV1(cryptoParams *crypto.CryptoParams, X crypto.CipherVector, Y crypto.PlainVector, ...)
- func CPMultAccWithoutMRedV2(X crypto.CipherVector, Y crypto.PlainVector, Acc CipherVectorAccV2)
- func DCMatMulAAtB(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, ...) crypto.CipherMatrix
- func DCMatMulAAtBPlain(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, ...) crypto.CipherMatrix
- func EncodeDiag(cryptoParams *crypto.CryptoParams, X BlockVector, index int, nrot int, ...) (crypto.PlainVector, bool)
- func EncodeDiagBool(X BlockVector, index int, slots int) bool
- func EncodeDiagWithEncoder(cryptoParams *crypto.CryptoParams, X BlockVector, index int, nrot int, ...) (crypto.PlainVector, bool)
- func FilterMat(X *mat.Dense, colkeep, rowkeep []bool) *mat.Dense
- func FilterMatrixFile(inputFile string, nrows, ncols int, rowFilt, colFilt []bool, outputFile string)
- func FilterMatrixFilePgen(pgenPrefix string, nrows, ncols int, rowFiltFile, colNamesFile string, ...)
- func FilterVec(vec *mat.Dense, keep []bool) *mat.Dense
- func GetDiag(dst []float64, X Block, dim int, index int) bool
- func GetDiagBool(X Block, dim int, index int) bool
- func LoadCacheFromFile(cps *crypto.CryptoParams, filename string) crypto.CipherMatrix
- func LoadFloatVectorFromFile(filename string, n int) []float64
- func LoadMatrixFromFile(filename string, delim rune) *mat.Dense
- func LoadMatrixFromFileFloat(filename string, delim rune) [][]float64
- func LoadSNPPositionFile(filename string, delim rune) []uint64
- func MForm(a, q uint64, u []uint64) (r uint64)
- func MFormLvl(r *ring.Ring, level int, p1, p2 *ring.Poly)
- func MatMult4Stream(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, gfs *GenoFileStream, ...) (crypto.CipherMatrix, []float64, []float64)
- func MatMult4StreamCompute(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, ...) crypto.CipherMatrix
- func MatMult4StreamPreprocess(cryptoParams *crypto.CryptoParams, gfs *GenoFileStream, maxLevel int, ...)
- func Max(x, y int) int
- func MergeBlockFiles(inputBlockFilePrefix string, nrows int, ncolsPerBlock []int, outputFile string)
- func Min(a int, b int) int
- func Mod(n int, modulus int) int
- func ModularReduceV1(cryptoParams *crypto.CryptoParams, cva CipherVectorAccV1, outScale float64) crypto.CipherVector
- func ModularReduceV2(cryptoParams *crypto.CryptoParams, cva CipherVectorAccV2, outScale float64) crypto.CipherVector
- func MulCoeffsAndAdd128(a, b []uint64, c []uint128)
- func NetDQRenc(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, ...) crypto.CipherMatrix
- func NetDQRplain(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.PlainMatrix, ...) crypto.CipherMatrix
- func Ones(n int) []int
- func OnesBool(n int) []bool
- func QXLazyNormStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, Q crypto.CipherMatrix, ...) (out crypto.CipherMatrix)
- func QXtLazyNormStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, Q crypto.CipherMatrix, ...) (out crypto.CipherMatrix)
- func ReadGenoStatsFromFile(filename string, m int) (ac, gc [][]uint32, miss []uint32)
- func ReduceAndAddUint128(in []uint128, out []uint64, qInv, q uint64)
- func SaveFloatMatrixToFile(filename string, x [][]float64)
- func SaveFloatVectorToFile(filename string, x []float64)
- func SaveIntVectorToFile(filename string, x []int)
- func SaveMatrixToFile(cps *crypto.CryptoParams, mpcObj *mpc.MPC, cm crypto.CipherMatrix, ...)
- func Sum(a []int) int
- func SumBool(a []bool) int
- func ToMontgomeryForm(cryptoParams *crypto.CryptoParams, pt crypto.PlainVector)
- func TransposeMatrixFile(inputFile string, nrows, ncols int, outputFile string)
- type AssocTest
- func (ast *AssocTest) GenoBlockMult(b int, mat crypto.CipherMatrix, square bool) (matOut crypto.CipherMatrix, dosageSum, dosageSqSum []float64, filtOut []bool)
- func (ast *AssocTest) GetAssociationStats() (crypto.CipherVector, []bool)
- func (ast *AssocTest) LrNewtonBasedCovOnly(C crypto.CipherMatrix, y []float64, iter int, numThreads int, numInds []int, ...) crypto.CipherVector
- type Block
- type BlockF64
- type BlockI8
- type BlockMatrix
- type BlockVector
- type CipherAccV1
- type CipherAccV2
- type CipherVectorAccV1
- type CipherVectorAccV2
- type Config
- type DiagCacheStream
- func (dcs *DiagCacheStream) Close()
- func (dcs *DiagCacheStream) GetIndexTables() ([]bool, []bool)
- func (dcs *DiagCacheStream) ReadDiag() (pv crypto.PlainVector, shift int)
- func (dcs *DiagCacheStream) ResetRead()
- func (dcs *DiagCacheStream) SetIndexTables(babyTable, giantTable []bool)
- func (dcs *DiagCacheStream) WriteDiag(pv crypto.PlainVector, shift uint32)
- type FilterParams
- type GWASParams
- func (gwasParams *GWASParams) FiltNumInds() []int
- func (gwasParams *GWASParams) FiltNumSNP() int
- func (gwasParams *GWASParams) GetPopStratMethod() bool
- func (gwasParams *GWASParams) MinSnpDistThreshold() uint64
- func (gwasParams *GWASParams) NumCov() int
- func (gwasParams *GWASParams) NumInds() []int
- func (gwasParams *GWASParams) NumPC() int
- func (gwasParams *GWASParams) NumSNP() int
- func (gwasParams *GWASParams) SetFiltCounts(filtInds []int, filtSnps int)
- func (gwasParams *GWASParams) SetNumPC(numPCs int)
- func (gwasParams *GWASParams) SetNumSnpsPCA(numSnps int)
- func (gwasParams *GWASParams) SetPopStratMethod(s bool)
- func (gwasParams *GWASParams) SetSnpFilt(filt []bool)
- func (gwasParams *GWASParams) SnpFilt() []bool
- type GenoFileStream
- func (gfs *GenoFileStream) CheckEOF() bool
- func (gfs *GenoFileStream) ColFilt() []bool
- func (gfs *GenoFileStream) LineCount() uint64
- func (gfs *GenoFileStream) NextRow() []int8
- func (gfs *GenoFileStream) NumCols() uint64
- func (gfs *GenoFileStream) NumColsToKeep() uint64
- func (gfs *GenoFileStream) NumRows() uint64
- func (gfs *GenoFileStream) NumRowsToKeep() uint64
- func (gfs *GenoFileStream) Reset()
- func (gfs *GenoFileStream) RowFilt() []bool
- func (gfs *GenoFileStream) UpdateColFilt(a []bool) int
- func (gfs *GenoFileStream) UpdateRowFilt(a []bool) int
- type PCA
- type PlainMatrixDiagCache
- type ProtocolInfo
- func (g *ProtocolInfo) CZeroTest()
- func (g *ProtocolInfo) CachePath(filename string) string
- func (g *ProtocolInfo) ComputeAssocStatistics(Qpca crypto.CipherMatrix) (crypto.CipherVector, []bool)
- func (g *ProtocolInfo) ConversionTest()
- func (g *ProtocolInfo) GWAS()
- func (g *ProtocolInfo) GeneratePCAInput(numSnpsPCA int, snpFiltPCA []bool, isPgen bool) (*GenoFileStream, *GenoFileStream)
- func (prot *ProtocolInfo) GetConfig() *Config
- func (prot *ProtocolInfo) GetCryptoParams() *crypto.CryptoParams
- func (prot *ProtocolInfo) GetGenoBlocks() []*GenoFileStream
- func (prot *ProtocolInfo) GetGwasParams() *GWASParams
- func (prot *ProtocolInfo) GetMpc() mpc.ParallelMPC
- func (g *ProtocolInfo) InitAssociationTests(Qpc crypto.CipherMatrix) *AssocTest
- func (g *ProtocolInfo) InitPCA(genoRed, genoRedT *GenoFileStream) *PCA
- func (g *ProtocolInfo) InitQC(filterParams *FilterParams) QC
- func (prot *ProtocolInfo) IsBlockForAssocTest(blockId int) bool
- func (prot *ProtocolInfo) IsPgen() bool
- func (g *ProtocolInfo) OutPath(filename string) string
- func (g *ProtocolInfo) Phase1()
- func (g *ProtocolInfo) Phase2() crypto.CipherMatrix
- func (g *ProtocolInfo) Phase3(Qpca crypto.CipherMatrix)
- func (g *ProtocolInfo) PopulationStratification() crypto.CipherMatrix
- func (g *ProtocolInfo) SyncAndTerminate(closeChannelFlag bool)
- func (g *ProtocolInfo) Test()
- type QC
- func (qc *QC) IndividualMissAndHetFilters() []bool
- func (qc *QC) QualityControlProtocol(useCache bool)
- func (qc *QC) QualityControlProtocolWithPrecomputedGenoStats(useCache bool)
- func (qc *QC) SNPFilterWithPrecomputedStats(ac, gc [][]uint32, miss []uint32, useCache bool) []bool
- func (qc *QC) SNPMAFAndHWEFilters() []bool
- func (qc *QC) SNPMissFilter() []bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CMultMatColTimesColToCol ¶
func CMultMatColTimesColToCol(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, numRowsM, numThreads int) crypto.CipherMatrix
Matrix multiplication between column encrypted matrices
func CMultMatColTimesRowToCol ¶
func CMultMatColTimesRowToCol(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, numRowsM, numColsN, numThreads int) crypto.CipherMatrix
Matrix multiplication between column and row encrypted matrices
func CMultMatInnerProd ¶
func CMultMatInnerProd(cryptoParams *crypto.CryptoParams, M, N crypto.CipherMatrix, numThreads int) crypto.CipherMatrix
Basic matrix multiplication using inner products
func CMultMatInnerProdVector ¶
func CMultMatInnerProdVector(cryptoParams *crypto.CryptoParams, M crypto.CipherMatrix, N crypto.CipherVector, MCols, numThreads int) crypto.CipherVector
Matrix multiplication using inner products, with the result being a vector
func CPMatMult0 ¶
func CPMatMult0(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
Cheat to compute ground truth
func CPMatMult1 ¶
func CPMatMult1(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
All-pairwise inner product version
func CPMatMult2 ¶
func CPMatMult2(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
Duplicate individual elements in A
func CPMatMult2F ¶
func CPMatMult2F(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
Duplicate individual elements in A
func CPMatMult3 ¶
func CPMatMult3(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense) crypto.CipherMatrix
Pre-rotate A, all shifts, mult with diagonals from B
func CPMatMult4 ¶
func CPMatMult4(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, B *mat.Dense, maxLevel int) crypto.CipherMatrix
Pre-rotate A, baby step giant step version, mult with diagonals from B
func CPMatMult4CachedB ¶
func CPMatMult4CachedB(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, CachedB PlainMatrixDiagCache) crypto.CipherMatrix
func CPMatMult4V2CachedB ¶
func CPMatMult4V2CachedB(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, CachedB PlainMatrixDiagCache) crypto.CipherMatrix
Generalized to levels >= 2
func CPMatMult4V2CachedBParallel ¶
func CPMatMult4V2CachedBParallel(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, CachedB PlainMatrixDiagCache) crypto.CipherMatrix
Parallelized version of `CPMatMult4V2CachedB`
func CPMultAccWithoutMRedV1 ¶
func CPMultAccWithoutMRedV1(cryptoParams *crypto.CryptoParams, X crypto.CipherVector, Y crypto.PlainVector, Acc CipherVectorAccV1)
Multiply X and Y to add to Acc without modular reduction
func CPMultAccWithoutMRedV2 ¶
func CPMultAccWithoutMRedV2(X crypto.CipherVector, Y crypto.PlainVector, Acc CipherVectorAccV2)
func DCMatMulAAtB ¶
func DCMatMulAAtB(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, B crypto.CipherMatrix, nrows []int, ncol_out int, innerFn matmulInnerFn) crypto.CipherMatrix
func DCMatMulAAtBPlain ¶
func DCMatMulAAtBPlain(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, B crypto.PlainMatrix, nrows []int, ncol_out int, innerFn matmulPlainInnerFn) crypto.CipherMatrix
func EncodeDiag ¶
func EncodeDiag(cryptoParams *crypto.CryptoParams, X BlockVector, index int, nrot int, level int) (crypto.PlainVector, bool)
index specifies which diagonal to extract applies right-rotation by nrot positions before encoding
func EncodeDiagBool ¶
func EncodeDiagBool(X BlockVector, index int, slots int) bool
Return if a diagonal vector exists without extracting/encoding the vectors
func EncodeDiagWithEncoder ¶
func EncodeDiagWithEncoder(cryptoParams *crypto.CryptoParams, X BlockVector, index int, nrot int, level int, enc ckks.Encoder) (crypto.PlainVector, bool)
func FilterMatrixFile ¶
func FilterMatrixFilePgen ¶
func GetDiag ¶
index 0 is the main diagonal max size of Block is dim by dim and index ranges from 0 to dim-1 (mod dim) If given diagonal does not overlap with X (matrix might be smaller), returns false
func GetDiagBool ¶
Return if a diagonal vector exists without extracting elements
func LoadCacheFromFile ¶
func LoadCacheFromFile(cps *crypto.CryptoParams, filename string) crypto.CipherMatrix
func LoadFloatVectorFromFile ¶
func LoadMatrixFromFileFloat ¶
func LoadSNPPositionFile ¶
func MatMult4Stream ¶
func MatMult4Stream(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, gfs *GenoFileStream, maxLevel int, computeSquaredSum, square bool, nproc int) (crypto.CipherMatrix, []float64, []float64)
func MatMult4StreamCompute ¶
func MatMult4StreamCompute(cryptoParams *crypto.CryptoParams, A crypto.CipherMatrix, maxLevel int, cacheFilePrefix string) crypto.CipherMatrix
func MatMult4StreamPreprocess ¶
func MatMult4StreamPreprocess(cryptoParams *crypto.CryptoParams, gfs *GenoFileStream, maxLevel int, cacheFilePrefix string)
func MergeBlockFiles ¶
func ModularReduceV1 ¶
func ModularReduceV1(cryptoParams *crypto.CryptoParams, cva CipherVectorAccV1, outScale float64) crypto.CipherVector
func ModularReduceV2 ¶
func ModularReduceV2(cryptoParams *crypto.CryptoParams, cva CipherVectorAccV2, outScale float64) crypto.CipherVector
func MulCoeffsAndAdd128 ¶
func MulCoeffsAndAdd128(a, b []uint64, c []uint128)
func NetDQRenc ¶
func NetDQRenc(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.CipherMatrix, nrowsAll []int) crypto.CipherMatrix
Since required precision scales with 1/sqrt(n) maintain sqrt(n)*v for unit vectors v
func NetDQRplain ¶
func NetDQRplain(cryptoParams *crypto.CryptoParams, mpcObj *mpc.MPC, A crypto.PlainMatrix, nrowsAll []int) crypto.CipherMatrix
NetDQRplain returns Q all zeros (or nil) (for pid=0), else returns share of Q for each party
func QXLazyNormStream ¶
func QXLazyNormStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, Q crypto.CipherMatrix, Xcachefile string, XMean, XStdInv crypto.CipherVector, numInd int) (out crypto.CipherMatrix)
Multiply Q (kp by nsnp) with X (nsnp by nind) with lazy normalization of X Compute Q * S * (X - m * 1^T) as (Q * S) * X - ((Q * S) * m) * 1^T S: diagonal matrix containing 1/stdev of each SNP, m: column vector containing mean of each SNP
func QXtLazyNormStream ¶
func QXtLazyNormStream(cps *crypto.CryptoParams, mpcObj *mpc.MPC, Q crypto.CipherMatrix, XTcachefile string, XMean, XStdInv crypto.CipherVector) (out crypto.CipherMatrix)
Multiply Q (kp by nind) with X^T (nind by nsnp) with lazy normalization of X Compute Q * (X^T - 1 * m^T) * S as ((Q * X^T) - ((Q * 1) * m^T)) * S S: diagonal matrix containing 1/stdev of each SNP, m: column vector containing mean of each SNP TODO: multiply with S AFTER aggregation across parties, that way bootstrap once for all
func ReadGenoStatsFromFile ¶
Reads in a binary file containing 6 vectors of length m (# of SNPs): ref allele count (AC), alt AC, hom-ref genotype count (GC), het GC, hom-alt GC, missing sample count. Each value is encoded as uint32 in little endian format
func ReduceAndAddUint128 ¶
func SaveFloatMatrixToFile ¶
func SaveFloatVectorToFile ¶
func SaveIntVectorToFile ¶
func SaveMatrixToFile ¶
func SaveMatrixToFile(cps *crypto.CryptoParams, mpcObj *mpc.MPC, cm crypto.CipherMatrix, nElemCol int, sourcePid int, filename string)
func ToMontgomeryForm ¶
func ToMontgomeryForm(cryptoParams *crypto.CryptoParams, pt crypto.PlainVector)
func TransposeMatrixFile ¶
Types ¶
type AssocTest ¶
type AssocTest struct { Qpc crypto.CipherMatrix MafLowerBound float64 MafUpperBound float64 // contains filtered or unexported fields }
func (*AssocTest) GenoBlockMult ¶
func (ast *AssocTest) GenoBlockMult(b int, mat crypto.CipherMatrix, square bool) (matOut crypto.CipherMatrix, dosageSum, dosageSqSum []float64, filtOut []bool)
Multiplies an encrypted matrix with a block of genotypes, optionally squares the result (square = true)
func (*AssocTest) GetAssociationStats ¶
func (ast *AssocTest) GetAssociationStats() (crypto.CipherVector, []bool)
func (*AssocTest) LrNewtonBasedCovOnly ¶
func (ast *AssocTest) LrNewtonBasedCovOnly(C crypto.CipherMatrix, y []float64, iter int, numThreads int, numInds []int, approx crypto.IntervalApprox, initWeight float64) crypto.CipherVector
type BlockMatrix ¶
type BlockMatrix []BlockVector
func ToBlockMatrix ¶
func ToBlockMatrix(A *mat.Dense, d int) BlockMatrix
type BlockVector ¶
type BlockVector []Block
type CipherAccV1 ¶
type CipherAccV1 struct {
// contains filtered or unexported fields
}
type CipherAccV2 ¶
type CipherAccV2 struct {
// contains filtered or unexported fields
}
type CipherVectorAccV1 ¶
type CipherVectorAccV1 []CipherAccV1
func NewCipherVectorAccV1 ¶
func NewCipherVectorAccV1(cryptoParams *crypto.CryptoParams, n int) CipherVectorAccV1
type CipherVectorAccV2 ¶
type CipherVectorAccV2 struct {
// contains filtered or unexported fields
}
func NewCipherVectorAccV2 ¶
func NewCipherVectorAccV2(cryptoParams *crypto.CryptoParams, n int, level int) CipherVectorAccV2
type Config ¶
type Config struct { NumMainParties int `toml:"num_main_parties"` HubPartyId int `toml:"hub_party_id"` CkksParams string `toml:"ckks_params"` DivSqrtMaxLen int `toml:"div_sqrt_max_len"` NumInds []int `toml:"num_inds"` NumSnps int `toml:"num_snps"` NumCovs int `toml:"num_covs"` CovAllOnes bool `toml:"cov_all_ones"` ItersPerEval int `toml:"iter_per_eigenval"` NumPCs int `toml:"num_pcs_to_remove"` NumOversample int `toml:"num_oversampling"` NumPowerIters int `toml:"num_power_iters"` SkipQC bool `toml:"skip_qc"` SkipPCA bool `toml:"skip_pca"` UseCachedQC bool `toml:"use_cached_qc"` UseCachedPCA bool `toml:"use_cached_pca"` UseCachedCombinedQ bool `toml:"use_cached_combined_q"` SkipPowerIter bool `toml:"skip_power_iter"` PCARestartIter int `toml:"restart_pca_from_iter"` IndMissUB float64 `toml:"imiss_ub"` HetLB float64 `toml:"het_lb"` HetUB float64 `toml:"het_ub"` SnpMissUB float64 `toml:"gmiss"` MafLB float64 `toml:"maf_lb"` HweUB float64 `toml:"hwe_ub"` SnpDistThres int `toml:"snp_dist_thres"` BindingIP string `toml:"binding_ipaddr"` Servers map[string]mpc.Server GenoFileFormat string `toml:"geno_file_format"` // 'blocks' or 'pgen' GenoFilePrefix string `toml:"geno_binary_file_prefix"` // If 'pgen' expects a '%d' placeholder for chrom, e.g. "ukb_imp_chr%d_v3" (.pgen/.psam/.pvar) GenoNumBlocks int `toml:"geno_num_blocks"` GenoBlockSizeFile string `toml:"geno_block_size_file"` PhenoFile string `toml:"pheno_file"` CovFile string `toml:"covar_file"` SnpPosFile string `toml:"snp_position_file"` UsePrecomputedGenoCount bool `toml:"use_precomputed_geno_count"` GenoCountFile string `toml:"geno_count_file"` SampleKeepFile string `toml:"sample_keep_file"` SnpIdsFile string `toml:"snp_ids_file"` OutDir string `toml:"output_dir"` CacheDir string `toml:"cache_dir"` MpcFieldSize int `toml:"mpc_field_size"` MpcDataBits int `toml:"mpc_data_bits"` MpcFracBits int `toml:"mpc_frac_bits"` MpcNumThreads int `toml:"mpc_num_threads"` LocalNumThreads int `toml:"local_num_threads"` LocalAssocNumBlocksParallel int `toml:"assoc_num_blocks_parallel"` MemoryLimit uint64 `toml:"memory_limit"` // Logistic regression specific UseLogistic bool `toml:"use_logistic"` InverseMatScale float64 `toml:"inverse_mat_scale"` A float64 `toml:"A"` B float64 `toml:"B"` Degree int `toml:"degree"` Epochs int `toml:"epochs"` Debug bool `toml:"debug"` BlocksForAssoc []int `toml:"blocks_for_assoc_test"` PgenBatchSize int `toml:"pgen_batch_nsnp"` }
type DiagCacheStream ¶
type DiagCacheStream struct {
// contains filtered or unexported fields
}
func NewDiagCacheStream ¶
func NewDiagCacheStream(cryptoParams *crypto.CryptoParams, filePrefix string, blockRowIndex int, isWrite bool) (*DiagCacheStream, bool)
Second output is a flag indicating whether write is attempted when the file already exists
func (*DiagCacheStream) Close ¶
func (dcs *DiagCacheStream) Close()
func (*DiagCacheStream) GetIndexTables ¶
func (dcs *DiagCacheStream) GetIndexTables() ([]bool, []bool)
func (*DiagCacheStream) ReadDiag ¶
func (dcs *DiagCacheStream) ReadDiag() (pv crypto.PlainVector, shift int)
func (*DiagCacheStream) ResetRead ¶
func (dcs *DiagCacheStream) ResetRead()
func (*DiagCacheStream) SetIndexTables ¶
func (dcs *DiagCacheStream) SetIndexTables(babyTable, giantTable []bool)
func (*DiagCacheStream) WriteDiag ¶
func (dcs *DiagCacheStream) WriteDiag(pv crypto.PlainVector, shift uint32)
type FilterParams ¶
type FilterParams struct { MafLowerBound float64 HweUpperBound float64 GenoMissBound float64 IndMissBound float64 HetLowerBound float64 HetUpperBound float64 }
func InitFilteringSettings ¶
func InitFilteringSettings(maflb, hwe, gmiss, imiss, hetlb, hetub float64) *FilterParams
type GWASParams ¶
type GWASParams struct {
// contains filtered or unexported fields
}
func InitGWASParams ¶
func InitGWASParams(numInds []int, numSnps, numCovs, numPCs, minSnpDist int) *GWASParams
func (*GWASParams) FiltNumInds ¶
func (gwasParams *GWASParams) FiltNumInds() []int
func (*GWASParams) FiltNumSNP ¶
func (gwasParams *GWASParams) FiltNumSNP() int
func (*GWASParams) GetPopStratMethod ¶
func (gwasParams *GWASParams) GetPopStratMethod() bool
func (*GWASParams) MinSnpDistThreshold ¶
func (gwasParams *GWASParams) MinSnpDistThreshold() uint64
func (*GWASParams) NumCov ¶
func (gwasParams *GWASParams) NumCov() int
func (*GWASParams) NumInds ¶
func (gwasParams *GWASParams) NumInds() []int
func (*GWASParams) NumPC ¶
func (gwasParams *GWASParams) NumPC() int
func (*GWASParams) NumSNP ¶
func (gwasParams *GWASParams) NumSNP() int
func (*GWASParams) SetFiltCounts ¶
func (gwasParams *GWASParams) SetFiltCounts(filtInds []int, filtSnps int)
func (*GWASParams) SetNumPC ¶
func (gwasParams *GWASParams) SetNumPC(numPCs int)
func (*GWASParams) SetNumSnpsPCA ¶
func (gwasParams *GWASParams) SetNumSnpsPCA(numSnps int)
func (*GWASParams) SetPopStratMethod ¶
func (gwasParams *GWASParams) SetPopStratMethod(s bool)
func (*GWASParams) SetSnpFilt ¶
func (gwasParams *GWASParams) SetSnpFilt(filt []bool)
func (*GWASParams) SnpFilt ¶
func (gwasParams *GWASParams) SnpFilt() []bool
type GenoFileStream ¶
type GenoFileStream struct {
// contains filtered or unexported fields
}
func NewGenoFileStream ¶
func NewGenoFileStream(filename string, numRow, numCol uint64, replaceMissing bool) *GenoFileStream
func (*GenoFileStream) CheckEOF ¶
func (gfs *GenoFileStream) CheckEOF() bool
func (*GenoFileStream) ColFilt ¶
func (gfs *GenoFileStream) ColFilt() []bool
func (*GenoFileStream) LineCount ¶
func (gfs *GenoFileStream) LineCount() uint64
func (*GenoFileStream) NextRow ¶
func (gfs *GenoFileStream) NextRow() []int8
func (*GenoFileStream) NumCols ¶
func (gfs *GenoFileStream) NumCols() uint64
func (*GenoFileStream) NumColsToKeep ¶
func (gfs *GenoFileStream) NumColsToKeep() uint64
func (*GenoFileStream) NumRows ¶
func (gfs *GenoFileStream) NumRows() uint64
func (*GenoFileStream) NumRowsToKeep ¶
func (gfs *GenoFileStream) NumRowsToKeep() uint64
func (*GenoFileStream) Reset ¶
func (gfs *GenoFileStream) Reset()
func (*GenoFileStream) RowFilt ¶
func (gfs *GenoFileStream) RowFilt() []bool
func (*GenoFileStream) UpdateColFilt ¶
func (gfs *GenoFileStream) UpdateColFilt(a []bool) int
func (*GenoFileStream) UpdateRowFilt ¶
func (gfs *GenoFileStream) UpdateRowFilt(a []bool) int
type PCA ¶
type PCA struct { Q crypto.CipherMatrix // contains filtered or unexported fields }
func (*PCA) DistributedPCA ¶
func (pca *PCA) DistributedPCA() crypto.CipherMatrix
type PlainMatrixDiagCache ¶
type PlainMatrixDiagCache [][]crypto.PlainVector
Cache structure for MatMult4 First index corresponds to row index of blocks of size slots-by-slots Second index of indexMap corresponds to index of diagonals (0..slots-1), The table maps a diag index to the encoded PlainVector If a given index has empty data, stored element is nil
func MatMult4TransformB ¶
func MatMult4TransformB(cryptoParams *crypto.CryptoParams, B *mat.Dense) PlainMatrixDiagCache
func MatMult4TransformBandedB ¶
func MatMult4TransformBandedB(cryptoParams *crypto.CryptoParams, B *mat.Dense, upperBandwidth, lowerBandwidth int) PlainMatrixDiagCache
Caches a banded matrix B with specified upper and lower bandwidth. Assumes that B is at most a (slots x slots) matrix, for `slots` the number of slots in a ciphertext.
type ProtocolInfo ¶
type ProtocolInfo struct {
// contains filtered or unexported fields
}
func InitializeGWASProtocol ¶
func InitializeGWASProtocol(config *Config, pid int, mpcOnly bool) (gwasProt *ProtocolInfo)
func (*ProtocolInfo) CZeroTest ¶
func (g *ProtocolInfo) CZeroTest()
func (*ProtocolInfo) CachePath ¶
func (g *ProtocolInfo) CachePath(filename string) string
func (*ProtocolInfo) ComputeAssocStatistics ¶
func (g *ProtocolInfo) ComputeAssocStatistics(Qpca crypto.CipherMatrix) (crypto.CipherVector, []bool)
func (*ProtocolInfo) ConversionTest ¶
func (g *ProtocolInfo) ConversionTest()
func (*ProtocolInfo) GWAS ¶
func (g *ProtocolInfo) GWAS()
func (*ProtocolInfo) GeneratePCAInput ¶
func (g *ProtocolInfo) GeneratePCAInput(numSnpsPCA int, snpFiltPCA []bool, isPgen bool) (*GenoFileStream, *GenoFileStream)
func (*ProtocolInfo) GetConfig ¶
func (prot *ProtocolInfo) GetConfig() *Config
func (*ProtocolInfo) GetCryptoParams ¶
func (prot *ProtocolInfo) GetCryptoParams() *crypto.CryptoParams
func (*ProtocolInfo) GetGenoBlocks ¶
func (prot *ProtocolInfo) GetGenoBlocks() []*GenoFileStream
func (*ProtocolInfo) GetGwasParams ¶
func (prot *ProtocolInfo) GetGwasParams() *GWASParams
func (*ProtocolInfo) GetMpc ¶
func (prot *ProtocolInfo) GetMpc() mpc.ParallelMPC
func (*ProtocolInfo) InitAssociationTests ¶
func (g *ProtocolInfo) InitAssociationTests(Qpc crypto.CipherMatrix) *AssocTest
func (*ProtocolInfo) InitPCA ¶
func (g *ProtocolInfo) InitPCA(genoRed, genoRedT *GenoFileStream) *PCA
func (*ProtocolInfo) InitQC ¶
func (g *ProtocolInfo) InitQC(filterParams *FilterParams) QC
func (*ProtocolInfo) IsBlockForAssocTest ¶
func (prot *ProtocolInfo) IsBlockForAssocTest(blockId int) bool
func (*ProtocolInfo) IsPgen ¶
func (prot *ProtocolInfo) IsPgen() bool
func (*ProtocolInfo) OutPath ¶
func (g *ProtocolInfo) OutPath(filename string) string
func (*ProtocolInfo) Phase1 ¶
func (g *ProtocolInfo) Phase1()
func (*ProtocolInfo) Phase2 ¶
func (g *ProtocolInfo) Phase2() crypto.CipherMatrix
func (*ProtocolInfo) Phase3 ¶
func (g *ProtocolInfo) Phase3(Qpca crypto.CipherMatrix)
func (*ProtocolInfo) PopulationStratification ¶
func (g *ProtocolInfo) PopulationStratification() crypto.CipherMatrix
func (*ProtocolInfo) SyncAndTerminate ¶
func (g *ProtocolInfo) SyncAndTerminate(closeChannelFlag bool)
func (*ProtocolInfo) Test ¶
func (g *ProtocolInfo) Test()
type QC ¶
type QC struct {
// contains filtered or unexported fields
}
func (*QC) IndividualMissAndHetFilters ¶
IndividualMissAndHetFilters filters individuals based on missing rate and heterozygosity filter
func (*QC) QualityControlProtocol ¶
QualityControlProtocol (1) applies SNP filters and individual filters to input data, (2) filters input wrt filters
func (*QC) QualityControlProtocolWithPrecomputedGenoStats ¶
func (*QC) SNPFilterWithPrecomputedStats ¶
ac: allele counts (0, 1) gc: genotype counts (0, 1, 2) miss: missing value counts