interactivereport / RNASequest

18 stars 3 forks source link

Check "covariate_levels" refers to valid levels #24

Open ferg-0 opened 3 years ago

ferg-0 commented 3 years ago

Model checking is not checking that "Covariate_levels" in compareInfo.csv are actually valid levels for the corresponding factor variable. In example below the sampleMeta.csv had Sex as male|female. The Covariate_levels was "Sex:M" - a mismatch, but wasn't caught early on in the code.

[fcasey@camhpcps02 EA20211022_0]$ pwd
/camhpc/ngs/projects/TST11715/dnanexus/20211020031816_fergal.casey/EA20211022_0
[fcasey@camhpcps02 EA20211022_0]$ EArun ./config.yml
Loading resources ...
Warning: Your system is mis-configured: \u2018/etc/localtime\u2019 is not a symlink
Warning: It is strongly recommended to set envionment variable TZ to \u2018America/New_York\u2019 (or equivalent)
====== reading sample meta information ...
====== reading comparison information ...
    Checking model for Drg_C2_V76_ROA_ICM_vs_Drg_C2_Ctr
    Checking model for Drg_C4_V76_ROA_ICM_vs_Drg_C4_Ctr
    Checking model for Drg_C6_V76_ROA_ICM_vs_Drg_C6_Ctr
    Checking model for Drg_L2_V76_ROA_ICM_vs_Drg_L2_Ctr
    Checking model for Drg_L4_V76_ROA_ICM_vs_Drg_L4_Ctr
    Checking model for Drg_L6_V76_ROA_ICM_vs_Drg_L6_Ctr
    Checking model for Drg_T2_V76_ROA_ICM_vs_Drg_T2_Ctr
    Checking model for Drg_T4_V76_ROA_ICM_vs_Drg_T4_Ctr
    Checking model for Drg_T6_V76_ROA_ICM_vs_Drg_T6_Ctr
    Checking model for Drg_C2_V79_ROA_ICM_vs_Drg_C2_Ctr
    Checking model for Drg_C4_V79_ROA_ICM_vs_Drg_C4_Ctr
    Checking model for Drg_C6_V79_ROA_ICM_vs_Drg_C6_Ctr
    Checking model for Drg_L2_V79_ROA_ICM_vs_Drg_L2_Ctr
    Checking model for Drg_L4_V79_ROA_ICM_vs_Drg_L4_Ctr
    Checking model for Drg_L6_V79_ROA_ICM_vs_Drg_L6_Ctr
    Checking model for Drg_T2_V79_ROA_ICM_vs_Drg_T2_Ctr
    Checking model for Drg_T4_V79_ROA_ICM_vs_Drg_T4_Ctr
    Checking model for Drg_T6_V79_ROA_ICM_vs_Drg_T6_Ctr
    Checking model for Drg_C2_V76_ROA_IT_vs_Drg_C2_Ctr
    Checking model for Drg_C4_V76_ROA_IT_vs_Drg_C4_Ctr
    Checking model for Drg_C6_V76_ROA_IT_vs_Drg_C6_Ctr
    Checking model for Drg_L2_V76_ROA_IT_vs_Drg_L2_Ctr
    Checking model for Drg_L4_V76_ROA_IT_vs_Drg_L4_Ctr
    Checking model for Drg_L6_V76_ROA_IT_vs_Drg_L6_Ctr
    Checking model for Drg_T2_V76_ROA_IT_vs_Drg_T2_Ctr
    Checking model for Drg_T4_V76_ROA_IT_vs_Drg_T4_Ctr
    Checking model for Drg_T6_V76_ROA_IT_vs_Drg_T6_Ctr
    Checking model for Drg_C2_V79_ROA_IT_vs_Drg_C2_Ctr
    Checking model for Drg_C4_V79_ROA_IT_vs_Drg_C4_Ctr
    Checking model for Drg_C6_V79_ROA_IT_vs_Drg_C6_Ctr
    Checking model for Drg_L2_V79_ROA_IT_vs_Drg_L2_Ctr
    Checking model for Drg_L4_V79_ROA_IT_vs_Drg_L4_Ctr
    Checking model for Drg_L6_V79_ROA_IT_vs_Drg_L6_Ctr
    Checking model for Drg_T2_V79_ROA_IT_vs_Drg_T2_Ctr
    Checking model for Drg_T4_V79_ROA_IT_vs_Drg_T4_Ctr
    Checking model for Drg_T6_V79_ROA_IT_vs_Drg_T6_Ctr
    Checking model for Sc_C_V76_ROA_ICM_vs_Sc_C_Ctr
    Checking model for Sc_L_V76_ROA_ICM_vs_Sc_L_Ctr
    Checking model for Sc_T_V76_ROA_ICM_vs_Sc_T_Ctr
    Checking model for Sc_C_V79_ROA_ICM_vs_Sc_C_Ctr
    Checking model for Sc_L_V79_ROA_ICM_vs_Sc_L_Ctr
    Checking model for Sc_T_V79_ROA_ICM_vs_Sc_T_Ctr
    Checking model for Sc_C_V76_ROA_IT_vs_Sc_C_Ctr
    Checking model for Sc_L_V76_ROA_IT_vs_Sc_L_Ctr
    Checking model for Sc_T_V76_ROA_IT_vs_Sc_T_Ctr
    Checking model for Sc_C_V79_ROA_IT_vs_Sc_C_Ctr
    Checking model for Sc_L_V79_ROA_IT_vs_Sc_L_Ctr
    Checking model for Sc_T_V79_ROA_IT_vs_Sc_T_Ctr
    Checking model for Bst11_V76_ICM_vs_Bst11_Ctr
    Checking model for Bst12_V76_ICM_vs_Bst12_Ctr
    Checking model for Bst11_V79_ICM_vs_Bst11_Ctr
    Checking model for Bst12_V79_ICM_vs_Bst12_Ctr
    Checking model for Bst11_V76_IT_vs_Bst11_Ctr
    Checking model for Bst12_V76_IT_vs_Bst12_Ctr
    Checking model for Bst11_V79_IT_vs_Bst11_Ctr
    Checking model for Bst12_V79_IT_vs_Bst12_Ctr
    Checking model for CtxM_V76_ICM_vs_CtxM_Ctr
    Checking model for CtxM_V76_IT_vs_CtxM_Ctr
    Checking model for CtxM_V79_ICM_vs_CtxM_Ctr
    Checking model for CtxM_V79_IT_vs_CtxM_Ctr
    Checking model for Lv_V76_ICM_vs_Lv_Ctr
    Checking model for Lv_V76_IT_vs_Lv_Ctr
    Checking model for Lv_V79_ICM_vs_Lv_Ctr
    Checking model for Lv_V79_IT_vs_Lv_Ctr
Please update metaFactor file to avoid this warning message
Warning message:
In metaFactor(meta, config$sample_factor, unique(comp_info$Group_name)) :
  1001a,1501a,1502a from Subject are missing from sample file
====== reading gene annotation ...
====== reading gene quantification ...
        Filtering with 29324 genes
        Filtering with 29324 genes
====== adjusting covariates for visualization ...
'covariates_adjust' is not set in the config file, no covariate adjust
Finished TPM estimation!
====== Starting DEG analyses ...
Comparison Drg_C2_V76_ROA_ICM_vs_Drg_C2_Ctr
Error in relevel.factor(S_meta[, names(Cov_levels_vec)[n]], ref = Cov_levels_vec[n]) : 
  'ref' must be an existing level
Calls: Batch_DEG ... lapply -> FUN -> DESeq2_DEG -> relevel -> relevel.factor
Execution halted
wli7 commented 3 years ago

Fixed by 034ce1d

wli7 commented 3 years ago

Hi Fergal,

I just checked your compareInfo_batch1.csv file. Actually the pure additive model does not need the Covariate_levels to be specified as the variables are all independent. I have modified the script to do the relevel step with the Covariate_levels setting only when the model has interaction term.

The changes has been pushed to the GitHub.

Thanks, Wei

On Oct 22, 2021, at 8:18 PM, ferg-0 @.***> wrote:

