https://github.com/diriano/ploidyNGS Note that you will need a sorted bam file to run ploidyNGS Script for running a ploidyNGS analysis on perun #!/bin/bash\\ #$ -S /bin/bash\\ . /etc/profile\\ #$ -cwd source activate ploidyNGS-preq /scratch2/software/ploidyNGS/ploidyNGS.py \ -o outputfilename \ -b nameofsortedbamfile.bam conda deactivate Perun will immediately generate error messages that look dire if not fatal '' "fatal: not a git repository (or any parent up to mount point /misc) Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set)." '' This is the result of a python function defined by ploidyNGS to try to identify which version of the script you are running, but it typically doesn't work. You can safely ignore these and the program continues to run One of the options you will be interested in is ''-d'' or ''--max_depth'', which is set to 100 by default. Max number of reads kepth at each position in the reference genome (integer, default: 100) This sets the maximum read depth ''ploidyNGS.py'' will read until it moves on to the next alignment position. For example, if you have it set to a 100, but at position 123 you have actually 500 reads mapped, it will only load the basecalls of the first 100 reads to calculate allele frequencies from. I (Joran) found that it is pretty safe to increase this value to say 2000, to use as much information as possible. Examine the tab output file. In particular, if the lines for Third and Fourth contain almost all 0.00 then they should be removed from the tab file, otherwise they mess up the histogram. To see the sorted content of the Third and Fourth lines $ grep Fourth myoutput.tab | cut -f4 | sort -n $ grep Third myoutput.tab | cut -f4 | sort -n To remove lines containing "Third" and "Fourth" from the .tab file: $ grep -vP "Third|Fourth" myoutput.tab > mytabforhistogram.tab Once satisfied with the tab you need to make a PDF (it is suppose to generate it automatically but it doesn't) On the command line execute $ Rscript --vanilla /scratch2/software/ploidyNGS/ploidyNGS_generateHistogram.R mytabforhistogram.tab This will generate a PDF called ''NA'' which you can transfer to your home computer to look at. ==== UPDATE (June 2022) ==== I (Joran) have updated the ''ploidyNGS.py'' and ''ploidyNGS_generateHistogram.R'' scripts. They are available in Perun under the new names ''ploidyNGS_minCov.py'' and ''ploidyNGS_generateHistogram_minCov.R'', respectively. The main new feature is the ''--min_cov'' option, which is set to 0 by default. It allows the user to ignore positions that have a lower coverage than the specified value in its allele frequency calculations. This can be useful if you have mysterious 50%/50% or 33%/67% peaks in your histogram which is otherwise strongly hinting haploidy. In my experience these mysterious peaks can stem from low coverage regions with sequencing errors. For example, if you have a position that is covered twice, and one of them is an error, it will yield a 50%/50% peak even though there is no diploidy going on here. Other updates: * Positions reported in the .tab file are now 1-indexed (i.e. starting at 1) instead of 0-indexed (i.e. starting at 0) * If you have ''/scratch2/software/ploidyNGS/'' in your ''$PATH'', the updated Python script will properly execute the histogram R script without any issues. The PDF file will have a proper file name ending in .pdf, instead of the mysterious ''NA'' * The axis titles in the histogram will be a bit easier to understand * The script will now report the total number of heteromorphic positions per contig and over all contigs To call it, use a Perun submission script like this one #!/bin/bash #$ -S /bin/bash . /etc/profile #$ -cwd #$ -q 256G-batch source activate ploidyNGS-dependencies export PATH="/scratch2/software/ploidyNGS:$PATH" BAMFILE='dnaseq_vs_canu_ergo_assembly.sorted.bam' MINCOV=10 MAXDEPTH=2000 OUTBASE='dnaseq_vs_canu_ergo_assembly' ploidyNGS_minCov.py \ --out $OUTBASE \ --bam $BAMFILE \ --min_cov $MINCOV \ --max_depth $MAXDEPTH conda deactivate A more elaborate script is available on the GitHub repository of the Roger lab: https://github.com/RogerLab/gospel_of_andrew. The updated scripts are also available on the original GitHub repository https://github.com/diriano/ploidyNGS under the original script names ''ploidyNGS.py'' and ''ploidyNGS_generateHistogram.R''