python/pymethylprocess/preprocess.py
def feature_select(input_pkl,output_pkl,n_top_cpgs=300000, feature_selection_method='mad', metric='correlation', n_neighbors=10, mad_top_cpgs=0):
    """Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection."""
    os.makedirs(output_pkl[:output_pkl.rfind('/')],exist_ok=True)
    input_dict=pickle.load(open(input_pkl,'rb'))
    methyl_array = MethylationArray(*extract_pheno_beta_df_from_pickle_dict(input_dict))

    if mad_top_cpgs and feature_selection_method != 'mad':
        methyl_array.feature_select(mad_top_cpgs,'mad')

    methyl_array.feature_select(n_top_cpgs,feature_selection_method, metric, nn=n_neighbors)

    methyl_array.write_pickle(output_pkl)

    return methyl_array
Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection.
Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection.
Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection .
def feature_select(input_pkl,output_pkl,n_top_cpgs=300000, feature_selection_method='mad', metric='correlation', n_neighbors=10, mad_top_cpgs=0):
    os.makedirs(output_pkl[:output_pkl.rfind('/')],exist_ok=True)
    input_dict=pickle.load(open(input_pkl,'rb'))
    methyl_array = MethylationArray(*extract_pheno_beta_df_from_pickle_dict(input_dict))
    if mad_top_cpgs and feature_selection_method != 'mad':
        methyl_array.feature_select(mad_top_cpgs,'mad')
    methyl_array.feature_select(n_top_cpgs,feature_selection_method, metric, nn=n_neighbors)
    methyl_array.write_pickle(output_pkl)
    return methyl_array
def feature_select ( input_pkl , output_pkl , n_top_cpgs = 300000 , feature_selection_method = 'mad' , metric = 'correlation' , n_neighbors = 10 , mad_top_cpgs = 0 ) : os . makedirs ( output_pkl [ : output_pkl . rfind ( '/' ) ] , exist_ok = True ) input_dict = pickle . load ( open ( input_pkl , 'rb' ) ) methyl_array = MethylationArray ( * extract_pheno_beta_df_from_pickle_dict ( input_dict ) ) if mad_top_cpgs and feature_selection_method != 'mad' : methyl_array . feature_select ( mad_top_cpgs , 'mad' ) methyl_array . feature_select ( n_top_cpgs , feature_selection_method , metric , nn = n_neighbors ) methyl_array . write_pickle ( output_pkl ) return methyl_array
Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection.
Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection .
"""Filter CpGs by taking x top CpGs with highest mean absolute deviation scores or via spectral feature selection."""
input_pkl
output_pkl
n_top_cpgs
feature_selection_method
metric
n_neighbors
mad_top_cpgs