AlexandrovLab/SigProfilerExtractor

AttributeError: 'NoneType' object has no attribute 'keys'

Closed this issue · 3 comments

Thank you for the amazing tool. I am handling WES data.
When I ran the following code, I get the error shown below.
What would the the problem?

sig.sigProfilerExtractor("matrix", "Total_Exome_True", "/data/project/ESCC2/4.analysis/DNA/1.Variant_Calling/SigProfiler/Total_Exome_True/output/SBS/Total.SBS96.exome.txt", reference_genome="GRCh38", opportunity_genome="GRCh38", exome=True)

There may be an issue with the formatting of your matrix file.
Extracting signature 24 for mutation type 96
The matrix normalizing cutoff is 9600

Time taken to collect 100 iterations for 24 signatures is 409.37 seconds
Optimization time is 2.136180877685547 seconds
The reconstruction error is 0.0818, average process stability is 0.09 and 
the minimum process stability is -0.29 for 24 signatures

There may be an issue with the formatting of your matrix file.
Extracting signature 25 for mutation type 96
The matrix normalizing cutoff is 9600

Time taken to collect 100 iterations for 25 signatures is 512.07 seconds
Optimization time is 3.96828031539917 seconds
The reconstruction error is 0.0849, average process stability is 0.1 and 
the minimum process stability is -0.24 for 25 signatures

There may be an issue with the formatting of your matrix file.

 De Novo Fitting .....
There may be an issue with the formatting of your matrix file.

 Decomposing De Novo Signatures  .....
There may be an issue with the formatting of your matrix file.
There may be an issue with the formatting of your matrix file.
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/Yonsei/python/3.8.1/lib/python3.8/site-packages/SigProfilerExtractor/sigpro.py", line 862, in sigProfilerExtractor
    decomp.spa_analyze(allgenomes, output, signatures=processAvg, genome_build=genome_build, cosmic_version=cosmic_version, exome=exome, verbose=False,
  File "/opt/Yonsei/python/3.8.1/lib/python3.8/site-packages/SigProfilerAssignment/decomposition.py", line 520, in spa_analyze
    final_signatures = sub.signature_decomposition(processAvg, mutation_type, layer_directory2, genome_build=genome_build,cosmic_version=cosmic_version,signature_database=signature_database, mutation_context=mutation_context, add_penalty=0.05, connected_sigs=connected_sigs,remove_penalty=0.01, make_decomposition_plots=make_decomposition_plots, originalProcessAvg=originalProcessAvg,new_signature_thresh_hold=new_signature_thresh_hold,sig_exclusion_list=sig_exclusion_list,exome=exome, m_for_subgroups=m_for_subgroups)    
  File "/opt/Yonsei/python/3.8.1/lib/python3.8/site-packages/SigProfilerAssignment/decompose_subroutines.py", line 369, in signature_decomposition
    byte_plot = sp.run_PlotDecomposition(originalProcessAvg[denovo_cols],
  File "/opt/Yonsei/python/3.8.1/lib/python3.8/site-packages/SigProfilerAssignment/DecompositionPlots/PlotDecomposition.py", line 513, in run_PlotDecomposition
    denovo_plots_dict = convert_to_imgReaderDict(denovo_plots_dict)
  File "/opt/Yonsei/python/3.8.1/lib/python3.8/site-packages/SigProfilerAssignment/DecompositionPlots/PlotDecomposition.py", line 162, in convert_to_imgReaderDict
    for name in image_dict.keys():
AttributeError: 'NoneType' object has no attribute 'keys'

I uploaded the
JOB_METADATA_Extractor.txt
and
SigProfilerMatrixGenerator_Total_GRCh382024-03-30.out.txt.
Also the input matrix.
Total.SBS96.exome.txt

Hi @jennyp76,

I have tested with your input file with the following versions and was unable to reproduce your error:
SigProfilerAssignment 0.1.4
SigProfilerExtractor 1.1.23
sigProfilerPlotting 1.3.22

Could you please update to the following versions? Please reach out if your issue persists.

I've encountered this before and my debugging led me to corrupt Pickle files (*.pkl) in sigProfilerPlotting/templates. What helped was uninstalling sigProfilerPlotting and reinstalling. Then the script ran successfully.

pip uninstall SigProfilerPlotting -y; pip install SigProfilerPlotting

Hope this helps,
Marc

Please re-open this thread if you are still encountering this issue, thanks!