JonJala / mtag

Python command line tool for Multi-Trait Analysis of GWAS (MTAG)
GNU General Public License v3.0
173 stars 55 forks source link

How can MTAG output N column in the meta-analysis #162

Open Biajibiabia opened 2 years ago

Biajibiabia commented 2 years ago

Hello~ We are performing meta-analysis with mtag but get an output file without the N column. Is there any setting we can obtain it? The MTAG codes are listed as follows:

./mtag.py \ --force \ --equal-h2 \ --se-name SE \ --stream-stdout \ --n-name N \ --n-min 0.0 \ --perfect-gencov \ --snp-name SNP \ --use-beta-se \ --sumstats file1,file2 \ --beta-name BETA \ --out ./mtag_results

Thanks, any reply would be greatly appreciated!

paturley commented 2 years ago

Hello! I believe that the the log file has a table that includes a columns corresponding to "GWAS-equivalent N". Are you able to find that table in the log file?

Biajibiabia commented 2 years ago

Yes, there are two "GWAS equiv. (max) N" columns in the log file. Should we use the "GWAS equiv. (max) N" as the N column output of MTAG meta analysis? If so, which "GWAS equiv. (max)" N should be used for our meta results file? (Only one meta output file was obatined from the MTAG) what is the difference between the two GWAS equiv. (max) N for file1 and file 2? Thanks for your time!

lpgilchrist commented 2 years ago

Hi,

Apologies to jump in on this thread, but I am also interested as to which of the "GWAS equiv. (max) N" (if either) should be used in downstream analyses with MTAG meta-analysis outputs (for example if using tag meta-analysis outputs for polygenic risk scores etc)?

Thanks for your help, Lachlan

paturley commented 2 years ago

Apologies for the delayed response here. My hands have been quite full.

Do you mind sending me a copy of the log file? That may help me know how to respond.

On Wed, Sep 7, 2022 at 11:40 AM lpgilchrist @.***> wrote:

Hi,

Apologies to jump in on this thread, but I am also interested as to which of the "GWAS equiv. (max) N" (if either) should be used in downstream analyses with MTAG meta-analysis outputs (for example if using tag meta-analysis outputs for polygenic risk scores etc)?

Thanks for your help, Lachlan

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-1239561058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5J3Y4S44W5QT4MGMILV5CZOBANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.***>

Biajibiabia commented 2 years ago

Apologies for the delayed response here. My hands have been quite full. Do you mind sending me a copy of the log file? That may help me know how to respond. On Wed, Sep 7, 2022 at 11:40 AM lpgilchrist @.> wrote: Hi, Apologies to jump in on this thread, but I am also interested as to which of the "GWAS equiv. (max) N" (if either) should be used in downstream analyses with MTAG meta-analysis outputs (for example if using tag meta-analysis outputs for polygenic risk scores etc)? Thanks for your help, Lachlan — Reply to this email directly, view it on GitHub <#162 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5J3Y4S44W5QT4MGMILV5CZOBANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.>

Thanks for your reply, here is the log file:

Calling ./mtag.py --force --equal-h2 --z-name Z --p-name P --bpos-name BP --stream-stdout --n-name N --a2-name A2 --n-min 0.0 --perfect-gencov --a1-name A1 --snp-name SNP --chr-name CHR --eaf-name A1FREQ --sumstats trait1.txt,trait2.txt --out ./results/trait12

2022/07/24/12:40:18 PM Beginning MTAG analysis... 2022/07/24/12:40:18 PM MTAG will use the Z column for analyses. 2022/07/24/12:41:18 PM Read in Trait 1 summary statistics (28342898 SNPs) from trait1.txt ... 2022/07/24/12:41:18 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:41:18 PM Munging Trait 1 <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><>< 2022/07/24/12:41:18 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:41:18 PM Interpreting column names as follows: 2022/07/24/12:41:18 PM N: Sample size A1: a1, interpreted as ref allele for signed sumstat. P: p-Value A2: a2, interpreted as non-ref allele for signed sumstat. SE: Standard errors of BETA coefficients SNP: Variant ID (e.g., rs number) Z: Directional summary statistic as specified by --signed-sumstats. A1FREQ: Allele frequency

2022/07/24/12:41:20 PM Reading sumstats from provided DataFrame into memory 10000000 SNPs at a time. 2022/07/24/12:41:28 PM WARNING: 46992 SNPs had FRQ outside of [0,1]. The FRQ column may be mislabeled. 2022/07/24/12:41:47 PM WARNING: 40263 SNPs had FRQ outside of [0,1]. The FRQ column may be mislabeled. 2022/07/24/12:42:02 PM WARNING: 38887 SNPs had FRQ outside of [0,1]. The FRQ column may be mislabeled. 2022/07/24/12:42:22 PM Read 28342898 SNPs from --sumstats file. Removed 214238 SNPs with missing values. Removed 0 SNPs with INFO <= None. Removed 20443901 SNPs with MAF <= 0.01. Removed 0 SNPs with SE <0 or NaN values. Removed 0 SNPs with out-of-bounds p-values. Removed 0 variants that were not SNPs. Note: strand ambiguous SNPs were not dropped. 7684759 SNPs remain. 2022/07/24/12:42:31 PM Removed 5482 SNPs with duplicated rs numbers (7679277 SNPs remain). 2022/07/24/12:42:32 PM Removed 0 SNPs with N < 0.0 (7679277 SNPs remain). 2022/07/24/12:42:43 PM Median value of SIGNED_SUMSTAT was -0.00739130434783, which seems sensible. 2022/07/24/12:42:44 PM Dropping snps with null values 2022/07/24/12:42:45 PM Metadata: 2022/07/24/12:42:46 PM Mean chi^2 = 1.062 2022/07/24/12:42:47 PM Lambda GC = 1.048 2022/07/24/12:42:47 PM Max chi^2 = 27.589 2022/07/24/12:42:47 PM 0 Genome-wide significant SNPs (some may have been removed by filtering). 2022/07/24/12:42:47 PM Conversion finished at Sun Jul 24 12:42:47 2022 2022/07/24/12:42:47 PM Total time elapsed: 1.0m:29.23s 2022/07/24/12:43:39 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:43:39 PM Munging of Trait 1 complete. SNPs remaining: 7712222 2022/07/24/12:43:39 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

2022/07/24/12:44:00 PM Trait 1: Dropped 32945 SNPs for duplicate values in the "snp_name" column 2022/07/24/12:44:26 PM Read in Trait 2 summary statistics (9455778 SNPs) from trait2.txt ... 2022/07/24/12:44:26 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:44:26 PM Munging Trait 2 <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><>< 2022/07/24/12:44:26 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:44:26 PM Interpreting column names as follows: 2022/07/24/12:44:26 PM N: Sample size A1: a1, interpreted as ref allele for signed sumstat. P: p-Value A2: a2, interpreted as non-ref allele for signed sumstat. A1FREQ: Allele frequency SNP: Variant ID (e.g., rs number) Z: Directional summary statistic as specified by --signed-sumstats. SE: Standard errors of BETA coefficients

2022/07/24/12:44:26 PM Reading sumstats from provided DataFrame into memory 10000000 SNPs at a time. 2022/07/24/12:44:46 PM Read 9455778 SNPs from --sumstats file. Removed 0 SNPs with missing values. Removed 0 SNPs with INFO <= None. Removed 240443 SNPs with MAF <= 0.01. Removed 0 SNPs with SE <0 or NaN values. Removed 0 SNPs with out-of-bounds p-values. Removed 828502 variants that were not SNPs. Note: strand ambiguous SNPs were not dropped. 8386833 SNPs remain. 2022/07/24/12:44:54 PM Removed 0 SNPs with duplicated rs numbers (8386833 SNPs remain). 2022/07/24/12:44:56 PM Removed 0 SNPs with N < 0.0 (8386833 SNPs remain). 2022/07/24/12:45:08 PM Median value of SIGNED_SUMSTAT was -0.0165390321158, which seems sensible. 2022/07/24/12:45:08 PM Dropping snps with null values 2022/07/24/12:45:09 PM Metadata: 2022/07/24/12:45:11 PM Mean chi^2 = 1.072 2022/07/24/12:45:11 PM Lambda GC = 1.007 2022/07/24/12:45:11 PM Max chi^2 = 443.1 2022/07/24/12:45:11 PM 2162 Genome-wide significant SNPs (some may have been removed by filtering). 2022/07/24/12:45:11 PM Conversion finished at Sun Jul 24 12:45:11 2022 2022/07/24/12:45:11 PM Total time elapsed: 45.32s 2022/07/24/12:45:33 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2022/07/24/12:45:33 PM Munging of Trait 2 complete. SNPs remaining: 8386833 2022/07/24/12:45:33 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

