andersen-lab / Freyja

Depth-weighted De-Mixing
BSD 2-Clause "Simplified" License
102 stars 29 forks source link

Freyja plot help #196

Closed ADY-PANDA closed 7 months ago

ADY-PANDA commented 8 months ago

Hello everyone,

I am using Freyja tool for plotting my data .

I am using this command

freyja plot [aggregated-filename-tsv] --output [plot-filename(.pdf,.png,etc.)]

which generate this plot

image

When I use this with my data :

freyja plot aggregated_output.tsv --output pin5.pdf --times date.csv --interval D --windowsize 100

This is the plot I got :

image

I want all date to be printed but its showing 15 days interval data. also the plot is not looking neat. I have 60 samples , sample ID is uniqe but date is repeated for the samples.

When I am normally Plotting the data using this command : freyja plot [aggregated-filename-tsv] --output [plot-filename(.pdf,.png,etc.)]

This is the plot I got, it is showing data of 12 samples but I have 60 samples.

image

Please help on this .

Thank you.

joshuailevy commented 8 months ago

Hi @ADY-PANDA,

Sorry for the delay. Would it possible for you to share the aggregated output and metadata files that you're using here so we can help sort out what's going on? Feel free to send them via email to jolevy@scripps.edu if that's better.

Josh

ADY-PANDA commented 8 months ago

Hello @joshuailevy , I have sent you an email with the aggregated file and metadata . Please look into it and help me with it.

Thanks & Regards AP

joshuailevy commented 8 months ago

Hi! So it looks like the missing samples in your plots are just due to low genome coverage coverage in a bunch of the samples. You can change the --mincov parameter to handle this. Running freyja plot aggregated_output.tsv --times date.csv --output test.pdf --mincov 40 --interval D yields

test_panda.pdf

If you want to change the color scheme, that can be done using the --config option. Showing the date of every sample requires a bit more personalization that what we provide in this basic plotting function, and wiil likely also lead to overlapping labels. For a fully custom plot, this may be of interest: https://github.com/andersen-lab/Freyja/wiki/custom-plotting-tutorial

It is strange to see Delta in your samples assuming the dates are correct, but that's a separate quandary.

Josh

ChromatinLab commented 8 months ago

Hi, Thank you so much for solving my query. Yes, It is quite strange that I am getting Delta in my very recently sequenced samples. Is there any other analysis that I can do using Freyja pipeline !! I am very much worried about this delta variant. Is there any way that I can support and validate this result ? Please suggest me anything on this .

ChromatinLab commented 8 months ago

Hi! So it looks like the missing samples in your plots are just due to low genome coverage coverage in a bunch of the samples. You can change the --mincov parameter to handle this. Running freyja plot aggregated_output.tsv --times date.csv --output test.pdf --mincov 40 --interval D yields

test_panda.pdf

If you want to change the color scheme, that can be done using the --config option. Showing the date of every sample requires a bit more personalization that what we provide in this basic plotting function, and wiil likely also lead to overlapping labels. For a fully custom plot, this may be of interest: https://github.com/andersen-lab/Freyja/wiki/custom-plotting-tutorial

It is strange to see Delta in your samples assuming the dates are correct, but that's a separate quandary.

Josh

Hi, Is there a chance that this freyja tool gives omicron and delta separately rather than assigning Recombinant variant ? Suppose a lineage is a Recombinant of Delta and omicron, freyja gives me omicron and delta instead of Recombinant ????

joshuailevy commented 8 months ago

While possible, the sample you shared with me (freyja doesn't indicate that it contains Delta btw) seems to be quite good quality, and I wouldn't expect such large frequencies of Delta to show up if the sample doesn't actually have any Delta reads in it-- even if you're looking at a delta/omicron recombinant. You can certainly use the freyja covariants command to get physically linked mutations for lineage detection.

A bit of information on that if you're so inclined: https://github.com/andersen-lab/Freyja/wiki/cryptic-variants

joshuailevy commented 7 months ago

Closed because inactive- feel free to reopen if you still have questions!

Bhagyashri199 commented 4 months ago

Hello everyone,

I am using Freyja tool for plotting my data.

I am using this command

freyja plot aggregated-file.tsv --output plot2.png --times metadata.csv --interval D --mincov 20

And I am repeatedly getting below error:

/home/arc/miniconda3/lib/python3.11/site-packages/freyja/_cli.py:300: UserWarning: Parsing dates in %d/%m/%Y format when dayfirst=False (the default) was specified. Pass dayfirst=True or specify a format to silence this warning. pd.to_datetime(times_df['sample_collection_datetime']) Traceback (most recent call last): File "/home/arc/miniconda3/bin/freyja", line 10, in sys.exit(cli()) ^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1688, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/freyja/_cli.py", line 301, in plot makePlot_time(agg_df, lineages, times_df, interval, output, File "/home/arc/miniconda3/lib/python3.11/site-packages/freyja/utils.py", line 382, in makePlot_time df_abundances = df_abundances.append( ^^^^^^^^^^^^^^^^^^^^ File "/home/arc/miniconda3/lib/python3.11/site-packages/pandas/core/generic.py", line 6299, in getattr return object.getattribute(self, name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'DataFrame' object has no attribute 'append'. Did you mean: '_append'?

Please help on this .

Thank you.