| Title: | Permutation Randomization |
|---|---|
| Description: | The package provides randomization using permutation for applications. To provide a Quality Control check, QC samples can be randomized within strata. A second function allows for the ability to ”switch” samples to meet set requirements and perform a certain amount of minimization on these switches. The functions are flexible for users by specifying strata size and number of QC samples per strata. The randomization meets the following requirements • QC sample requirements: QC samples not adjacent, QC samples from same mother must follow certain patterns. • Matched sample sets must be within a single strata, and next to each other. |
| Authors: | Michelle Mellers [aut, cre], Thaddeus Haight [aut] |
| Maintainer: | Michelle Mellers <[email protected]> |
| License: | use_gpl3_license() |
| Version: | 1.0.0 |
| Built: | 2026-06-01 11:23:29 UTC |
| Source: | https://github.com/m-mellers/permrand |
Randomizes aliquots to batches.
allRand(dataR, batchTot, numQC, withinN, numMatch, chkRep)allRand(dataR, batchTot, numQC, withinN, numMatch, chkRep)
dataR |
Data for randomization. |
batchTot |
c(batchTot1, batchTot2) sizes of plates, just use one plate per batch, batch size inclusive of QC samples. |
numQC |
Number of QC samples per batch. |
withinN |
Number of samples away that the QC samples must be from each other. |
numMatch |
Number of QC samples from a single mother within a batch. |
chkRep |
Check if there is a repeat of the groups within the batches. |
A dataset with serum order randomized.
Counts the number of samples that are in each of the batches.
batchCount(dataS, batchSizeT)batchCount(dataS, batchSizeT)
dataS |
Test dataset. |
batchSizeT |
Batch size to test for. |
The ID of any batch that does not contain the specified number of samples.
Count how many QC samples are in each of the batches, and if it doesn't match the number specified.
countQC(dataS, QCN)countQC(dataS, QCN)
dataS |
Test dataset. |
QCN |
Number of QC samples per batch. |
The output includes any batches that does not contain the number of QC samples specified.
The function formatRand formats the dataset for the randomization function. This function inputs serum data for both the study subjects and QC.
formatRand(QCdata, serumIDR, serumPack)formatRand(QCdata, serumIDR, serumPack)
serumIDR |
Serum data with serumIDs. |
serumPack |
Serum data with packing lists. |
QCData |
QC data. |
A dataset that is formatted and ready for the randomization file.
Tests if a large number of cases or controls are next to each other.
orderCases(dataI, betW)orderCases(dataI, betW)
dataI |
Dataset to be tested. |
betW |
Number of cases or controls to check if they are next to each other. |
The output stores if there are any cases or controls together beyond a certain specified value.
Creates output labels for the randomized groups.
outputLab(dataOut, blind, origP, maxRows, maxCols, newPack)outputLab(dataOut, blind, origP, maxRows, maxCols, newPack)
dataOut |
Dataset to be formatted for packing list. |
origP |
Indicator, 0/1, inclusion of the original packing location (1) or deletion of the packing location (0). |
maxRows |
Maximum row for the output dataset. |
maxCols |
Maximum column for the output dataset. |
newPack |
0/1 indicator to generate new packing locations. |
Blind |
Indicator 0/1 select if a blinded (1) or unblinded(0) packing list is to be generated. |
A dataset to be used for packing lists.
blind <- outputLab(dataOut=serumRand,blind=1,origP=0,maxRows=9,maxCols=9,newPack=1) unBlindSw <- outputLab(serumSwitchP,blind=0,origP=.,maxRows=.,maxCols=.,newPack=0)blind <- outputLab(dataOut=serumRand,blind=1,origP=0,maxRows=9,maxCols=9,newPack=1) unBlindSw <- outputLab(serumSwitchP,blind=0,origP=.,maxRows=.,maxCols=.,newPack=0)
We first assign IDs linking mother/child and events using the function randTest.
randTest(dataMom, dataChild, maxAliq, nEvent)randTest(dataMom, dataChild, maxAliq, nEvent)
dataMom |
The mother dataset. |
dataChild |
Child dataset. |
maxAliq |
Number of aliquots per mother aliquot. |
nEvent |
Number of aliquots per each of event or lab. |
The output of the function is a dataset with the ID links.
Minimizes switches without completely re-randomizing the locations.
switchR(dataIn, numqc, numqcM, batchS)switchR(dataIn, numqc, numqcM, batchS)
dataIn |
Randomized dataset. |
numqc |
Number of QC samples per set. |
numqcM |
Numberof QC matching samples. |
batchS |
New batch size. |
A dataset with switches indicated.
serumSwitch <- switchR(dataIn=serumRand,numqc=2,numqcM=2,batchS=43)serumSwitch <- switchR(dataIn=serumRand,numqc=2,numqcM=2,batchS=43)
Tests and finds sample groups that are across batches.
testCCAcross(dataS)testCCAcross(dataS)
dataS |
The test dataset. |
The output lists all batches with not enough QC sample sets or the QC samples do not come from the same mother.
Tests if sets are next to each other. Any sets that are not next to each other are flagged.
testPair(dataS)testPair(dataS)
dataS |
Test dataset. |
The output reports any sets that are separated in the "loc".
Measures that every batch has at least the specified number of matching QC sample sets in a batch.
testQCmatch(dataS, numQCs, numMatch)testQCmatch(dataS, numQCs, numMatch)
dataS |
Randomized data. |
numQCs |
Number of QCs specified per dataset. |
numMatch |
Number of QC samples form a single mother within a batch. |
The output lists all batches with not enough QC sample sets or the QC samples do not come from the same mother.
Generates test data for the randomization functions.
testRand(rowSize, colSize, studySize, expNS, numCC, QCpct, child)testRand(rowSize, colSize, studySize, expNS, numCC, QCpct, child)
rowSize |
Max row size. |
colSize |
Max column size. |
studySize |
Number of cases. |
expNS |
Number of aliquots per case/control. |
numCC |
Number of controls per case. |
QCpct |
Percent of QCs for number of samples. |
child |
Number of children per "mother' aliquot. |
A practice dataset.
testR <- testRand(rowSize=20,colSize=15,studySize=1000,expNS=7000,numCC=2,QCpct=0.05,child=4)testR <- testRand(rowSize=20,colSize=15,studySize=1000,expNS=7000,numCC=2,QCpct=0.05,child=4)
Test for unique IDs.
uniqueID(testD, IDN)uniqueID(testD, IDN)
testD |
Test dataset. |
IDN |
ID to test. |
Any IDs that are not unique.