DennisSchmitz / Jovian_archive

Metagenomics/viromics pipeline that focuses on automation, user-friendliness and a clear audit trail. Jovian aims to empower classical biologists and wet-lab personnel to do metagenomics/viromics analyses themselves, without bioinformatics expertise.
GNU Affero General Public License v3.0
18 stars 7 forks source link

draw_heatmaps: handle empty data (no contigs for given clade) #44

Closed samnooij closed 5 years ago

samnooij commented 5 years ago

As mentioned in #41, draw_heatmaps.py is not yet ready to handle empty data: Python will throw an error when trying to make a heatmap of nothing, and the pipeline stops.

I suggest to patch this with a small checker in the drawing function: if dataframe is empty: create an empty file and report to the log file (print warning) else (if dataframe has data): create heatmaps the normal way

Then perhaps later we can think of something more elegant to solve this.


I have tried running the draw_heatmaps script in the directory you were working in (/data/BioGrid/ERVINGS/Runs_Respiratory_MiSEQ_RIVM/MiSeq_RUN_06MAY2019/Jovian/) and learned a few things:

  1. the heatmap function is not ready for empty data. I.e. if there are no taxa in the clade that it is going to plot, the script will fail. In this case, there were no viral species, so the pipeline got stuck there.
  2. By filling in zeroes in otherwise empty (NaN) fields, the heatmap will fill in every single block with data and colour them in a very light shade, whereas before these fields were left empty/blank. I prefer the empty fields as that is the easiest way to tell the absence of certain taxa, I think.

So draw_heatmaps will require (at least) 2 fixes: 1. Check if dataframe is empty, and if so, better write an empty file and report in the log file. --PRIORITY

  1. Disable plotting for fields with 0 contigs. (Change 0 values back to NaN before plotting, I guess.)

Originally posted by @samnooij in https://github.com/DennisSchmitz/Jovian/issues/41#issuecomment-491704153

samnooij commented 5 years ago

Should be solved with https://github.com/DennisSchmitz/Jovian/commit/7c438f11917935ce71cb23f65d958abc3eab2ea9. Closing the issue.