2022/07/24/12:46:00 PM Dropped 1162404 SNPs due to strand ambiguity, 6516873 SNPs remain in intersection after merging trait1 2022/07/24/12:46:26 PM Dropped 7685 SNPs due to inconsistent allele pairs from phenotype 2. 6160179 SNPs remain. 2022/07/24/12:46:31 PM Flipped the signs of of 1355501 SNPs to make them consistent with the effect allele orderings of the first trait. 2022/07/24/12:46:37 PM Dropped 0 SNPs due to strand ambiguity, 6160179 SNPs remain in intersection after merging trait2 2022/07/24/12:46:37 PM ... Merge of GWAS summary statistics complete. Number of SNPs: 6160179 2022/07/24/12:47:02 PM Using 6160179 SNPs to estimate Omega (0 SNPs excluded due to strand ambiguity) 2022/07/24/12:47:02 PM Estimating sigma.. 2022/07/24/12:48:17 PM Checking for positive definiteness .. 2022/07/24/12:48:17 PM Sigma hat: [[0.995 0.006] [0.006 0.885]] 2022/07/24/12:48:17 PM Mean chi^2 of SNPs used to estimate Omega is low for some SNPsMTAG may not perform well in this situation. 2022/07/24/12:48:17 PM Beginning estimation of Omega ... 2022/07/24/12:48:18 PM --perfect_gencov and --equal_h2 option used 2022/07/24/12:48:18 PM Completed estimation of Omega ... 2022/07/24/12:48:18 PM Beginning MTAG calculations... 2022/07/24/12:48:56 PM ... Completed MTAG calculations. 2022/07/24/12:48:56 PM With meta-analysis mode, MTAG produces a single set of sumstats, where betas are unstandardized using 2p(1-p) where p is the average allele frequencies across traits. 2022/07/24/12:48:57 PM Writing Meta-analysis results to file ... 2022/07/24/12:49:36 PM Summary of MTAG results: Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...trait1.txt 6160179 408149 408149 1.067 1.082 494902 2 ...trait2.txt 6160179 184305 184305 1.221 1.082 68084 Omega hat not computed because --equal_h2 was used.

Estimated Sigma: [[0.995 0.006] [0.006 0.885]]

(Correlation): [[1. 0.007] [0.007 1. ]]

MTAG weight factors: (average across SNPs) [1. 1.]

The question is, the MTAG only output one file for meta-analysis, which "GWAS equiv. (max) N" should be used for subsequent snalysis.

Many thanks! Bia

lpgilchrist commented 2 years ago

Hi

Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)?

Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534

2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785

paturley commented 2 years ago

Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns.

I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula

N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2)

where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size.

There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think.

On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.***> wrote:

Hi

Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)?

`` Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785

``

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.***>

lpgilchrist commented 2 years ago

Hi,

Thanks so much for taking the time to look over this and for providing the weighting formula a GWAS equivalent N for this type of meta-analysis in MTAG – that makes a lot of sense.

Will calculate GWAS equiv N in this way prior to any downstream analyses.

Thanks again,

Lachlan

Biajibiabia commented 2 years ago

Hello Patrick,

Thanks for your time, that helps a lot.

Best, Bia

paturley commented 2 years ago

Hello! I believe that the the log file has a table that includes a columns corresponding to "effective N". Are you able to find that table in the log file?

On Tue, Jun 21, 2022 at 2:36 AM Biajibiabia @.***> wrote:

Hello~ We are performing meta-analysis with mtag but get an output file without the N column. Is there any setting we can obtain it? The MTAG codes are listed as follows:

./mtag.py --force --equal-h2 --se-name SE --stream-stdout --n-name N --n-min 0.0 --perfect-gencov --snp-name SNP --use-beta-se --sumstats file1,file2 --beta-name BETA --out ./mtag_results

Thanks, any reply would be greatly appreciated!

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

dqq0404 commented 8 months ago

Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.>

Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end?

paturley commented 7 months ago

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting.

On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.***> wrote:

Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.>

Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end?

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2031115732, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA . You are receiving this because you commented.Message ID: @.***>

dqq0404 commented 7 months ago

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting. On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 (comment) <#162 (comment)>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.> Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end? — Reply to this email directly, view it on GitHub <#162 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA . You are receiving this because you commented.Message ID: @.>

So can I use Ncontrols of one trait that before passed though MTAG as a constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases? For example, I have two traits for MTAG, both of them used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate N_effect for each SNP, after MTAG,I use your weighted formula :N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the N_effect of trait 2,and then I use the Ncontrols of trait2 that before passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 after MTAG analysis?

paturley commented 7 months ago

Yeah, I was picturing something like that. Your have to explain the whole procedure in your online methods, but something like that sounds reasonable to me

On Sat, Apr 6, 2024, 12:00 AM dqq0404 @.***> wrote:

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting. … <#m6308687533215112691> On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 * N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 https://github.com/JonJala/mtag/issues/162 (comment) <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.> Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end? — Reply to this email directly, view it on GitHub <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-2031115732>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA . You are receiving this because you commented.Message ID: @.***>

So can I use Ncontrols of one trait that before passed though MTAG as a constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases? For example, I have two traits for MTAG, both of them used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate N_effect for each SNP, after MTAG,I use your weighted formula :N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the N_effect of trait 2,and then I use the Ncontrols of trait2 that before passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 after MTAG analysis?

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2040954992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5J2IXW7AJUJRPAVTLTY35XPVAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGA4TKNBZHEZA . You are receiving this because you commented.Message ID: @.***>

dqq0404 commented 7 months ago

Oh thanks!!! You helped me again! hhhhh

