Title: | Forensic Bayesian Networks |
---|---|
Description: | Open-source package for computing likelihood ratios in kinship testing and human identification cases (Chernomoretz et al. (2021) <doi:10.1016/j.fsir.2020.100132>). It has the core function of the software GENis, developed by FundaciĆ³n Sadosky. It relies on a Bayesian Networks framework and is particularly well suited to efficiently perform large-size queries against databases of missing individuals (Darwiche (2009) <doi:10.1017/CBO9780511811357>). |
Authors: | Franco Marsico [aut, cre], Ariel Chernomoretz [aut] |
Maintainer: | Franco Marsico <[email protected]> |
License: | GPL (>= 3) |
Version: | 1.0.2 |
Built: | 2025-02-18 05:26:29 UTC |
Source: | https://github.com/marsicofl/fbnet |
STRs allelic frequencies from Argentina.
Argentina_STRs
Argentina_STRs
A data frame with allele frequencies
Initialized bayesian network.
bnet
bnet
Initialized bayesian network, based on toyped.
buildBN: a function for building the bayesian network.
buildBN(pbn, QP)
buildBN(pbn, QP)
pbn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
QP |
Query Persons Ids |
A bayesian network based on pedigree evidence and QP definition.
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3)
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3)
buildCPTs: a function for building conditional probability tables based on pedigree bayesian network.
buildCPTs( bn, bNodePrunning = TRUE, bStateRemoval = TRUE, bStateRemoval2 = TRUE, lumpingParameter = NULL, renorm = "row-wise", verbose = FALSE )
buildCPTs( bn, bNodePrunning = TRUE, bStateRemoval = TRUE, bStateRemoval2 = TRUE, lumpingParameter = NULL, renorm = "row-wise", verbose = FALSE )
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
bNodePrunning |
Standard pruning. |
bStateRemoval |
State based pruning. |
bStateRemoval2 |
State based pruning (model 2). |
lumpingParameter |
Used for stepwise mutational model. |
renorm |
If "row-wise" is selected, zero probability is assigned for transitions out of range. |
verbose |
Computations output. |
A bayesian network based on pedigree evidence and QP definition.
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet)
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet)
convertPedformat: a function for converting a pedtools ped onject to a famlink ped object.
convertPedformat(x, verbose = FALSE)
convertPedformat(x, verbose = FALSE)
x |
A pedtools ped object. |
verbose |
Function output. |
A dataframe with LRs.
evidencePrunning: a fuction for pruning instantiated variables.
evidencePrunning(bn)
evidencePrunning(bn)
bn |
A bayesian network (output of buildBN function). |
A preprocessed bayesian network.
factorHeteroFounders: a function for multiplying probabilities in case of heterocigote founders.
factorHeteroFounders(rresQ, bn)
factorHeteroFounders(rresQ, bn)
rresQ |
List of CPTs. |
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
A dataframe with genotype probabilities.
FamiliasLocus: a function for reading Familias locus data.
FamiliasLocus( frequencies, allelenames, name, MutationModel = "Stepwise", MutationRate = 0, MutationRange = 0.5, MutationRate2 = 0, MutationMatrix, Stabilization = "None", MaxStabilizedMutrate = 1, femaleMutationModel, femaleMutationRate, femaleMutationRange, femaleMutationRate2, femaleMutationMatrix, maleMutationModel, maleMutationRate, maleMutationRange, maleMutationRate2, maleMutationMatrix )
FamiliasLocus( frequencies, allelenames, name, MutationModel = "Stepwise", MutationRate = 0, MutationRange = 0.5, MutationRate2 = 0, MutationMatrix, Stabilization = "None", MaxStabilizedMutrate = 1, femaleMutationModel, femaleMutationRate, femaleMutationRange, femaleMutationRate2, femaleMutationMatrix, maleMutationModel, maleMutationRate, maleMutationRange, maleMutationRate2, maleMutationMatrix )
frequencies |
allele frequencies |
allelenames |
names |
name |
system name |
MutationModel |
model |
MutationRate |
rates |
MutationRange |
range |
MutationRate2 |
rate two, applied for extended stepwise |
MutationMatrix |
matrix |
Stabilization |
stabilization factor |
MaxStabilizedMutrate |
mix factor |
femaleMutationModel |
for females |
femaleMutationRate |
rate |
femaleMutationRange |
range |
femaleMutationRate2 |
rate 2 |
femaleMutationMatrix |
females matrix |
maleMutationModel |
male matrix |
maleMutationRate |
male rate |
maleMutationRange |
male range |
maleMutationRate2 |
rate 2 |
maleMutationMatrix |
matrix |
Locus analysis.
frequencies <- c(0.1, 0.2, 0.3, 0.4) allelenames <- c("A", "B", "C", "D") marker <- FamiliasLocus(frequencies, allelenames)
frequencies <- c(0.1, 0.2, 0.3, 0.4) allelenames <- c("A", "B", "C", "D") marker <- FamiliasLocus(frequencies, allelenames)
FamiliasPedigree: a function for constructing Familias pedigree format.
FamiliasPedigree(id, dadid, momid, sex)
FamiliasPedigree(id, dadid, momid, sex)
id |
individual id |
dadid |
father id |
momid |
mother id |
sex |
biological sex |
A dataframe with probabilities.
persons <- c("mother", "child", "AF") sex <- c("female", "female", "male") ped1 <- FamiliasPedigree(id = persons, dadid = c(NA, "AF", NA),momid = c(NA, "mother", NA), sex=sex)
persons <- c("mother", "child", "AF") sex <- c("female", "female", "male") ped1 <- FamiliasPedigree(id = persons, dadid = c(NA, "AF", NA),momid = c(NA, "mother", NA), sex=sex)
'fbnet' is an open source software package written in R statistical languaje. It relies on a Bayesian Networks framework doi:10.1017/CBO9780511811357. It is particularly well suited to efficiently perform large-size queries against databases of missing individuals. It could interact with the main functionallities of other packages for pedigree analysis. In particular, 'fbnet' imports the 'Familias' software doi:10.1016/S0379-0738(00)00147-X. In addition 'pedtools', a software for creating and manipulating pedigrees and markers, is supported. 'fbnet' allows computing LRs and obtaining genotype probability distributions for query individual, based on the pedigree data. 'fbnet' implements the complete GENis functionality, a recently published open-source multi-tier information system developed to run forensic DNA databases to perform kinship analysis based on DNA profiles doi:10.1016/j.fsir.2020.100132.
getConditional: a function for obtaining the coditional probability tables based on a given evidence.
getConditional(lf)
getConditional(lf)
lf |
A list of joint probabilities. |
A list of conditioned probabilities.
getGenotypeTables: a function for obtaining genotypetables after variable elimination and using available genetic evidence.
getGenotypeTables(bn, resQ, geno = NULL, lqp = NULL)
getGenotypeTables(bn, resQ, geno = NULL, lqp = NULL)
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
resQ |
List of CPTs. |
geno |
data.frame with genotypes. |
lqp |
list of individuals genotypes. |
A dataframe with genotype probabilities.
getLocusCPT: a function for obtaining the coditional probability table from a specific locus.
getLocusCPT(bn, locus, lumpingParameter = NULL, renorm = "row-wise")
getLocusCPT(bn, locus, lumpingParameter = NULL, renorm = "row-wise")
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
locus |
Specified locus. |
lumpingParameter |
Used for stepwise mutational model. |
renorm |
If "row-wise" is selected, zero probability is assigned for transitions out of range. |
A bayesian network based on pedigree evidence and QP definition.
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet) locCPT <- getLocusCPT(bn1,"M1")
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet) locCPT <- getLocusCPT(bn1,"M1")
factorHeteroFounders: a function for multiplying probabilities in case of heterocigote founders.
getMAP(resQ, topn = 3)
getMAP(resQ, topn = 3)
resQ |
List of CPTs. |
topn |
Format parameter. |
A MAP from the probability table.
getGenotypeTables: a function for obtaining genotypetables after variable elimination and using available genetic evidence.
getQSetRMP(bn, lqp)
getQSetRMP(bn, lqp)
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
lqp |
list of individuals genotypes. |
A dataframe with genotype probabilities.
getValuesOut: a function for getting out variables with zero probability in the bayesian network
getValuesOut(cpt, condVar = c())
getValuesOut(cpt, condVar = c())
cpt |
conditional probability table from the bayesian network |
condVar |
variables from the conditioning table |
A processed conditional probability table
imposeEvidence: a fuction for imposing evidence in the bayesian network.
imposeEvidence(bn)
imposeEvidence(bn)
bn |
A bayesian network (output of buildBN function). |
A preprocessed bayesian network.
initBN: a function to initialize the bayesian network.
initBN(ped = NULL, bplotped = FALSE)
initBN(ped = NULL, bplotped = FALSE)
ped |
A ped object with information of the genotyped members. The ped object must be in Familias format. |
bplotped |
An alternative ped object to be compared. |
A bayesian network.
pbn <- initBN(toyped)
pbn <- initBN(toyped)
initBN.fromPed: a function to initialize the bayesian network.
initBN.fromPed(ped, bplotped)
initBN.fromPed(ped, bplotped)
ped |
A ped object in Familias format. |
bplotped |
An alternative ped object to be compared. |
A bayesian network.
initBN.fromVars: a function to initialize the bayesian network.
initBN.fromVars(bplotped)
initBN.fromVars(bplotped)
bplotped |
An alternative ped object to be compared. |
A bayesian network.
minOrdering: a function for getting an ordering of bayesian network variables not in Q using min fill criteria on interaction graphs.
minOrdering(bn, vars = NULL, method = c("min_degree", "min_fill")[1])
minOrdering(bn, vars = NULL, method = c("min_degree", "min_fill")[1])
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
vars |
Subset of tables where the order is calculated |
method |
Elimination method, min_degree or min_fill |
A bayesian network after ordering process.
Prepared pedigree for bayesian network trimming.
pbn
pbn
A data.matrix.
preparePed: a function for simulating genetic data from untyped individuals conditioned on known genotypes.
preparePed(ped, available, lLociFreq, rseed = NULL)
preparePed(ped, available, lLociFreq, rseed = NULL)
ped |
A ped object with information of the genotyped members. The ped object must be in Familias format. |
available |
Genotyped individuals IDs. |
lLociFreq |
Allele frequencies. |
rseed |
Seed used for simulations. |
A ped object.
prodFactor: a function for performing product between probability tables.
prodFactor(laux)
prodFactor(laux)
laux |
probability distribution aux |
A dataframe with probabilities.
pruneNodes: a fuction for clasical pruning in bayesian networks.
pruneNodes(bn)
pruneNodes(bn)
bn |
A bayesian network (output of buildBN function). |
A preprocessed bayesian network.
removeEvidenceFromPed: a function for removing evidence from specific individuals in a ped object.
removeEvidenceFromPed(pped, idNotEv)
removeEvidenceFromPed(pped, idNotEv)
pped |
A ped object with information of the genotyped members. The ped object must be in Familias format. |
idNotEv |
A set of individuals whom evidence should be removed. |
A ped object.
reportLR: a function for calculating the LRs of specified genotypes in a pedigree.
reportLR(bn, resQ, geno = NULL)
reportLR(bn, resQ, geno = NULL)
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
resQ |
List of CPTs. |
geno |
data.frame with genotypes. |
A dataframe with LRs.
reportPQ: a function for calculating the probability of specified genotypes in a pedigree.
reportPQ(bn, resQ, geno = NULL)
reportPQ(bn, resQ, geno = NULL)
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
resQ |
List of CPTs. |
geno |
data.frame with genotypes. |
A dataframe with genotype probabilities.
reverseSpit: a function for formatting.
reverseSplit(inList)
reverseSplit(inList)
inList |
input for formatting. |
A bayesian network.
setOrdering: a function for selecting the ordering method in the elimination process.
setOrdering(bn, ordMethod, vars = NULL, orderElim = NULL)
setOrdering(bn, ordMethod, vars = NULL, orderElim = NULL)
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
ordMethod |
Ordering method. |
vars |
Vars |
orderElim |
Order elimination criteria. |
A bayesian network after ordering process.
stateRemoval: a function for processing the bayesian network.
stateRemoval(bn)
stateRemoval(bn)
bn |
A bayesian network (output of buildBN function). |
A preprocessed bayesian network.
stateRemoval2: a function for processing the bayesian network. It implements another approach from the described in stateRemoval function.
stateRemoval2(bn, verbose = FALSE)
stateRemoval2(bn, verbose = FALSE)
bn |
A bayesian network (output of buildBN function). |
verbose |
Computation output. |
A preprocessed bayesian network.
stateRemovalSubnucs: a fuctiong for variable state pruning.
stateRemovalSubnucs(bn, verbose = FALSE)
stateRemovalSubnucs(bn, verbose = FALSE)
bn |
A bayesian network (output of buildBN function). |
verbose |
Computation output. |
A preprocessed bayesian network.
prodFactor: a function for performing sum between probability tables.
sumFactor(cpt, Z)
sumFactor(cpt, Z)
cpt |
Conditional probability table |
Z |
factor |
A dataframe with probabilities.
Toy allele frequency database.
toybase
toybase
A data frame two markers allele frequencies
STRs allelic frequencies from specified country.
toyped
toyped
A toy pedigree. Nuclear family.
velim.bn: a function for variable elimination in a bayesian network.
velim.bn( bn, ordMethod = c("id", "min_degree", "min_fill", "fixed")[2], orderElim = NULL, verbose = FALSE )
velim.bn( bn, ordMethod = c("id", "min_degree", "min_fill", "fixed")[2], orderElim = NULL, verbose = FALSE )
bn |
A bayesian network for pedigree object with information of the genotyped members. The ped object must be in Familias format. |
ordMethod |
Selected ordering method between id, min_degree, min_fill and fixed. |
orderElim |
Elimination order. |
verbose |
Computation output. |
Variable elimination result.
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet) resQ <- velim.bn(bn1,ordMethod="min_fill",verbose=FALSE)
pbn <- initBN(toyped) bnet <- buildBN(pbn,QP=3) bn1 <- buildCPTs(bnet) resQ <- velim.bn(bn1,ordMethod="min_fill",verbose=FALSE)