Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocked design first #47

Open
llrs opened this issue Mar 19, 2024 · 3 comments
Open

Blocked design first #47

llrs opened this issue Mar 19, 2024 · 3 comments

Comments

@llrs
Copy link
Owner

llrs commented Mar 19, 2024

If possible to make the distribution blocked by variable.

If there is a dataset with 6 samples of group A and 6 samples of group B and the batch size is of 6. Check that 3 and 3 are distributed (if no other variable is needed).

This makes it easier for the technicians to prepare the experiments.

Check if this exists in other tools too!

llrs added a commit that referenced this issue Mar 27, 2024
@llrs
Copy link
Owner Author

llrs commented May 6, 2024

The solution might be simple: create a new index with the blocked variables and then randomizes what is left...

Should be mentioned in the vignette

@llrs
Copy link
Owner Author

llrs commented May 7, 2024

Here is the code that I ended up using.

Some of it could be used to adapt it and incorporate it into the package...

# Randomization ####
# Randomize the first samples that are not ALI
posi <- seq_len(NROW(samples_plates[-c(1:41), ]))
samp_plate1 <- sample(posi, 47)
i <- list(plate_1 = samp_plate1,
          plate_2 = setdiff(posi, samp_plate1)) # ALI second plate

# New plate Olink
columns <- 12
rows <- 8
# Last column cannot be used (it is used for O-link controls)
last_column <- paste0(LETTERS[1:8], 12)
set.seed(4927)
pn <- experDesign:::position_name(rows = LETTERS[seq_len(rows)], 
                                  columns = seq_len(columns))
i1 <- lapply(i, function(x){x + 41})
i1[["plate_1"]] <- c(i1[["plate_1"]], 1:41)
stopifnot(all(lengths(i1) == 88L))
s <- spatial(index = i1, 
             pheno = samples_plates[, c("Participant_id", "infection")], 
             rows = LETTERS[seq_len(rows)], columns = seq_len(columns), 
             remove_positions = last_column, 
             )

insp1 <- inspect(i1, samples_plates, index_name = "plate_olink")
insp2 <- inspect(s, insp1, index_name = "new_position")

@llrs
Copy link
Owner Author

llrs commented May 8, 2024

I think this is really skipping some of them positions for the first plate distribution.
It could be like design(sample_sheet, skip = 1:41, batch_size = 88L).
The approach used only works because the samples are ordered and at the beginning, if not this would be more complicated (mixed, or ordered after one sample to keep).

The design function might become too complex if it also has a block argument.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant