Skip to content

How to resolve NameError: name 'pysam' is not defined? #413

@Stevenleizheng

Description

@Stevenleizheng

When i use this tool named CheckM, i have an issue that NameError: name 'pysam' is not defined. The detail error is seen below:

Unexpected` error: <class 'NameError'>
Traceback (most recent call last):
  File "/home/xxx/mambaforge/envs/menzmap/bin/checkm", line 856, in <module>
    checkmParser.parseOptions(args)
  File "/home/xxx/mambaforge/envs/menzmap/lib/python3.8/site-packages/checkm/main.py", line 1013, in parseOptions
    self.coverage(options)
  File "/home/xxx/mambaforge/envs/menzmap/lib/python3.8/site-packages/checkm/main.py", line 746, in coverage
    coverage.run(binFiles, options.bam_files, options.output_file, options.all_reads,
  File "/home/xxx/mambaforge/envs/menzmap/lib/python3.8/site-packages/checkm/coverage.py", line 91, in run
    coverageInfo[bamFile] = self._processBam(bamFile, bAllReads, minAlignPer, maxEditDistPer, minQC, coverageInfo[bamFile])
  File "/home/xxx/mambaforge/envs/menzmap/lib/python3.8/site-packages/checkm/coverage.py", line 131, in _processBam
    bamfile = pysam.Samfile(bamFile, 'rb')
NameError: name 'pysam' is not defined

This error is belong to the software of checkm. I will address this issue if i add a command named import pysam into the head of /home/xxx/mambaforge/envs/menzmap/lib/python3.8/site-packages/checkm/coverage.py file and then delete original command import pysam. I'd like to understand the reasoning behind this—could the author possibly modify this part of the code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions