consolidate observedMutations

Issue #143 resolved
ssnn created an issue

Similar to issue #141. Refactor, and have one observedMutations function that can reproduce previous behavior and also work with the extended region definition.

Comments (5)

  1. ssnn reporter

    @milca tarshish Please, review this test that fails, and that I have commented out: https://bitbucket.org/kleinstein/shazam/src/802de4a6d5ec328da240e231b9fd57243c592124/tests/testthat/test_MutationProfiling.R#lines-2797:2798

    It didn’t fail before, because tolerance was set to tolerance=001. After changing to `tolerance=0.001`, the test fails. Maybe increasing the tolerance is fine, but given that you wrote the extended region definitions code and tests, I think it is better if you review and decide what to do with this.

    >     expect_equal(db_exp_ALL_REGIONS[,columns_V_REGIONS]/(sum_db_exp_ALL_REGIONS_FWR123 + sum_db_exp_ALL_REGIONS_CDR12),
    +               as.data.frame(db_exp_V_BY_REGIONS[,columns_V_REGIONS]), tolerance=0.001)
    Error: `/`(...) not equal to as.data.frame(db_exp_V_BY_REGIONS[, columns_V_REGIONS]).
    Componentmu_expected_cdr1_r: Mean relative difference: 0.001583764
    Componentmu_expected_cdr1_s: Mean relative difference: 0.001546665
    Componentmu_expected_cdr2_r: Mean relative difference: 0.001754587
    Componentmu_expected_cdr2_s: Mean relative difference: 0.001623871
    Componentmu_expected_fwr1_r: Mean relative difference: 0.001781604
    Componentmu_expected_fwr1_s: Mean relative difference: 0.001834398
    Componentmu_expected_fwr2_r: Mean relative difference: 0.001842687
    Componentmu_expected_fwr2_s: Mean relative difference: 0.001642512
    Componentmu_expected_fwr3_r: Mean relative difference: 0.003116085
    
    > db_exp_ALL_REGIONS[,columns_V_REGIONS]/(sum_db_exp_ALL_REGIONS_FWR123 + sum_db_exp_ALL_REGIONS_CDR12)
      mu_expected_cdr1_r mu_expected_cdr1_s mu_expected_cdr2_r mu_expected_cdr2_s mu_expected_fwr1_r mu_expected_fwr1_s mu_expected_fwr2_r mu_expected_fwr2_s mu_expected_fwr3_r
    1         0.08048343         0.02716326         0.08497478         0.02749054          0.1509590         0.04758562         0.09448658         0.04299707          0.3306399
    2         0.07322220         0.01489869         0.12468894         0.02770002          0.1528349         0.05491810         0.11517210         0.03268472          0.3209418
    3         0.06886640         0.01817383         0.11079264         0.02572712          0.1647904         0.05839042         0.12033662         0.03595305          0.3042487
      mu_expected_fwr3_s
    1         0.11321979
    2         0.08293850
    3         0.09272084
    
    
    > as.data.frame(db_exp_V_BY_REGIONS[,columns_V_REGIONS])
      mu_expected_cdr1_r mu_expected_cdr1_s mu_expected_cdr2_r mu_expected_cdr2_s mu_expected_fwr1_r mu_expected_fwr1_s mu_expected_fwr2_r mu_expected_fwr2_s mu_expected_fwr3_r
    1         0.08047289         0.02715971         0.08496365         0.02748694          0.1509392         0.04757938         0.09447421         0.04299144          0.3301240
    2         0.07321167         0.01489655         0.12467101         0.02769603          0.1528129         0.05491020         0.11515554         0.03268002          0.3203767
    3         0.06919783         0.01826129         0.11132585         0.02585093          0.1655835         0.05867144         0.12091577         0.03612608          0.3023514
      mu_expected_fwr3_s
    1         0.11380857
    2         0.08358936
    3         0.09171599
    

  2. Log in to comment