Skip to content

Latest commit

 

History

History
243 lines (217 loc) · 25.5 KB

specs.md

File metadata and controls

243 lines (217 loc) · 25.5 KB

Specs for fitPoisBG:

When groupvar is not provided,

  1. The function outputs a GeoMx S4 class with length same as length of ROIs, sizefact, in phenoData.
    test:
    # 1 The function outputs a GeoMx S4 class with length same as length of ROIs, sizefact, in phenoData.
  2. The function outputs a GeoMx S4 class with length same as length of negative probes, featfact, in featureData. The value is NA for non-negative probes.
    test:
    # 2 The function outputs a GeoMx S4 class with length same as length of negative probes, featfact, in featureData. The value is NA for non-negative probes
  3. If size_scale="first", sizefact[1]=1
    test:
    # Spec 3: If size_scale="first", sizefact[1]=1
  4. If size_scale="sum", sum(sizefact)=1
    test:
    # Spec 4: If size_scale="sum", sum(sizefact)=1

When groupvar is provided but not found in the phenodata,

  1. The function returns an error saying this groupvar is not found in the S4 object.
    test:
    # 1. The function returns an error saying this groupvar is not found in the S4 object.

When groupvar is provided and found in the phenodata, but the it only has one unique value,

  1. The function returns a warning message saying that the groupvar has only one value
    test:
    # 1. The function returns a warning message saying that the groupvar has only one value

When groupvar is provided and found in the phenodata with more than one unique value,

  1. The function outputs a GeoMx S4 class with length same as length of ROIs, sizefact_sp, in phenoData.
    test:
    # 1 The function outputs a GeoMx S4 class with length same as length of ROIs, sizefact, in phenoData
  2. The function outputs a GeoMx S4 class with length same as length of negative probes, featfact_sp, in featureData for each unique slide value. The value is NA for non-negative probes.
    test:
    # - The function outputs a GeoMx S4 class with length same as length of negative probes, featfact, in featureData for each unique slide value.
    test:
    # 2 The function outputs a GeoMx S4 class with length same as length of negative probes, featfact, in featureData.
  3. If size_scale="first", sizefact[1]=1
    test:
    expect_equal(pData(res)$sizefact[1], 1, tol = 1e-5)
  4. If size_scale="sum", sum(sizefact)=1
    test:
    expect_equal(sum(pData(res)$sizefact), 1, tol = 1e-5)

Specs for diagPoisBG:

  1. When generate_ppplot is TRUE, a figure is generated, when FALSE, no figure is generated
    test:
    # 1 When generate_ppplot is TRUE, a figure is generated, when FALSE, no figure is generated
  2. when padj=FALSE, each element of sum of lowtail_prob and uptail_prob in the assay slot named lowtail_prob and uptail_prob equals to 1
    test:
    # 2 when padj=FALSE, each element of sum of lowtail_prob and uptail_prob in the assay slot named lowtail_prob and uptail_prob equals to 1
  3. It returns an error without running fitPoisBG.
    test:
    ## 3 It returns an error without running fitPoisBG.
  4. It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.
    test:
    ## 4 It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.

Specs for QuanRange:

  1. The function outputs a GeoMx S4 class with length same as length of sample IDs (rownames) in phenoData for each probs input. The colname is the input prob.
    test:
    # 1 The function outputs a GeoMx S4 class...
  2. It returns an error without running fitPoisBG.
    test:
    ## 2 It returns an error without running fitPoisBG.
  3. It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.
    test:
    ## 3 It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.

Specs for BGScoreTest:

