Depending on input files, weird bugs can happen in fret_correct_signal.
This is because of R's vector recycling rules. Specifically, the number of points in the titration series must be a multiple of the number of points making up the donor_only control (otherwise, the latter cannot be recycled an integer number of times to match the length of the former). Potential solutions:
average donor_only points if length(donor_only) < length(titration), so that the single resulting number can be recycled against any number of points in the titration series;
enforce length(donor_only) == length(titration), which is the most correct way to set up the experiment anyway.
Enforcing a particular set up is not nice to the user. On the other hand, silent averaging can lead to great confusion, therefore averaging should be explicitly announced with message().
If NA values are present in the raw dataset, doing math with them will propagate them and make the entire corrected dataset full of NAs. This could be checked for, to make sure NAs are dropped properly before doing any math.
fret_correct_signal
.This is because of R's vector recycling rules. Specifically, the number of points in the titration series must be a multiple of the number of points making up the donor_only control (otherwise, the latter cannot be recycled an integer number of times to match the length of the former). Potential solutions:
length(donor_only) < length(titration)
, so that the single resulting number can be recycled against any number of points in the titration series;length(donor_only) == length(titration)
, which is the most correct way to set up the experiment anyway.Enforcing a particular set up is not nice to the user. On the other hand, silent averaging can lead to great confusion, therefore averaging should be explicitly announced with
message()
.NA
values are present in the raw dataset, doing math with them will propagate them and make the entire corrected dataset full of NAs. This could be checked for, to make sure NAs are dropped properly before doing any math.