def methy_array_from_csv(pheno_csv, beta_csv, transpose, output_pkl): import pandas as pd beta_df = pd.read_csv(beta_csv, index_col=0) if transpose: beta_df = beta_df.T MethylationArray(pheno_df=pd.read_csv(pheno_csv, index_col=0), beta_df=beta_df).write_pickle(output_pkl)
def to_methyl_array(self): """Convert torch dataset back into methylation array, useful because turning into torch dataset can cause the original MethylationArray beta matrix to turn into numpy array, when needs turn back into pandas dataframe. Returns ------- MethylationArray """ return MethylationArray(self.methylation_array.pheno,pd.DataFrame(self.methylation_array.beta,index=self.samples,columns=self.features),'')