Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # install clustergrammer
- pip3 install clustergrammer
- # make network object and load file
- from clustergrammer import Network
- from pandas import DataFrame as df
- net = Network()
- net.load_file('/data/fastq/sex_determine_region.heatmap.txt')
- # Z-score normalize the rows
- net.normalize(axis='row', norm_type='zscore', keep_orig=True)
- # calculate clustering using default parameters
- net.cluster()
- # save tsv to file for use by front end
- net.write_matrix_to_tsv('/data/fastq/nor.tsv')
- # procedure below and extra steps, use it as your will
- # make network object and load DataFrame, df
- net = Network()
- net.load_df(df)
- # filter for the top 100 columns based on their absolute value sum
- net.filter_N_top('col', 100, 'sum')
- # cluster using default parameters
- net.cluster()
- # save visualization JSON to file for use by front end
- net.write_json_to_file('viz', '/data/fastq/mult_view.json')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement