douglasyao / mesc

Mediated Expression Score Regression (MESC)
GNU General Public License v3.0
26 stars 8 forks source link

how to set the parameters in unstratified MESC #9

Closed 2016young closed 2 years ago

2016young commented 2 years ago

Dear Douglas W. Yao,

I am Nayang, now using MESC to estimate h2med. Really appreciate that the tool is very powerful and insightful.

Now I have trouble in using unstratified MESC and I do not know how to set the parameters. Could you give me some suggestions?

Thanks in advance and looking forward to your reply.

Best, Nayang

douglasyao commented 2 years ago

Hi Nayang,

Thanks for checking out the tool. Can you provide some more detail about which parameters you're unsure about?

Thanks, Doug

On Wed, Sep 7, 2022 at 8:17 AM 2016young @.***> wrote:

Dear Douglas W. Yao,

I am Nayang, now using MESC to estimate h2med. Really appreciate that the tool is very powerful and insightful.

Now I have trouble in using unstratified MESC and I do not know how to set the parameters. Could you give me some suggestions?

Thanks in advance and looking forward to your reply.

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKEYDHFE73WWXAZ6BZ7DV5CBWJANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you are subscribed to this thread.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Thanks a lot for your prompt reply! I want to run unstratified MESC. I can not succeed in setting the parameter: --ref-ld-keep-annot to achieve unstratified MESC.

The code is ./run_mesc.py --h2med E66.sumstats.gz --out E66 --exp ./exp/met_plasma.1 --num-bins 1 --ref-ld-keep-annot NULL

which gives the errors:

Traceback (most recent call last): File "./run_mesc.py", line 260, in sumstats.estimate_h2med(args, log) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 311, in estimate_h2med args, log, args.h2med) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 292, in _read_ld_sumstats M_annot, ref_ld, novar_cols = _check_variance(log, M_annot, ref_ld) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 254, in _check_variance raise ValueError('All LD Scores have zero variance.') ValueError: All LD Scores have zero variance.

Thanks a lot and looking forward to your suggestions!

Best, Nayang

2016young commented 2 years ago

Hi Doug,

I can not succeed in setting the parameter: --ref-ld-keep-annot or --ref-ld-remove-annot to achieve unstratified MESC. Could you give me some suggestions? Thanks a lot in advance!

Best, Nayang

douglasyao commented 2 years ago

Hi Nayang,

Unstratified MESC does not require either --ref-ld-keep-annot or --ref-ld-remove-annot be set. These flags should basically never be used.

-Doug

On Sun, Sep 11, 2022 at 10:07 PM 2016young @.***> wrote:

Hi Doug,

I can not succeed in setting the parameter: --ref-ld-keep-annot or --ref-ld-remove-annot to achieve unstratified MESC. Could you give me some suggestions? Thanks a lot in advance!

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243129447, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE37IKVEC4V677UTXR3V52F4JANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Thanks for your reply. Then I do not know how to run unstratified MESC. If I run the MESC like

./run_mesc.py --h2med E66.sumstats.gz --out E66 --exp ./exp/met_plasma.1 --num-bins 1

in default it stratified SNPs by 72 functional categories specified by the baselineLD model v.2.0.

Could you give me some advice about running unstratified MESC?

Thanks, Nayang

douglasyao commented 2 years ago

Hi Nayang,

By default, if you run MESC without gene sets then it will perform unstratified MESC. There are reasons why genes still need to be stratified into bins (based on their expression cis-heritability) in order to obtain unbiased h2med estimates, so the --num-bins flag should not be changed. The same goes for stratifying SNPs according to the baselineLD model - this is needed to obtain unbiased h2med estimates. If you only care about the overall h2med estimate, you can just ignore the values outputted for individual gene bins and SNP categories.

-Doug

On Mon, Sep 12, 2022 at 11:27 AM 2016young @.***> wrote:

Hi Doug,

Thanks for your reply. Then I do not know how to run unstratified MESC. If I run the MESC like

./run_mesc.py --h2med E66.sumstats.gz --out E66 --exp ./exp/met_plasma.1 --num-bins 1

in default it stratified SNPs by 72 functional categories specified by the baselineLD model v.2.0.

Could you give me some advice about running unstratified MESC?

Thanks, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243910158, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE4MIULMP65IXBNWMK3V55DWLANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

douglasyao commented 2 years ago

To clarify, if you run MESC with only one gene bin and only one SNP bin, then the resulting h2med estimate will be biased and basically meaningless.

-Doug

On Mon, Sep 12, 2022 at 11:33 AM Yao, Doug @.***> wrote:

Hi Nayang,

By default, if you run MESC without gene sets then it will perform unstratified MESC. There are reasons why genes still need to be stratified into bins (based on their expression cis-heritability) in order to obtain unbiased h2med estimates, so the --num-bins flag should not be changed. The same goes for stratifying SNPs according to the baselineLD model - this is needed to obtain unbiased h2med estimates. If you only care about the overall h2med estimate, you can just ignore the values outputted for individual gene bins and SNP categories.

-Doug

On Mon, Sep 12, 2022 at 11:27 AM 2016young @.***> wrote:

Hi Doug,

Thanks for your reply. Then I do not know how to run unstratified MESC. If I run the MESC like

./run_mesc.py --h2med E66.sumstats.gz --out E66 --exp ./exp/met_plasma.1 --num-bins 1

in default it stratified SNPs by 72 functional categories specified by the baselineLD model v.2.0.

Could you give me some advice about running unstratified MESC?

Thanks, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243910158, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE4MIULMP65IXBNWMK3V55DWLANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Thanks a lot. I understood what you mean. If I want to run MESC with only one SNP bin (I know --num-bins 1 for only one gene bin), how should I set the parameter? I want to see the size of bias.

Thanks, Nayang

douglasyao commented 2 years ago

Hi Nayang,

I see what you're trying to do now, my apologies. If you want to set only one SNP bin, I think that --ref-ld-keep-annot 'baseL2' should work. If it doesn't, then let me know.

-Doug

On Mon, Sep 12, 2022 at 11:47 AM 2016young @.***> wrote:

Hi Doug,

Thanks a lot. I understood what you mean. If I want to run MESC with only one SNP bin (I know --num-bins 1 for only one gene bin), how should I set the parameter? I want to see the size of bias.

Thanks, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243936385, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE6WIQLYMDJ2GG7WXOTV55GCLANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Thanks a lot for your nice advice. --ref-ld-keep-annot 'baseL2' works. Thanks a lot for your suggestions about using MESC. Really appreciate for your patience.

Best, Nayang

douglasyao commented 2 years ago

Glad to help!

On Mon, Sep 12, 2022 at 12:12 PM 2016young @.***> wrote:

Hi Doug,

Thanks a lot for your nice advice. --ref-ld-keep-annot 'baseL2' works. Thanks a lot for your suggestions about using MESC. Really appreciate for your patience.

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243968562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE7G74PZIVP32ALJUVDV55I5VANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Sorry to trouble you again. I want to confirm with you about the equation (3) in the Methods part in the manuscript of MESC paper. I think it should contain LD score term like the equation (5) on Page 4 of Supplementary Information for “Quantifying genetic effects on disease mediated by assayed gene expression levels”.

Could you give me some advice? Thanks so much.

Best, Nayang

douglasyao commented 2 years ago

Hi Nayang,

Equation (3) in the main text Methods assumes that causal GWAS and eQTL effect sizes are known (i.e. there is no LD), which are not obtainable in practice. We can only measure the marginal GWAS/eQTL effect size of a given SNP, which is essentially the sum of the causal effect sizes of all SNPs around the given SNP weighted by their LD with the SNP. MESC handles the presence of LD by including an LD score term, which produces the equation in the supplementary data.

-Doug

On Mon, Sep 12, 2022 at 12:33 PM 2016young @.***> wrote:

Hi Doug,

Sorry to trouble you again. I want to confirm with you about the equation (3) in the Methods part in the manuscript of MESC paper. I think it should contain LD score term like the equation (5) on Page 4 of Supplementary Information for “Quantifying genetic effects on disease mediated by assayed gene expression levels”.

Could you give me some advice? Thanks so much.

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1243994664, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE7YBTNKT7IEZO6FOILV55LNXANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you modified the open/close state.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

I got it. Thanks so much for your interpretation. Really appreciate your patience!

Best, Nayang

douglasyao commented 2 years ago

No problem. Glad to help!

On Mon, Sep 12, 2022 at 10:07 PM 2016young @.***> wrote:

Hi Doug,

I got it. Thanks so much for your interpretation. Really appreciate your patience!

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1244805744, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE67TKDTZ2N5XSBW3NDV57OVJANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you modified the open/close state.Message ID: @.***>

douglasyao commented 2 years ago

Hi Nayang,

--num-bins and --ref-ld-keep-annot are two flags that should basically never be used (except for testing the method). There are detailed instruction on how to use the method in the Github wiki page: https://github.com/douglasyao/mesc/wiki

Thanks!

On Thu, Sep 8, 2022 at 5:01 AM 2016young @.***> wrote:

Hi Doug,

Thanks a lot for your prompt reply! I want to run unstratified MESC. I can not succeed in setting the parameter: --ref-ld-keep-annot to achieve unstratified MESC.

The code is ./run_mesc.py --h2med E66.sumstats.gz --out E66 --exp ./exp/met_plasma.1 --num-bins 1 --ref-ld-keep-annot NULL

which gives the errors:

Traceback (most recent call last): File "./run_mesc.py", line 260, in sumstats.estimate_h2med(args, log) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 311, in estimate_h2med args, log, args.h2med) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 292, in _read_ld_sumstats M_annot, ref_ld, novar_cols = _check_variance(log, M_annot, ref_ld) File "/public1/home/scg1508/project/mwas/mesc/mesc/sumstats.py", line 254, in _check_variance raise ValueError('All LD Scores have zero variance.') ValueError: All LD Scores have zero variance.

Thanks a lot and looking forward to your suggestions!

Best, Nayang

— Reply to this email directly, view it on GitHub https://github.com/douglasyao/mesc/issues/9#issuecomment-1240433734, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEWPKE3GXFWQWBQAX4FXHJ3V5GTPBANCNFSM6AAAAAAQGW3AJ4 . You are receiving this because you commented.Message ID: @.***>

2016young commented 2 years ago

Hi Doug,

Thanks a lot for your nice reminding. Really appreciate your patience!

Best, Nayang