---- Replied Message ---- | From | @.> | | Date | 04/07/2024 02:54 | | To | JonJala/mtag @.> | | Cc | dqq0404 @.>, Comment @.> | | Subject | Re: [JonJala/mtag] How can MTAG output N column in the meta-analysis (Issue #162) |

Yeah, I was picturing something like that. Your have to explain the whole procedure in your online methods, but something like that sounds reasonable to me

On Sat, Apr 6, 2024, 12:00 AM dqq0404 @.***> wrote:

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting. … <#m6308687533215112691> On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 * N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 https://github.com/JonJala/mtag/issues/162 (comment) <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.> Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end? — Reply to this email directly, view it on GitHub <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-2031115732>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA . You are receiving this because you commented.Message ID: @.***>

So can I use Ncontrols of one trait that before passed though MTAG as a constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases? For example, I have two traits for MTAG, both of them used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate N_effect for each SNP, after MTAG,I use your weighted formula :N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the N_effect of trait 2,and then I use the Ncontrols of trait2 that before passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 after MTAG analysis?

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2040954992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5J2IXW7AJUJRPAVTLTY35XPVAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGA4TKNBZHEZA . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

dqq0404 commented 7 months ago

Hi,sorry to bother you again. When I used the weighted formula to calculate N_final, it was smaller than the original N which is one of my traits,and I wanted to use that trait to do follow-up analysis. So what can I do in this situation? Use the original N or GWAS equivalent N?

---- Replied Message ---- | From | @.> | | Date | 04/07/2024 02:54 | | To | JonJala/mtag @.> | | Cc | dqq0404 @.>, Comment @.> | | Subject | Re: [JonJala/mtag] How can MTAG output N column in the meta-analysis (Issue #162) |

Yeah, I was picturing something like that. Your have to explain the whole procedure in your online methods, but something like that sounds reasonable to me

On Sat, Apr 6, 2024, 12:00 AM dqq0404 @.***> wrote:

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting. … <#m6308687533215112691> On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 * N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 https://github.com/JonJala/mtag/issues/162 (comment) <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644>>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ . You are receiving this because you commented.Message ID: @.> Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end? — Reply to this email directly, view it on GitHub <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-2031115732>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA . You are receiving this because you commented.Message ID: @.***>

So can I use Ncontrols of one trait that before passed though MTAG as a constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases? For example, I have two traits for MTAG, both of them used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate N_effect for each SNP, after MTAG,I use your weighted formula :N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the N_effect of trait 2,and then I use the Ncontrols of trait2 that before passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 after MTAG analysis?

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2040954992, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5J2IXW7AJUJRPAVTLTY35XPVAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGA4TKNBZHEZA . You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

paturley commented 7 months ago

Can you post the log?

On Sun, Apr 7, 2024 at 3:29 AM dqq0404 @.***> wrote:

Hi,sorry to bother you again. When I used the weighted formula to calculate N_final, it was smaller than the original N which is one of my traits,and I wanted to use that trait to do follow-up analysis. So what can I do in this situation? Use the original N or GWAS equivalent N?

---- Replied Message ---- | From | @.> | | Date | 04/07/2024 02:54 | | To | JonJala/mtag @.> | | Cc | dqq0404 @.>, Comment @.> | | Subject | Re: [JonJala/mtag] How can MTAG output N column in the meta-analysis (Issue #162) |

Yeah, I was picturing something like that. Your have to explain the whole procedure in your online methods, but something like that sounds reasonable to me

On Sat, Apr 6, 2024, 12:00 AM dqq0404 @.***> wrote:

The GWAS-equivalent N reported by MTAG just represents the "effective N" you'd need to obtain the same power in a GWAS. The effective N is a function of Ncases and Ncontrols, but there are several values for Ncases and Ncontrols that can obtain the same effective N in a case control study. If you wanted to make some comment about the effective N in a case-control paper though, I suppose you could back out what the Ncases would been to be (holding the Ncontrols constant) to obtain the same power. Might be interesting. … <#m6308687533215112691> On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. Sorry for the delayed response. This has been a puzzle to me and I've had to take some time to think about it. The GWAS equivalent N comes from comparing how much the mean chi2 increases before and after MTAG. It is a function of the estimated heritability, among other parameters. If the estimated heritability is different but MTAG is told to assume that the true heritability of the traits underlying each sample is the same, that can result in MTAG reporting different GWAS equivalent Ns. I think the right thing in this case would therefore be to use some weighted average of the two GWAS equivalent Ns. I think the simplest thing would be to use the original GWAS sample sizes as the weights, with the formula N_final = (N_pre,1 N_post,1 + N_pre,2 * N_post,2)/((N_pre,1 + N_pre,2) where N_pre,j is the sample size of each GWAS before passing it though MTAG and N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final is the sample size you could use in LDpred or other programs that ask for a sample size. There is probably a more sophisticated weighting that is more right, but I don't have the time to work it out, and this will be pretty close to the right thing, I think. … <#m513245907836364674> On Wed, Sep 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, essentially when using the --equal-h2 and --perfect-gencov flags to perform a meta-analysis accounting for sample overlap the log file contains two estimates of GWAS equiv. N (see below), but I was wondering which of these referred to the N of the single GWAS summary statistic file generated during the meta-analysis, or if the N for this analysis should be simply the sum of the N of the GWAS involved in the meta-analysis (for continuous traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 268785 — Reply to this email directly, view it on GitHub <#162 https://github.com/JonJala/mtag/issues/162 (comment) <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-1253414644>>, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ < https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ

https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ < https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ

. You are receiving this because you commented.Message ID: @.> Hi Patrick, This question may be a bit simplistic, but I still want to confirm it. Does N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate how many Ncases and Ncontrols there are at the end? — Reply to this email directly, view it on GitHub <#162 (comment) https://github.com/JonJala/mtag/issues/162#issuecomment-2031115732>, or unsubscribe

https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA < https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA

. You are receiving this because you commented.Message ID: @.***>

So can I use Ncontrols of one trait that before passed though MTAG as a constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases? For example, I have two traits for MTAG, both of them used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate N_effect for each SNP, after MTAG,I use your weighted formula :N_final = (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the N_effect of trait 2,and then I use the Ncontrols of trait2 that before passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 after MTAG analysis?

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2040954992, or unsubscribe < https://github.com/notifications/unsubscribe-auth/AFBUB5J2IXW7AJUJRPAVTLTY35XPVAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGA4TKNBZHEZA

. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

— Reply to this email directly, view it on GitHub https://github.com/JonJala/mtag/issues/162#issuecomment-2041349877, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5L26IHXLPTGPGMUPLDY4DYUXAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGEZTIOJYG43Q . You are receiving this because you commented.Message ID: @.***>

dqq0404 commented 7 months ago

Can you post the log? On Sun, Apr 7, 2024 at 3:29 AM dqq0404 @.> wrote: Hi,sorry to bother you again. When I used the weighted formula to calculate N_final, it was smaller than the original N which is one of my traits,and I wanted to use that trait to do follow-up analysis. So what can I do in this situation? Use the original N or GWAS equivalent N? ---- Replied Message ---- | From | @.> | | Date | 04/07/2024 02:54 | | To | JonJala/mtag @.> | | Cc | dqq0404 @.>, Comment @.> | | Subject | Re: [JonJala/mtag] How can MTAG output N column in the meta-analysis (Issue #162) | Yeah, I was picturing something like that. Your have to explain the whole procedure in your online methods, but something like that sounds reasonable to me On Sat, Apr 6, 2024, 12:00 AM dqq0404 @.> wrote: > The GWAS-equivalent N reported by MTAG just represents the "effective N" > you'd need to obtain the same power in a GWAS. The effective N is a > function of Ncases and Ncontrols, but there are several values for Ncases > and Ncontrols that can obtain the same effective N in a case control study. > If you wanted to make some comment about the effective N in a case-control > paper though, I suppose you could back out what the Ncases would been to be > (holding the Ncontrols constant) to obtain the same power. Might be > interesting. > … <#m6308687533215112691> > On Tue, Apr 2, 2024 at 1:34 AM dqq0404 @.> wrote: Hello both of you. > Sorry for the delayed response. This has been a puzzle to me and I've had > to take some time to think about it. The GWAS equivalent N comes from > comparing how much the mean chi2 increases before and after MTAG. It is a > function of the estimated heritability, among other parameters. If the > estimated heritability is different but MTAG is told to assume that the > true heritability of the traits underlying each sample is the same, that > can result in MTAG reporting different GWAS equivalent Ns. I think the > right thing in this case would therefore be to use some weighted average of > the two GWAS equivalent Ns. I think the simplest thing would be to use the > original GWAS sample sizes as the weights, with the formula N_final = > (N_pre,1 N_post,1 + N_pre,2 * N_post,2)/((N_pre,1 + N_pre,2) where > N_pre,j is the sample size of each GWAS before passing it though MTAG and > N_post,j is the "GWAS-equivalent N" that MTAG reports in the log. N_final > is the sample size you could use in LDpred or other programs that ask for a > sample size. There is probably a more sophisticated weighting that is more > right, but I don't have the time to work it out, and this will be pretty > close to the right thing, I think. … <#m513245907836364674> On Wed, Sep > 21, 2022 at 5:03 AM lpgilchrist @.> wrote: Hi Thanks for getting back, > essentially when using the --equal-h2 and --perfect-gencov flags to perform > a meta-analysis accounting for sample overlap the log file contains two > estimates of GWAS equiv. N (see below), but I was wondering which of these > referred to the N of the single GWAS summary statistic file generated > during the meta-analysis, or if the N for this analysis should be simply > the sum of the N of the GWAS involved in the meta-analysis (for continuous > traits anyway)? Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG > mean chi^2 GWAS equiv. (max) N 1 ...nge_for_MTAG.txt 8195131 153446 153446 > 1.137 1.167 187534 2 ...nge_for_MTAG.txt 8195131 143914 143914 1.090 1.167 > 268785 — Reply to this email directly, view it on GitHub <#162 > <#162> (comment) <#162 (comment) > <#162 (comment)>>>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ > < https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ > > https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ > < https://github.com/notifications/unsubscribe-auth/AFBUB5KMAI7JWEHFDNQYZ43V7LFODANCNFSM5ZLPF2JQ > > . You are receiving this because you commented.Message ID: @.> Hi Patrick, > This question may be a bit simplistic, but I still want to confirm it. Does > N_final represent N_effect or N_total(N_cases+N_controls)? Can I calculate > how many Ncases and Ncontrols there are at the end? — Reply to this email > directly, view it on GitHub <#162 (comment) > <#162 (comment)>>, or > unsubscribe > https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA > < https://github.com/notifications/unsubscribe-auth/AFBUB5OEA632MNJ5LIZYW5LY3I7OJAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBTGEYTCNJXGMZA > > . You are receiving this because you commented.Message ID: @.> > > So can I use Ncontrols of one trait that before passed though MTAG as a > constant and then using 4NcasesNcontrols/(Ncases+Ncontrols ) to > calculate the Ncases? For example, I have two traits for MTAG, both of them > used the formula : 4NcasesNcontrols/(Ncases+Ncontrols ) to calculate > N_effect for each SNP, after MTAG,I use your weighted formula :N_final = > (N_pre,1 N_post,1 + N_pre,2 N_post,2)/((N_pre,1 + N_pre,2) to get the > N_effect of trait 2,and then I use the Ncontrols of trait2 that before > passed though MTAG as a constant and use the equation 4NcasesNcontrols/(Ncases+Ncontrols > ) to calculate the Ncases of trait2. Can I use this Ncases for the trait2 > after MTAG analysis? > > — > Reply to this email directly, view it on GitHub > <#162 (comment)>, or > unsubscribe > < https://github.com/notifications/unsubscribe-auth/AFBUB5J2IXW7AJUJRPAVTLTY35XPVAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGA4TKNBZHEZA > > . > You are receiving this because you commented.Message ID: > @.> > — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.> — Reply to this email directly, view it on GitHub <#162 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFBUB5L26IHXLPTGPGMUPLDY4DYUXAVCNFSM5ZLPF2J2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TEMBUGEZTIOJYG43Q . You are receiving this because you commented.Message ID: @.>

2024/04/01/03:33:36 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <> <> MTAG: Multi-trait Analysis of GWAS <> Version: 1.0.8 <> (C) 2017 Omeed Maghzian, Raymond Walters, and Patrick Turley <> Harvard University Department of Economics / Broad Institute of MIT and Harvard <> GNU General Public License v3 <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> <> Note: It is recommended to run your own QC on the input before using this program. <> Software-related correspondence: jjala.ssgac@gmail.com <> All other correspondence: paturley@broadinstitute.org <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

Calling ./mtag.py \ --z-name Z \ --p-name pval \ --bpos-name BP \ --maf-min 0 \ --n-name N_effect \ --a2-name ref \ --n-min 0.0 \ --a1-name alt \ --snp-name SNP \ --chr-name CHR \ --eaf-name af_alt \ --sumstats trait1,trait2 \ --out .../mtag_result

2024/04/01/03:33:36 PM Beginning MTAG analysis... 2024/04/01/03:33:36 PM MTAG will use the Z column for analyses. 2024/04/01/03:34:47 PM Read in Trait 1 summary statistics (8367947 SNPs) ... 2024/04/01/03:34:47 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:34:47 PM Munging Trait 1 <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><>< 2024/04/01/03:34:47 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:34:47 PM Interpreting column names as follows: 2024/04/01/03:34:47 PM N_effect: Sample size af_alt: Allele frequency pval: p-Value SNP: Variant ID (e.g., rs number) alt: a1, interpreted as ref allele for signed sumstat. Z: Directional summary statistic as specified by --signed-sumstats. ref: a2, interpreted as non-ref allele for signed sumstat.

2024/04/01/03:34:48 PM Reading sumstats from provided DataFrame into memory 10000000 SNPs at a time. 2024/04/01/03:35:31 PM Read 8367947 SNPs from --sumstats file. Removed 0 SNPs with missing values. Removed 0 SNPs with INFO <= None. Removed 0 SNPs with MAF <= 0.0. Removed 0 SNPs with SE <0 or NaN values. Removed 0 SNPs with out-of-bounds p-values. Removed 0 variants that were not SNPs. Note: strand ambiguous SNPs were not dropped. 8367947 SNPs remain. 2024/04/01/03:35:45 PM Removed 0 SNPs with duplicated rs numbers (8367947 SNPs remain). 2024/04/01/03:35:48 PM Removed 0 SNPs with N < 0.0 (8367947 SNPs remain). 2024/04/01/03:39:00 PM Median value of SIGNED_SUMSTAT was -0.00375315085048, which seems sensible. 2024/04/01/03:39:00 PM Dropping snps with null values 2024/04/01/03:39:02 PM Metadata: 2024/04/01/03:39:05 PM Mean chi^2 = 1.163 2024/04/01/03:39:05 PM Lambda GC = 1.112 2024/04/01/03:39:05 PM Max chi^2 = 97.467 2024/04/01/03:39:05 PM 3398 Genome-wide significant SNPs (some may have been removed by filtering). 2024/04/01/03:39:05 PM Conversion finished at Mon Apr 1 15:39:05 2024 2024/04/01/03:39:05 PM Total time elapsed: 4.0m:18.21s 2024/04/01/03:39:43 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:39:43 PM Munging of Trait 1 complete. SNPs remaining: 8367947 2024/04/01/03:39:43 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

2024/04/01/03:41:16 PM Read in Trait 2 summary statistics (8367687 SNPs) ... 2024/04/01/03:41:16 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:41:16 PM Munging Trait 2 <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><>< 2024/04/01/03:41:16 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:41:16 PM Interpreting column names as follows: 2024/04/01/03:41:16 PM N_effect: Sample size af_alt: Allele frequency pval: p-Value SNP: Variant ID (e.g., rs number) alt: a1, interpreted as ref allele for signed sumstat. Z: Directional summary statistic as specified by --signed-sumstats. ref: a2, interpreted as non-ref allele for signed sumstat.

2024/04/01/03:41:17 PM Reading sumstats from provided DataFrame into memory 10000000 SNPs at a time. 2024/04/01/03:41:54 PM Read 8367687 SNPs from --sumstats file. Removed 0 SNPs with missing values. Removed 0 SNPs with INFO <= None. Removed 0 SNPs with MAF <= 0.0. Removed 0 SNPs with SE <0 or NaN values. Removed 0 SNPs with out-of-bounds p-values. Removed 0 variants that were not SNPs. Note: strand ambiguous SNPs were not dropped. 8367687 SNPs remain. 2024/04/01/03:42:09 PM Removed 0 SNPs with duplicated rs numbers (8367687 SNPs remain). 2024/04/01/03:42:12 PM Removed 0 SNPs with N < 0.0 (8367687 SNPs remain). 2024/04/01/03:45:35 PM Median value of SIGNED_SUMSTAT was -0.00237982454856, which seems sensible. 2024/04/01/03:45:35 PM Dropping snps with null values 2024/04/01/03:45:37 PM Metadata: 2024/04/01/03:45:40 PM Mean chi^2 = 1.27 2024/04/01/03:45:40 PM Lambda GC = 1.209 2024/04/01/03:45:40 PM Max chi^2 = 256.992 2024/04/01/03:45:40 PM 3324 Genome-wide significant SNPs (some may have been removed by filtering). 2024/04/01/03:45:40 PM Conversion finished at Mon Apr 1 15:45:40 2024 2024/04/01/03:45:40 PM Total time elapsed: 4.0m:24.01s 2024/04/01/03:46:19 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><> 2024/04/01/03:46:19 PM Munging of Trait 2 complete. SNPs remaining: 8367687 2024/04/01/03:46:19 PM <><><<>><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><><>

2024/04/01/03:47:14 PM Dropped 1299398 SNPs due to strand ambiguity, 7068549 SNPs remain in intersection after merging trait1 2024/04/01/03:48:14 PM Dropped 0 SNPs due to strand ambiguity, 7065416 SNPs remain in intersection after merging trait2 2024/04/01/03:48:14 PM ... Merge of GWAS summary statistics complete. Number of SNPs: 7065416 2024/04/01/03:49:04 PM Using 7065416 SNPs to estimate Omega (0 SNPs excluded due to strand ambiguity) 2024/04/01/03:49:04 PM Estimating sigma.. 2024/04/01/03:52:22 PM Checking for positive definiteness .. 2024/04/01/03:52:22 PM Sigma hat: [[1.037 0.56 ] [0.56 1.093]] 2024/04/01/03:52:23 PM Beginning estimation of Omega ... 2024/04/01/03:52:23 PM Using GMM estimator of Omega .. 2024/04/01/03:52:25 PM Checking for positive definiteness .. 2024/04/01/03:52:25 PM Completed estimation of Omega ... 2024/04/01/03:52:25 PM Beginning MTAG calculations... 2024/04/01/03:52:42 PM ... Completed MTAG calculations. 2024/04/01/03:52:42 PM Writing Phenotype 1 to file ... 2024/04/01/03:55:05 PM Writing Phenotype 2 to file ... 2024/04/01/03:57:29 PM Summary of MTAG results:

Trait # SNPs used N (max) N (mean) GWAS mean chi^2 MTAG mean chi^2 GWAS equiv. (max) N 1 ...her_filtered.txt 7065416 73432 73432 1.122 1.160 96395
2 ...ile_filtered.txt 7065416 219093 219093 1.163 1.174 234924

Estimated Omega: [[1.720e-06 1.037e-06] [1.037e-06 8.118e-07]]

(Correlation): [[1. 0.877] [0.877 1. ]]

Estimated Sigma: [[1.037 0.56 ] [0.56 1.093]]

(Correlation): [[1. 0.526] [0.526 1. ]]

MTAG weight factors: (average across SNPs) [1.326 0.952]

2024/04/01/03:57:29 PM
2024/04/01/03:57:29 PM MTAG results saved to file. 2024/04/01/03:57:29 PM MTAG complete. Time elapsed: 23.0m:53.5570230484s I wanted to use the trait2 to do the follow-up analysis,and used the weighted formula,the N_finnal was smaller than original N_eff of the trait2. I have used the original N_cases and N_controls of trait2 for follow-up analysis. Can I do this?