Model checking is not checking that "Covariate_levels" in compareInfo.csv are actually valid levels for the corresponding factor variable. In example below the sampleMeta.csv had Sex as male|female. The Covariate_levels was "Sex:M" - a mismatch, but wasn't caught early on in the code.

@. EA20211022_0]$ pwd /camhpc/ngs/projects/TST11715/dnanexus/20211020031816_fergal.casey/EA20211022_0 @. EA20211022_0]$ EArun ./config.yml Loading resources ... Warning: Your system is mis-configured: \u2018/etc/localtime\u2019 is not a symlink Warning: It is strongly recommended to set envionment variable TZ to \u2018America/New_York\u2019 (or equivalent) ====== reading sample meta information ... ====== reading comparison information ... Checking model for Drg_C2_V76_ROA_ICM_vs_Drg_C2_Ctr Checking model for Drg_C4_V76_ROA_ICM_vs_Drg_C4_Ctr Checking model for Drg_C6_V76_ROA_ICM_vs_Drg_C6_Ctr Checking model for Drg_L2_V76_ROA_ICM_vs_Drg_L2_Ctr Checking model for Drg_L4_V76_ROA_ICM_vs_Drg_L4_Ctr Checking model for Drg_L6_V76_ROA_ICM_vs_Drg_L6_Ctr Checking model for Drg_T2_V76_ROA_ICM_vs_Drg_T2_Ctr Checking model for Drg_T4_V76_ROA_ICM_vs_Drg_T4_Ctr Checking model for Drg_T6_V76_ROA_ICM_vs_Drg_T6_Ctr Checking model for Drg_C2_V79_ROA_ICM_vs_Drg_C2_Ctr Checking model for Drg_C4_V79_ROA_ICM_vs_Drg_C4_Ctr Checking model for Drg_C6_V79_ROA_ICM_vs_Drg_C6_Ctr Checking model for Drg_L2_V79_ROA_ICM_vs_Drg_L2_Ctr Checking model for Drg_L4_V79_ROA_ICM_vs_Drg_L4_Ctr Checking model for Drg_L6_V79_ROA_ICM_vs_Drg_L6_Ctr Checking model for Drg_T2_V79_ROA_ICM_vs_Drg_T2_Ctr Checking model for Drg_T4_V79_ROA_ICM_vs_Drg_T4_Ctr Checking model for Drg_T6_V79_ROA_ICM_vs_Drg_T6_Ctr Checking model for Drg_C2_V76_ROA_IT_vs_Drg_C2_Ctr Checking model for Drg_C4_V76_ROA_IT_vs_Drg_C4_Ctr Checking model for Drg_C6_V76_ROA_IT_vs_Drg_C6_Ctr Checking model for Drg_L2_V76_ROA_IT_vs_Drg_L2_Ctr Checking model for Drg_L4_V76_ROA_IT_vs_Drg_L4_Ctr Checking model for Drg_L6_V76_ROA_IT_vs_Drg_L6_Ctr Checking model for Drg_T2_V76_ROA_IT_vs_Drg_T2_Ctr Checking model for Drg_T4_V76_ROA_IT_vs_Drg_T4_Ctr Checking model for Drg_T6_V76_ROA_IT_vs_Drg_T6_Ctr Checking model for Drg_C2_V79_ROA_IT_vs_Drg_C2_Ctr Checking model for Drg_C4_V79_ROA_IT_vs_Drg_C4_Ctr Checking model for Drg_C6_V79_ROA_IT_vs_Drg_C6_Ctr Checking model for Drg_L2_V79_ROA_IT_vs_Drg_L2_Ctr Checking model for Drg_L4_V79_ROA_IT_vs_Drg_L4_Ctr Checking model for Drg_L6_V79_ROA_IT_vs_Drg_L6_Ctr Checking model for Drg_T2_V79_ROA_IT_vs_Drg_T2_Ctr Checking model for Drg_T4_V79_ROA_IT_vs_Drg_T4_Ctr Checking model for Drg_T6_V79_ROA_IT_vs_Drg_T6_Ctr Checking model for Sc_C_V76_ROA_ICM_vs_Sc_C_Ctr Checking model for Sc_L_V76_ROA_ICM_vs_Sc_L_Ctr Checking model for Sc_T_V76_ROA_ICM_vs_Sc_T_Ctr Checking model for Sc_C_V79_ROA_ICM_vs_Sc_C_Ctr Checking model for Sc_L_V79_ROA_ICM_vs_Sc_L_Ctr Checking model for Sc_T_V79_ROA_ICM_vs_Sc_T_Ctr Checking model for Sc_C_V76_ROA_IT_vs_Sc_C_Ctr Checking model for Sc_L_V76_ROA_IT_vs_Sc_L_Ctr Checking model for Sc_T_V76_ROA_IT_vs_Sc_T_Ctr Checking model for Sc_C_V79_ROA_IT_vs_Sc_C_Ctr Checking model for Sc_L_V79_ROA_IT_vs_Sc_L_Ctr Checking model for Sc_T_V79_ROA_IT_vs_Sc_T_Ctr Checking model for Bst11_V76_ICM_vs_Bst11_Ctr Checking model for Bst12_V76_ICM_vs_Bst12_Ctr Checking model for Bst11_V79_ICM_vs_Bst11_Ctr Checking model for Bst12_V79_ICM_vs_Bst12_Ctr Checking model for Bst11_V76_IT_vs_Bst11_Ctr Checking model for Bst12_V76_IT_vs_Bst12_Ctr Checking model for Bst11_V79_IT_vs_Bst11_Ctr Checking model for Bst12_V79_IT_vs_Bst12_Ctr Checking model for CtxM_V76_ICM_vs_CtxM_Ctr Checking model for CtxM_V76_IT_vs_CtxM_Ctr Checking model for CtxM_V79_ICM_vs_CtxM_Ctr Checking model for CtxM_V79_IT_vs_CtxM_Ctr Checking model for Lv_V76_ICM_vs_Lv_Ctr Checking model for Lv_V76_IT_vs_Lv_Ctr Checking model for Lv_V79_ICM_vs_Lv_Ctr Checking model for Lv_V79_IT_vs_Lv_Ctr Please update metaFactor file to avoid this warning message Warning message: In metaFactor(meta, config$sample_factor, unique(comp_info$Group_name)) : 1001a,1501a,1502a from Subject are missing from sample file ====== reading gene annotation ... ====== reading gene quantification ... Filtering with 29324 genes Filtering with 29324 genes ====== adjusting covariates for visualization ... 'covariates_adjust' is not set in the config file, no covariate adjust Finished TPM estimation! ====== Starting DEG analyses ... Comparison Drg_C2_V76_ROA_ICM_vs_Drg_C2_Ctr Error in relevel.factor(S_meta[, names(Cov_levels_vec)[n]], ref = Cov_levels_vec[n]) : 'ref' must be an existing level Calls: Batch_DEG ... lapply -> FUN -> DESeq2_DEG -> relevel -> relevel.factor Execution halted

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/interactivereport/ExpressionAnalysis/issues/24, or unsubscribe https://github.com/notifications/unsubscribe-auth/ARMCJJHC2HTFFUXXP7IZ6M3UIISO5ANCNFSM5GRYU23Q. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

ferg-0 commented 3 years ago

Thanks Wei - I understand that it was not needed there in this case. The main point here is change the code to make sure to check the levels specified in Covariate_levels and see if they are valid levels (i.e. they match what's in the sampleMeta.csv), and do this early on in the code, like you're doing for the other input checks.