When split is FALSE,

  1. The function outputs a GeoMx S4 class with p values in featureData with length same as length of probes. The p value is NA for negative targets.
    test:
    # 1 The function outputs a GeoMx S4 class...
    test:
    expect_true(inherits(case2, "NanoStringGeoMxSet"))
    test:
    expect_true(inherits(case3, "NanoStringGeoMxSet"))
    test:
    expect_true(inherits(case4, "NanoStringGeoMxSet"))
  2. The function outputs a GeoMx S4 class with score values in featureData with length same as length of targets. The score value is NA for negative probes.
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
  3. All p values are between 0 and 1 (inclusive) for non-negative features.
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
  4. The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
  5. The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
  6. The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.
  7. It returns an error without running fitPoisBG.
    test:
    ## 7 It returns an error without running fitPoisBG.
  8. It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.
    test:
    ## 8 It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.

When split is TRUE,

  1. The function outputs a GeoMx S4 class with p values in featureData with length same as length of targets for each unique slide value. The p value is NA for negative probes.
    test:
    # 1 The function outputs a GeoMx S4 class...
    test:
    # 1 The function outputs a GeoMx S4 class...
    test:
    # 1 The function outputs a GeoMx S4 class...
    test:
    expect_true(inherits(case4, "NanoStringGeoMxSet"))
  2. The function outputs a GeoMx S4 class with score values in featureData with length same as length of targets for each unique slide value. The score value is NA for negative probes.
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
  3. All p values are between 0 and 1 (inclusive) for non-negative features.
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
    test:
    # 3 All p values are between 0 and 1 (inclusive)
  4. The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
    test:
    # 4 The length of non-NA p values is equal to the number of non-negative probes.
  5. The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
    test:
    # 5 The length of non-NA scores values is equal to the number of non-negative probes.
  6. The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.
    test:
    # 6 The order of pvalues is the same as scores.

Specs for fitNBth:

  1. Without providing values for features_high, sizefact_BG, threshold_start, the function returns the same value
    test:
    # 1 Without providing values for features_high, sizefact_BG, threshold_start, the function returns the same value
    test:
    # 1 Without providing values for features_high, sizefact_BG, threshold_start, the function returns the same value
  2. The function outputs a GeoMx S4 class with para0 in the experimentData as "NA".
    test:
    # 2 The function outputs a GeoMx S4 class...
    test:
    # 2 The function outputs a GeoMx S4 class...
  3. The function outputs a GeoMx S4 class with para, a matrix of estimated parameters, in the featureData. This matrix has feature_high_fitNBth in columns(same as features_high) and parameters(signal, r) in columns.
    test:
    # 3 The function outputs a GeoMx S4 class...
    test:
    # 3 The function outputs a GeoMx S4 class...
  4. The function outputs sizefact_fitNBth in the phenoData, which is positive, same length as sizefact_BG
    test:
    # 4 The function outputs sizefact_fitNBth in the phenoData, which is
    test:
    # 4 The function outputs sizefact_fitNBth in the phenoData, which is
  5. The function outputs threshold in the experimentData. When threshold_fix=TRUE, threshold in the output is the same as threshold_start.
    test:
    # 5 The function outputs threshold in the experimentData.
    test:
    # 5 The function outputs threshold in the experimentData.

Specs for fitPoisthNorm:

When split is FALSE,

  1. Without providing values for ROIs_high, features_high, features_all, sizefact_start, sizefact_BG, the function returns the same value
    test:
    # 1 Without providing values for ROIs_high, features_high, features_all, sizefact_start, sizefact_BG, the function returns the same value # expect same results without specifying the values.
  2. User need to set iterations =2 for now
    test:
    # 2 User need to set iterations =2 for now
  3. The function outputs a GeoMx S4 class with para0, matrix of estimated parameters, in the featureData.
    This matrix para0 has the following structure:
    3.1) 1 row for each feature (row name). If a feature is not in features_high, all columns will be NA.
    3.2) n+1 columns labeled var1, var2, ..., var, var<n+1> where n is the length of ROIs_high elements.
    3.3) the n columns will have log2 expression (if feature is in features_high) or NA (otherwise).
    3.4) the n+1th column contains the threshold for each feature in features_high and NA otherwise.
    test:
    # 3 The function outputs a GeoMx S4 class...
  4. The function outputs a GeoMx S4 class with para, matrix of estimated parameters, in the featureData. This matrix para has the following structure:
    4.1) 1 row for each feature (row name) which is equal to the length of features_all
    4.2) n+1 columns labeled var1, var2, ..., var, var<n+1> where n is the length of ROIs_high elements.
    4.3) the n columns will have log2 expression.
    4.4) the n+1th column contains the threshold for each feature in features_all.
    test:
    # 4 The function outputs a GeoMx S4 class...
  5. The function outputs a column called conv0 in featureData, with values in [NA, 0] and length of 0s are the same as the length of features_high.
    test:
    # 5 The function outputs a column called conv0 in featureData, with values in [NA, 0] and length of 0s are the same as the length of features_high.
  6. The function outputs a column called conv in featureData, length same as features_all, and has values [NA, 0, 1]. The length of NAs equals the number of negative probes.
    test:
    # 6 The function outputs a column called conv in featureData, length same as features_all, and has values [NA, 0, 1]. The length of NAs equals the number of negative probes.
  7. when confac=0 and prior_type="contrast", preci1_norm value in
    experimentData will be single value repeated over an n-by-n matrix (where n is the length of ROI_high).
    This single value is equivalent, within 10 digits, to preci1con/n^2.
    test:
    # 7 when confac=0 and prior_type="contrast", preci1_norm value in
  8. It returns an error without running fitPoisBG or fitNBth.
    test:
    # 8 It returns an error without running fitPoisBG.
  9. It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.
    test:
    # 9 It returns an error if split is TRUE but no corresponding fitPoisBG is called previously.

When split is TRUE,

  1. Without providing values for ROIs_high, features_high, features_all, sizefact_start, sizefact_BG, the function returns the same value
    test:
    # 1 Without providing values for features_high, sizefact_BG, threshold_start, the function returns the same value
  2. Given a GeoMx S4 object, fitPoisthNorm_sp runs the Poisson model-based normalization and log2 transformation on each element in "groupvar" individually. As such, the results for a given grouping/facet of the data should match the fitPoisthNorm results when an object is subset down to a single slide. Specifically, the following should be true:
    test:
    2.1) For a given element in groupvar, the corresponding column in the "threshold0" matrix, which is within featureData, should be identical to the single-patient case's fetureData's para0[,n+1]th column.
    2.2) For a given element in groupvar, the corresponding column in the "threshold" matrix, which is within featureData, should be identical to the single-patient case's fetureData's para[,n+1]th column.
    2.3) For a given element in groupvar, the normalized matrix "normmat0_sp", in the assayData slot, should be identical to that element's "normmat0" matrix, also in the assayData slot, for all samples within that element. In other words, the matrix within the "single slide" results (normmat0) should be a subset of the "multiple slide" results (normmat_sp).
    2.4) For a given element in groupvar, the normaized matrix "normmat_sp", in the assayData slot, should be identical to that element's "normmat" matrix, also in the assayData slot, for all samples within that element. In other words, the matrix within the "single slide" results (normmat) should be a subset of the "multiple slide" results (normmat_sp).
    2.5) For a given element in groupvar, the vector of sizefact, located in phenoData's sizefact_norm column, is identical to that element's sizefact_norm vector from running fitPoisthNorm (i.e., single grouping case).
    2.6) For a given element in groupvar, the vector of sizefact0, located in phenoData's sizefact_norm column, is identical to that element's sizefact_norm0 vector from running fitPoisthNorm (i.e., single grouping case).
    test:
    ## Run tests to compare

Specs for aggreprobe:

  1. The function shall aggregate the probes depending on the argument provided.
    test:
    # Spec 1: The function shall aggregate the probes depending on the argument provided.
  2. The function returns a GeoMxSet object when given a GeoMxSet object as input.
    test:
    # Spec 2: The function returns a GeoMxSet object when given a GeoMxSet
  3. For negative probes, the expression matrix and the target feature data available prior to collapsing shall match after collapsing except TargetName.
    test:
    # Spec 3: For negative probes, the expression matrix and the target
  4. TargetName for negative probes shall be updated to probe IDs after collapsing.
    test:
    # Spec 4: TargetName for negative probes shall be updated to probe IDs
  5. For the non-negative probes, the subset of probes selected by the use method will be aggregated by sum into one target count.
    test:
    # Spec 5: For the non-negative probes, selected by the use method will be
  6. The resulting object shall have the same size of feature names as negative probe names plus non-negative target names.
    test:
    # Spec 6: The resulting object shall have the same size of feature names
  7. Single probe targets shall be returned without aggregation test:

Specs for fitNBthDE:

1.The function outputs para0, a matrix of estimated parameters in iter=1. This matrix has features_high in the columns and parameters(regression coefficients, threshold, r) in the rows. Both threshold and r are positive.
test:

# 1 The function outputs para0,...
test:
expect_true("para0" %in% names(NBthDEmod1))
2.The function outputs para, a matrix of estimated parameters in iter=2. This matrix has features_all in the columns and parameters(regression coefficients, threshold, r) in the rows. Both threshold and r are positive.
test:
# 2 The function outputs para,...
test:
expect_true(inherits(NBthDEmod2[["para"]], "matrix"))
3.The function outputs sizefact, a vector of size factors, when sizefactrec=FALSE, sizefact is the same as sizefact_start.
test:
# 3 The function outputs sizefact,...
test:
expect_true(is.vector(NBthDEmod1[["sizefact"]]))

Specs for fitNBthmDE:

  1. The function outputs para, a matrix of estimated parameters. This matrix has features_all in the columns and parameters(regression coefficients, threshold, r) in the rows. Both threshold and r are positive.
    test:
    # 1: The function outputs para...
    test:
    # This matrix has features_all in the columns

Specs for coefNBth:

  1. when fullpara=TRUE, the output parameters should be regression coefficients, threshold and r in a list. Both threshold and r are positive.
    test:
    ## 1. when fullpara=TRUE, the output parameters should be regression coefficients, threshold and r in a list.
    test:
    ## 1. when fullpara=TRUE, the output parameters should be regression coefficients, threshold and r in a list.
  2. when fullpara=FALSE, the output parameters should be regression coefficients only in a list
    test:
    ## 2. when fullpara=FALSE, the output parameters should be regression coefficients only in a list
    test:
    ## 2. when fullpara=FALSE, the output parameters should be regression coefficients only in a list

Specs for contrastNBth:

  1. The function takes in a DE model as an input from fitNBthDE or fitNBthmDE
    test:
    coeffull <- contrastNBth(NBthDEmod2)
    test:
    coefmfull <- contrastNBth(NBthmDEmod2)
  2. The user input test:statistical test, choose from c("two-sided", ">", "<")
    test:
    coeftest <- contrastNBth(NBthDEmod2, method=matrix(c(0,1), 2, 1), baseline=0)
    test:
    coefmtest <- contrastNBth(NBthmDEmod2, method=matrix(c(0,1), 2, 1), baseline=0)
  3. In the output list, the p values of '>' and '<' for the same variable/feature should add up to 1
    test:
    ## 3. In the output list, the p values of '>' and '<' for the same variable/feature should add up to 1
    test:
    ## 3. In the output list, the p values of '>' and '<' for the same variable/feature should add up to 1

Specs for DENBth:

  1. In the output data.frame, the DE table should not have NA if NAto1=TRUE
    test:
    ## 1. In the output data.frame, the DE table should not have NA if NAto1=TRUE
    test:
    ## 1. In the output data.frame, the DE table should not have NA if NAto1=TRUE
  2. In the output data.frame, the DE table has a column padj when adjp=TRUE
    test:
    ## 2. In the output data.frame, the DE table has a column padj when adjp=TRUE
    test:
    ## 2. In the output data.frame, the DE table has a column padj when adjp=TRUE