Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from skbio.diversity import beta_diversity
- from skbio import TreeNode
- from io import StringIO
- # int data = dataFrame.values.astype('float64')
- # weighted_unifrac
- data = [[23, 64, 14, 0, 0, 3, 1],
- [0, 3, 35, 42, 0, 12, 1],
- [0, 5, 5, 0, 40, 40, 0],
- [44, 35, 9, 0, 1, 0, 0],
- [0, 2, 8, 0, 35, 45, 1],
- [0, 0, 25, 35, 0, 19, 0]]
- ids = list('ABCDEF')
- tree = TreeNode.read(StringIO(
- '(((((OTU1:0.5,OTU2:0.5):0.5,OTU3:1.0):1.0):0.0,'
- '(OTU4:0.75,(OTU5:0.5,(OTU6:0.5,OTU7:0.5):0.5):'
- '0.5):1.25):0.0)root;'))
- otu_ids = ['OTU1', 'OTU2', 'OTU3', 'OTU4', 'OTU5', 'OTU6', 'OTU7']
- wu_dm = beta_diversity("weighted_unifrac", data, ids, tree=tree, otu_ids=otu_ids)
- print(wu_dm)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement