brentp / combat.py

python / numpy / pandas / patsy version of ComBat for removing batch effects.
MIT License
100 stars 43 forks source link

How to call combat.py with no covariates #1

Open fbrundu opened 11 years ago

fbrundu commented 11 years ago

Hi, I am trying to use your script passing an expression matrix in dat and a sample information file on batch.. I do not want to pass any covariate, but I do not know how to do it.. how can I achieve this?

Thanks

brentp commented 11 years ago

Hi @FrancescoBrundu I added a change that should allow you to do this. See the last 2 lines of the file for example use. Let me know if you have any problems.

fbrundu commented 11 years ago

Thanks for your effort. I am unable to test it now, I will try out ASAP. Thanks

fbrundu commented 11 years ago

Thanks @brentp .. It works flawlessly. More extensive result: on a table with this signature

Index: 54675 entries Columns: 445 entries dtypes: float64(445)

it gives an error of maximum 0.000652714183843. I didn't test it further for time but the speed increment is outstanding. Since I am a Pythoner and I do not like (neither I can program in) R, I will propose myself to test when I can Python version of R script, if you do something more. May I tell you to do some little changes in the script (anyway if you find them useless you can reject' em)? Maybe changing combat signature to

def combat(dat, batch, mod=None, numCovs=None)

and changing line 42 to

if mod is not None and mod:  # maybe this one is better but I am not really sure about it

Anyway great work so far, I am looking forward to see new ported versions of R script if you have the time. :+1: Bye

ghost commented 6 years ago

Hi Hi,

I am using Combat to correct the effect of different scanners on radiomics features, and I found python version of Combat here. But I do have an error when running it. My data is in Dataframe (7341,97) and my batch is in Series (97), but I have a ValueError: num_columns must be an int?? does anyone have this error before?

Thanks:)