AmpliconSuite / AmpliconSuite-pipeline

A quickstart tool for AmpliconArchitect. Performs all preliminary steps (alignment, CNV calling, seed interval detection) required prior to running AmpliconArchitect. Previously called PrepareAA.
Other
48 stars 25 forks source link

Add custom samtools #37

Closed solo7773 closed 1 year ago

solo7773 commented 1 year ago

Argument samtools_path is added and tested in centos 7 and PBS computation cluster.

jluebeck commented 1 year ago

Hi Nan, thank you for this. I would like to add it with some minor changes. Would you please be able to instead make this PR against the unstable_dev branch?

It is also worth noting that samtools is also invoked in PrepareAA.py itself, and so the samtools path should be referenced there as well (see the bwa step and also the bam indexing step), so updating the path to executable once at the very start would be best (instead of checking whether the user gave it each time).

Secondly, we cannot guarantee that user will actually provide a path to the samtools binary, instead of a path to the directory where the binary is stored. I'd suggest replacing the check in your PR withe following one-time check, performed once, shortly after the args are parsed:

# first make the args.samtools_path default arg an empty string.

if not args.samtools_path.endswith("/samtools"):
  if args.samtools_path and not args.samtools_path.endswith("/"):
    args.samtools_path+="/"

 samtools_path+="samtools"

then args.samtools_path will either be the user specified path (set to the executable), or if it is empty it just becomes samtools. args.samtools_path can then be used wherever samtools is called in PrepareAA (the bwa stage, the bam file indexing, and in check_reference.py).