fritzsedlazeck / Spectre

Copy number caller for long read data including SNV utilization
MIT License
44 stars 2 forks source link

Not providing a blacklist leads to stack trace #18

Closed mp15 closed 2 months ago

mp15 commented 2 months ago

Command line was:

spectre CNVCaller   --coverage mos_depth_out/WTSI-OESO_103.regions.bed.gz   --sample-id WTSI-OESO_103   --output-dir WTSI-OESO_103-spectre/   --reference /lustre/scratch126/casm/team154pc/mp15/resources/GCA_000001405.15_GRCh38_no_alt_analysis_set/GCA_000001405.15_GRCh38_no_alt_analysis_set.fa --metadata /lustre/scratch126/casm/team154pc/mp15/resources/GCA_000001405.15_GRCh38_no_alt_analysis_set/GCA_000001405.15_GRCh38_no_alt_analysis_set.mdr

Version: spectre-cnv==0.2.0

Environment: contourpy==1.2.1 cycler==0.12.1 fonttools==4.51.0 kiwisolver==1.4.5 matplotlib==3.7.1 numpy==1.24.3 packaging==24.0 pandas==2.0.1 pillow==10.3.0 pyparsing==3.1.2 pysam==0.22.0 python-dateutil==2.9.0.post0 pytz==2024.1 scipy==1.10.1 six==1.16.0 spectre-cnv==0.2.0 tzdata==2024.1

Error is:

spectre::2024-04-17 16:41:48,087::INFO::spectre.spectre>  Using existing metadata file /lustre/scratch126/casm/team154pc/mp15/resources/GCA_000001405.15_GRCh38_no_alt_analysis_set/GCA_000001405.15_GRCh38_no_alt_analysis_set.mdr
spectre::2024-04-17 16:41:48,093::INFO::spectre.spectreCNV>  Spectre calculating for: mos_depth_out/WTSI-OESO_103.regions.bed.gz
spectre::2024-04-17 16:41:48,094::INFO::spectre.spectreCNV>  Data normalization and outlier removal (right tail)
spectre::2024-04-17 16:41:48,508::INFO::spectre.analysis.analysis>  Determined bin size from Mosdepth coverage: 1000
Traceback (most recent call last):
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/bin/spectre", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/spectre.py", line 612, in main
    spectre_run.spectre_exe()
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/spectre.py", line 345, in spectre_exe
    spectre_main.cnv_call()
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/spectreCNV.py", line 87, in cnv_call
    self.cnv_analysis.data_normalization()
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/analysis/analysis.py", line 116, in data_normalization
    self.metadata = fm.load_metadata(mdr_file_path=self.metadata_path,
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/util/metadata/metadataCollector.py", line 144, in load_metadata
    blacklist_content = self.extract_blacklisted_regions(blacklist_file_path)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/lustre/scratch126/casm/team154pc/mp15/ont_duplex/tools/spectre-cnv.venv/lib/python3.11/site-packages/spectre/util/metadata/metadataCollector.py", line 198, in extract_blacklisted_regions
    path = os.path.abspath(os.path.expanduser(self.metadata_args.black_list))
                                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'black_list'

I worked around this by creating an empty blacklist containing just chrEBV.

philippesanio commented 2 months ago

Hi @mp15

Thank you for raising that issue. Did you install Spectre directly from pip or did you clone the repository and install it locally with pip? The latest version on GitHub has a fix that should address this issue (issue: #11, Commit: eb78bfe)

Install Spectre with the latest changes:

pip install build
git clone https://github.com/fritzsedlazeck/Spectre.git
cd ./Spectre
python3 -m build
pip install dist/spectre-cnv-<VERSION>.tar.gz # replace <VERSION> with e.g. 0.2.0

Please let me know if that helped.

Cheers, Philippe

mp15 commented 2 months ago

This was indeed from pip, was hoping that was the stable version :). You are indeed correct I have tested and the version in git resolves this issue.