Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dependency conflicts and "NameError: name 'var' is not defined" error with biastools --analyze command #11

Open
g0ddengr opened this issue Mar 11, 2025 · 2 comments

Comments

@g0ddengr
Copy link

I was unable to install the required dependency bcftools=1.9 because of the following conflicts. Instead, bcftools=1.10.2 was installed instead. This may or may not relate to the error that follows.

Could not solve for environment specs
The following packages are incompatible
├─ bcftools =1.9 * is installable with the potential options
│ ├─ bcftools 1.9 would require
│ │ └─ htslib >=1.9,<1.10.0a0 * with the potential options
│ │ ├─ htslib 1.9, which can be installed;
│ │ └─ htslib 1.9 would require
│ │ └─ libdeflate >=1.0,<1.1.0a0 *, which conflicts with any installable versions previously reported;
│ └─ bcftools 1.9 would require
│ └─ libdeflate >=1.0,<1.1.0a0 *, which conflicts with any installable versions previously reported;
└─ samtools =1.11 * is not installable because it requires
└─ htslib >=1.11,<1.22.0a0 *, which conflicts with any installable versions previously reported.

I encountered errors when running the biastools --analyze command with tutorial data. All other commands in the run.sh tutorial script worked. How can I fix this?

$ biastools --analyze -g grch38_chr20_part.fa -v HG002.chr20.part.vcf.gz -s HG002_part -r tutorial
[Biastools] Analyze and plot...
[Biastools] Intersect the bam file and vcf file
[Biastools] Reference bias analysis
start initializing chr20
INFO:main:Start building the variant maps...
INFO:main:Start comparing reads to the variant map...
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/apps/biastools/0.2.0/lib/python3.9/multiprocessing/pool.py", line 48, in mapstar
return list(map(*args))
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 736, in analyze_read
return analyzer.analyze()
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 46, in analyze
self.compare_reads_to_variants()
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 287, in compare_reads_to_variants
self.process_read(segment)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 394, in process_read
if (seq_name, flag_read_n) in self.dict_ref_var_name[ref_name][var.start][1]: # check if the read name is in the golden set
NameError: name 'var' is not defined
"""

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 805, in
main()
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/ref_bi_context.py", line 799, in main
result = pool.map(analyze_read, list_info)
File "/apps/biastools/0.2.0/lib/python3.9/multiprocessing/pool.py", line 364, in map
return self._map_async(func, iterable, mapstar, chunksize).get()
File "/apps/biastools/0.2.0/lib/python3.9/multiprocessing/pool.py", line 771, in get
raise self._value
NameError: name 'var' is not defined
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/golden_graph_report.py", line 190, in
df_use = pd.read_csv(fn_bias, sep='\t')
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1620, in init
self._engine = self._make_engine(f, self.engine)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
self.handles = get_handle(
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/common.py", line 873, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'out_dir/tutorial_report/HG002_part.tutorial.sim.bias.SNP'
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/golden_graph_report.py", line 190, in
df_use = pd.read_csv(fn_bias, sep='\t')
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1620, in init
self._engine = self._make_engine(f, self.engine)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
self.handles = get_handle(
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/common.py", line 873, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'out_dir/tutorial_report/HG002_part.tutorial.sim.bias.gap'
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/golden_graph.py", line 296, in
df_use = pd.read_csv(fn_bias, sep='\t')
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1620, in init
self._engine = self._make_engine(f, self.engine)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
self.handles = get_handle(
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/common.py", line 873, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'out_dir/tutorial_report/HG002_part.tutorial.sim.bias.SNP'
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/golden_graph.py", line 296, in
df_use = pd.read_csv(fn_bias, sep='\t')
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1026, in read_csv
return _read(filepath_or_buffer, kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 620, in _read
parser = TextFileReader(filepath_or_buffer, **kwds)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1620, in init
self._engine = self._make_engine(f, self.engine)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/parsers/readers.py", line 1880, in _make_engine
self.handles = get_handle(
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/pandas/io/common.py", line 873, in get_handle
handle = open(
FileNotFoundError: [Errno 2] No such file or directory: 'out_dir/tutorial_report/HG002_part.tutorial.sim.bias.gap'
Traceback (most recent call last):
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/indel_balance_plot.py", line 178, in
assign_report = read_bias_report(fn_assign_report)
File "/apps/biastools/0.2.0/lib/python3.9/site-packages/biastools/indel_balance_plot.py", line 14, in read_bias_report
f = open(fn_bias_report, 'r')
FileNotFoundError: [Errno 2] No such file or directory: 'out_dir/tutorial_report/HG002_part.tutorial.sim.bias.all'

@maojanlin
Copy link
Owner

Hi @g0ddengr , thanks for catching this. It was a bug in the script ref_bi_context.py, which I've now fixed in both GitHub and PyPi package. Please try the updated version--it should work as expected. Also, bcftools version 1.10.2 should work fine. Let me know if you run into other issues!

@g0ddengr
Copy link
Author

Thank you for the quick work and update. I ran the tutorial data with the new installation (v.0.2.1) and generated the expected output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants