fritzsedlazeck / Spectre

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

Spectre error #3

Closed adbeggs closed 1 year ago

adbeggs commented 1 year ago

Hi team,

I now have it up and running, but getting:

spectre::INFO> CNV-Metrics: DEL border:1.1658436259509548        DUP border:2.893058579172205
spectre::INFO> refining cnv calls
/Spectre/analysis/analysis.py:384: RuntimeWarning: invalid value encountered in scalar subtract
  scaf_cov - np.nanmedian(list(_cand.cov) + list(_cand_next.cov))
spectre::INFO> CNV candidates by SNV
spectre::INFO> Parsing VCF to BED file
/Spectre/util/vcf_parser.py:124: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  df_snps_chrom["startbin_"] = pd.cut(x=df_snps_chrom.start_, bins=bins, labels=labels,
/Spectre/util/vcf_parser.py:126: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame.
Try using .loc[row_indexer,col_indexer] = value instead

A lot... then it crashes out with:

spectre::INFO> Calculating CNV events based on SNV data
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File "/opt/conda/envs/spectre-env/lib/python3.10/multiprocessing/pool.py", line 125, in worker
    result = (True, func(*args, **kwds))
  File "/opt/conda/envs/spectre-env/lib/python3.10/multiprocessing/pool.py", line 48, in mapstar
    return list(map(*args))
  File "/Spectre/spectre.py", line 117, in outside_spectre_worker
    worker.cnv_call()
  File "/Spectre/spectreCNV.py", line 112, in cnv_call
    self.cnv_analysis.call_cnv_af_region()
  File "/Spectre/analysis/analysis.py", line 459, in call_cnv_af_region
    self.cnv_calls_list = cnv_by_af.af_cnv_call_region(self.cnv_calls_list, self.snv_af_bed)
  File "/Spectre/analysis/call_cnv_AF.py", line 82, in af_cnv_call_region
    for af_overlap_candidate in tabix_file.fetch(each_chromosome, each_candidate.start, each_candidate.end):
  File "pysam/libctabix.pyx", line 507, in pysam.libctabix.TabixFile.fetch
ValueError: could not create iterator for region 'chr1_KI270706v1_random:38001-54000'
"""

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

Traceback (most recent call last):
  File "/Spectre/spectre.py", line 500, in <module>
    main()
  File "/Spectre/spectre.py", line 482, in main
    spectre_run.spectre_exe()
  File "/Spectre/spectre.py", line 256, in spectre_exe
    results = pool.map(outside_spectre_worker, tuple(spectre_instructions))
  File "/opt/conda/envs/spectre-env/lib/python3.10/multiprocessing/pool.py", line 367, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File "/opt/conda/envs/spectre-env/lib/python3.10/multiprocessing/pool.py", line 774, in get
    raise self._value
ValueError: could not create iterator for region 'chr1_KI270706v1_random:38001-54000'
adbeggs commented 1 year ago

It seems to have produced a BED file though.. e.g.:

chrX    1934001 1935000 0.869388888888889
chrX    1935001 1936000 0.8558222222222223
chrX    1936001 1937000 0.6035333333333334
chrX    1937001 1938000 0.7777666666666666
philippesanio commented 1 year ago

Hello @adbeggs

This issue is caused if the sequence name cannot be found in the provided faster. Could you please check for me if the exact name "chr1_KI270706v1_random:38001-54000” is in the reference sequence?

Cheers ~Philippe

adbeggs commented 1 year ago

Hi @philippesanio yes chr1_KI270706v1_random is in the sequence

philippesanio commented 1 year ago

Hi @adbeggs

Another thing that could have been gone wrong is, that if the chr1_KI270706v1_random is not within the MDR file. (We are aware of that issue and have it on our bug fixing list) Could you be so kind and rerun Spectre without providing any MDR file (a new one will be generated) and see if the issue persists?

adbeggs commented 1 year ago

Aha... all fixed now... thanks for your patience.. I've tweeted our success!

philippesanio commented 1 year ago

Thank you very much!