0

I've been trying to make changes to a muon object in python.

import pandas as pd
import sys
import os
import muon
import muon as mu
import numpy as np

madata = mu.read("Example_data.h5mu")
df = madata.mod['atac'].var

# change the data frame

madata.mod['atac'].var = df2
madata.write("data.h5mu") 

It fails on the line madata.mod['atac'].var = df2

ValueError: Length of passed value for var_names is 145857, but this AnnData has shape: (82798, 111556)

The problem is pretty obviously that the muon object doesn't expect the shape to change but I can't find an obvious setter function or a way to change the shape of an existing table in muon or update one though I may be missing an option.

woblob
  • 1,349
  • 9
  • 13
Murphy
  • 241
  • 2
  • 12

0 Answers0