CGATOxford / UMI-tools

Tools for handling Unique Molecular Identifiers in NGS data sets
MIT License
491 stars 190 forks source link

umi_tools dedup fails with old pysam #444

Closed sunnymouse25 closed 1 year ago

sunnymouse25 commented 4 years ago

Hello! After updating umi_tools from 1.0.1 to 1.1.0 the dedup program fails with an error:

sort: unrecognized option '--no-PG'
Traceback (most recent call last):
  File "/cludisk/Projects/Testing/Chromatest/workflow/.snakemake/conda/4046b958/bin/umi_tools", line 11, in <module>
    sys.exit(main())
  File "/cludisk/Projects/Testing/Chromatest/workflow/.snakemake/conda/4046b958/lib/python3.6/site-packages/umi_tools/umi_tools.py", line 61, in main
    module.main(sys.argv)
  File "/cludisk/Projects/Testing/Chromatest/workflow/.snakemake/conda/4046b958/lib/python3.6/site-packages/umi_tools/dedup.py", line 373, in main
    pysam.sort("-o", sorted_out_name, "-O", sort_format, "--no-PG", out_name)
  File "/cludisk/Projects/Testing/Chromatest/workflow/.snakemake/conda/4046b958/lib/python3.6/site-packages/pysam/utils.py", line 75, in __call__
    stderr))
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=Usage: samtools sort [options...] [in.bam]\nOptions:\n  -l INT     Set compression level, from 0 (uncompressed) to 9 (best)\n  -m INT     Set maximum memory per thread; suffix K/M/G recognized [768M]\n  -n         Sort by read name\n  -t TAG     Sort by value of TAG. Uses position as secondary index (or read name if -n is set)\n  -o FILE    Write final output to FILE rather than standard output\n  -T PREFIX  Write temporary files to PREFIX.nnnn.bam\n      --input-fmt-option OPT[=VAL]\n               Specify a single input file format option in the form\n               of OPTION or OPTION=VALUE\n  -O, --output-fmt FORMAT[,OPT[=VAL]]...\n               Specify output format (SAM, BAM, CRAM)\n      --output-fmt-option OPT[=VAL]\n               Specify a single output file format option in the form\n               of OPTION or OPTION=VALUE\n      --reference FILE\n               Reference sequence FASTA FILE [null]\n  -@, --threads INT\n               Number of additional threads to use [0]\n'

Updating pysam from 0.15.3 to 0.16.0.1 fixes this error. Please correct requirements.txt.

TomSmithCGAT commented 4 years ago

Thanks for raising this. It's now been rectified on the master branch. I'll issue a version bump so it's covered in pypi & bioconda too

karl616 commented 3 years ago

I have this problem with version 1.1.1 as well.

IanSudbery commented 3 years ago

Hi Karl,

Are you installing from bioconda? If so, this is probably because they didn't pick up on the dependency change, and haven't yet fixed it.

I've raise an issue on their github (https://github.com/bioconda/bioconda-recipes/issues/25653) , but we'll have to wait for them to fix it.

karl616 commented 3 years ago

That is correct. I'll add the dependencies explicitly in my environment. That will work for now

FYI; BioConda being a community project, it is very easy to provide a PR. And after being accepted as a contributor, you can even control the addition... They seem to have taken that further since I was active: https://bioconda.github.io/contributor/updating.html

jmarshall commented 3 years ago

In my experience, bioconda don't pay a lot of attention to their issues — so you'll likely be waiting a long time for them to fix it. OTOH they generally quickly review and apply PRs you make yourselves, which in this case is fairly easy: it just needs to adjust the dependency and bump build number in _recipes/umitools/meta.yaml.

TomSmithCGAT commented 3 years ago

Done: #25710.

Let's leave the issue open until the above is merged though.

TomSmithCGAT commented 3 years ago

The bioconda PR has been been merged so this issue should be fully resolved now.

shangguandong1996 commented 3 years ago

The default pysam version is still pysam-0.15.3 when using conda install umitools

IanSudbery commented 3 years ago

Unfortunately you can't remove old builds from bioconda. There is a new build which specifies this dependency, but it seems for some reason that conda picks up the old build. I need to query this with the bioconda team.

IanSudbery commented 3 years ago

Okay, I'm wrong(ish). The bioconda team are going to move the broken build (build 0) to the their "broken" channel, which means it shouldn't be available for normal installations. This change has been made and will take about an hour to percolate through the CDN.

BTW mamba gets the right build of umi_tools and pysam right off the bat.