Skip to content

KeyError(f"{labels[mask].tolist()} not found in axis") KeyError: "['index'] not found in axis" when generating heatmaps #10

@sosmarr

Description

@sosmarr

Trying to generate heatmaps with following code:

# convert rMATS output to TSV format
python3 splice/Jutils/jutils.py convert-results \
	--rmats-dir splice/output \
	--out-dir splice/jutils_output

# heatmap: visualize DSR events
python3 splice/Jutils/jutils.py heatmap \
	--tsv-file splice/jutils_output/rmats_JC_results.tsv \
    --meta-file splice/meta_file.tsv \
	--p-value 0.05 \
	--q-value 0.05 \
	--out-dir splice/jutils_output 

but keep getting following errors:

Traceback (most recent call last):
  File "/mnt/scratch/Precision/CD/Lynn/SCalphaM15KD/splice/Jutils/jutils.py", line 182, in <module>
    main()
  File "/mnt/scratch/Precision/CD/Lynn/SCalphaM15KD/splice/Jutils/jutils.py", line 172, in main
    run_heatmap_module(args, parser_dict)
  File "/mnt/scratch/Precision/CD/Lynn/SCalphaM15KD/splice/Jutils/jutils.py", line 130, in run_heatmap_module
    plot_heatmap_pca_mds(Path(args.tsv_file), Path(args.meta_file), Path(args.out_dir), args.p_value,
  File "/mnt/scratch/Precision/CD/Lynn/SCalphaM15KD/splice/Jutils/heatmap_pca_mds_utils.py", line 89, in plot_heatmap_pca_mds
    data_df = process_data_supervised(data_df, samples, sample_cond_dict, conditions, original_columns,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/scratch/Precision/CD/Lynn/SCalphaM15KD/splice/Jutils/heatmap_pca_mds_utils.py", line 255, in process_data_supervised
    data_df = data_df.drop(columns=['dPSI', 'index'])
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/BCRICWH.LAN/samantha.mar/.local/lib/python3.12/site-packages/pandas/core/frame.py", line 6288, in drop
    return super().drop(
           ^^^^^^^^^^^^^
  File "/home/BCRICWH.LAN/samantha.mar/.local/lib/python3.12/site-packages/pandas/core/generic.py", line 4644, in drop
    obj = obj._drop_axis(labels, axis, level=level, errors=errors)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/BCRICWH.LAN/samantha.mar/.local/lib/python3.12/site-packages/pandas/core/generic.py", line 4686, in _drop_axis
    new_axis = axis.drop(labels, errors=errors)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/BCRICWH.LAN/samantha.mar/.local/lib/python3.12/site-packages/pandas/core/indexes/base.py", line 7268, in drop
    raise KeyError(f"{labels[mask].tolist()} not found in axis")
KeyError: "['index'] not found in axis"

Was able to generate PCA with no problems. Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions