cancerit / telomerecat

Telomerecat: The telomere computational analysis tool
GNU General Public License v3.0
20 stars 5 forks source link

Pysam collate error #32

Closed cwine closed 3 years ago

cwine commented 3 years ago

When I run the bam2length function I get the following errors. Not sure what should be done to handle them. Any help would be appreciated.

collate: unrecognized option '--no-PG'
Traceback (most recent call last):
  File "/bin/pysam_collate", line 8, in <module>
    sys.exit(thin_wrap())
  File "/lib/python3.7/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/lib/python3.7/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/lib/python3.7/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/lib/python3.7/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/lib/python3.7/site-packages/telomerecat/pysam_collate.py", line 26, in thin_wrap
    pysam.collate(*collate_opts)
  File "/lib/python3.7/site-packages/pysam/utils.py", line 75, in __call__
    stderr))
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=Usage: samtools collate [-Ou] [-o <name>] [-n nFiles] [-l cLevel] <in.bam> [<prefix>]\n\nOptions:\n      -O       output to samtools_stdout\n      -o       output file name (use prefix if not set)\n      -u       uncompressed BAM output\n      -f       fast (only primary alignments)\n      -r       working reads stored (with -f) [10000]\n      -l INT   compression level [1]\n      -n INT   number of temporary files [64]\n      --input-fmt-option OPT[=VAL]\n               Specify a single input file format option in the form\n               of OPTION or OPTION=VALUE\n      --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  <prefix> is required unless the -o or -O options are used.\n'
keiranmraine commented 3 years ago

I suspect an older version of pysam is in use not the expected version. Can you check you have pysam-0.16.0.1 or better? Sadly it looks like installing using into a clean environment will work (directly via pypi), there are some errors in requirement files that will be causing this via the existing docs. We've since fixed-up the pypi releases.

The following works correctly:

$ python3 -m venv venv
tmp$ source venv/bin/activate
(venv) tmp$ pip3 install telomerecat
...
Successfully installed argparse-1.4.0 click-8.0.1 numpy-1.21.1 pandas-1.3.1 parabam-3.0.1 pysam-0.16.0.1 python-dateutil-2.8.2 pytz-2021.1 six-1.16.0 telomerecat-4.0.0

To be corrected:

cwine commented 3 years ago

Thank you for your response! I was using pysam 0.15.3 because when I used version 0.16.0.1 I got an error where the script continuously threw errors about not finding an index file, which is the same problem in issue #14.

That issue was resolved by reverting back to 0.15.3 which is what I did. Not sure how to break the cycle between these two versions now.

keiranmraine commented 3 years ago

The issue with warnings (they are warnings, not errors) about lack of index file should not be present in telomerecat >=4.0.0. It's possible some file opens were missed but I'm not seeing this in my local execution.