Opened 2 weeks ago

Closed 2 weeks ago

#1631 closed defect (fixed)

Mutation signature for SV fails for some variant calls

Reported by: Nicklas Nordborg Owned by: Nicklas Nordborg
Priority: major Milestone: Reggie v5.5.1
Component: net.sf.basedb.reggie Keywords:
Cc:

Description

The error message is

TypeError: unsupported operand type(s) for /: 'str' and 'int'

and the relevant part of the stacktrace:

Traceback (most recent call last):
  File "/conda/bin/SigProfilerMatrixGenerator", line 8, in <module>
    sys.exit(main_function())
  File "/conda/lib/python3.10/site-packages/SigProfilerMatrixGenerator/scripts/SigProfilerMatrixGenerator_CLI.py", line 34, in main_function
    controller.dispatch_sv_matrix_generator(args)
  File "/conda/lib/python3.10/site-packages/SigProfilerMatrixGenerator/controllers/cli_controller.py", line 233, in dispatch_sv_matrix_generator
    sv_mg.generateSVMatrix(
  File "/conda/lib/python3.10/site-packages/SigProfilerMatrixGenerator/scripts/SVMatrixGenerator.py", line 1024, in generateSVMatrix
    sigPlt.plotSV(
  File "/conda/lib/python3.10/site-packages/sigProfilerPlotting/sigProfilerPlotting.py", line 2110, in plotSV
    df["total_count"] = df.sum(axis=1) / num_samples  # NORMALIZE BY # of SAMPLES
  File "/conda/lib/python3.10/site-packages/pandas/core/ops/common.py", line 72, in new_method
    return method(self, other)
  File "/conda/lib/python3.10/site-packages/pandas/core/arraylike.py", line 126, in __truediv__
    return self._arith_method(other, operator.truediv)
  File "/conda/lib/python3.10/site-packages/pandas/core/series.py", line 6259, in _arith_method
    return base.IndexOpsMixin._arith_method(self, other, op)
  File "/conda/lib/python3.10/site-packages/pandas/core/base.py", line 1325, in _arith_method
    result = ops.arithmetic_op(lvalues, rvalues, op)
  File "/conda/lib/python3.10/site-packages/pandas/core/ops/array_ops.py", line 226, in arithmetic_op
    res_values = _na_arithmetic_op(left, right, op)  # type: ignore[arg-type]
  File "/conda/lib/python3.10/site-packages/pandas/core/ops/array_ops.py", line 172, in _na_arithmetic_op
    result = _masked_arith_op(left, right, op)
  File "/conda/lib/python3.10/site-packages/pandas/core/ops/array_ops.py", line 129, in _masked_arith_op
    result[mask] = op(xrav[mask], y)
TypeError: unsupported operand type(s) for /: 'str' and 'int'

After investigating this it seems like it happens when all variants in the breakpoints.bedpe are on the same chromosome and shorter than 1000bp. They are filtered out by the signature matrix generator since there is no context with less than 1000bp in the signature. This results in an empty data array which seems to be what is causing the error.

I think it would be good if we could treat this the same way as we treat the case when no variants at all are found. That is, we do not start the mutational signature step at all. It should be relatively simple to implement a pre-check on the breakpoints.bedpe to see if all entries are filtered out or not.

MutationalSignature items that represents the failed analysis should already be deleted by the auto-confirm functionality, but we have to remove variant calls from the WGS SV Mutational Signatures Pipeline item list and reset the AutoProcessing annotation.

Change History (1)

comment:1 by Nicklas Nordborg, 2 weeks ago

Resolution: fixed
Status: newclosed

In 7994:

Fixes #1631: Mutation signature for SV fails for some variant calls

Note: See TracTickets for help on using tickets.