For aminoAcidProperties and related fx: test NAs

Issue #30 resolved
ssnn created an issue

Make sure NAs are passed through properly. I.e., an NA appears in the vector instead of a score for the sequence "NA".

Comments (10)

  1. ssnn reporter

    I think we should make sure NULLs also pass through.

    This behaviour is undesirable, I guess. Given a vector with 4 entries, the function retuns a vector of length 3 with the properties:

    seq_aa_na_null <- c(NA,NULL,"NA","NULL")
     gravy(seq_aa_na, hydropathy =  h)
    [1]   NA 0.27   NA
    
  2. Jason Vander Heiden

    I also don't think there is a good way to do this, as c(1, NULL, 2) reduces automatically to c(1,2).

  3. ssnn reporter

    Only if data gets to the function as a list, then it could have the NULL value. But it is unlikely that would happen.

  4. ssnn reporter

    Should all the property functions return NA in the situation the sequence has invalid characters, or at least don't consider the character in the normalization by length (NULL and NLL should return the same)? It seems some functions that look into the different scales, return NA, but others don't.

    file <- system.file("extdata", "changeo_demo.gz", package="alakazam")
    db <- readChangeoDb(file)
    db[1,"JUNCTION"] <- NA
    db[2,"JUNCTION"] <- "NA"
    db[3,"JUNCTION"] <- "NULL"
    db[4,"JUNCTION"] <- "NLL"
    junction_properties_na <- aminoAcidProperties(db[1:4,], seq="JUNCTION", nt=FALSE,
                                                  trim=FALSE, label="JUNCTION",
                                                  hydropathy = h)
    junction_properties_na[,grep("_AA_",colnames(junction_properties_na))]
    
      JUNCTION_AA_LENGTH JUNCTION_AA_GRAVY JUNCTION_AA_BULK
    1                 NA                NA               NA
    2                  2         0.2700000            12.16
    3                  4                NA               NA
    4                  3        -0.4633333            18.54
      JUNCTION_AA_ALIPHATIC JUNCTION_AA_POLARITY
    1                    NA                   NA
    2                  0.50             9.850000
    3                  1.95                   NA
    4                  2.60             7.133333
      JUNCTION_AA_CHARGE JUNCTION_AA_BASIC JUNCTION_AA_ACIDIC
    1                 NA                NA                 NA
    2                  0                 0                  0
    3                  0                 0                  0
    4                  0                 0                  0
      JUNCTION_AA_AROMATIC
    1                   NA
    2                    0
    3                    0
    4                    0
    
  5. Log in to comment