Cloufield / gwaslab

A Python package for handling and visualizing GWAS summary statistics. https://cloufield.github.io/gwaslab/
GNU General Public License v3.0
119 stars 22 forks source link

Plotting multiple results in one plot #24

Closed soumickmj closed 1 year ago

soumickmj commented 1 year ago

Hi @Cloufield Sorry for yet another question!

We are trying to create a single plot using results from 15 different phenotypes. The results obtained from regenie, I merged them like this:

dfs = [] for key, df in processed_hits.items(): df['Ph'] = key
df['ID_Ph'] = df['ID'].astype(str) + ' (' + key + ')' dfs.append(df) merged_df = pd.concat(dfs, ignore_index=True)

Then, mysumstats = gl.Sumstats(merged_df, fmt="regenie", other=['Ph', 'ID_Ph'], verbose=False) mysumstats.fill_data(to_fill=["P"], verbose=False) mysumstats.check_sanity(verbose=False)

When I'm plotting after this using: mysumstats.plot_mqq(sig_level=sig_level, sig_line_color="blue", suggestive_sig_line=True, suggestive_sig_level=corrected_sig_level, suggestive_sig_line_color="red", anno=True, verbose=False) I'm ending up with a plot only containing the combined hits, but not the rest of the manhatten plot. I guess, this is because of repeatative nature of the data as in few cases, multiple phenotypes gave same hits. We had 64 rows in the merged dataframe, but 49 unique SNPIDs. Any idea how to solve this issue?

image

Thank you so much :)

Cloufield commented 1 year ago

Hi, Sorry that I didn't really get the question. It seems that the code worked expectedly. On chromosome 2/3, there might be some hits (the same one or close to each other). Could you please describe the plot you want to create and how it is different from the current plot? Thanks.

soumickmj commented 1 year ago

It was my mistake. It works perfectly. Sorry to bother you and thanks for your help.