Skip to content
Steve Bond edited this page Nov 20, 2015 · 3 revisions

--hash_ids, -hi

Description

Rename all taxon labels to a hash string selected randomly from the ascii_letters set.

A hash-map table is written to stderr, while the trees are written to stdout. Note that any labels that are identical, within or among trees, will also be given the same hash value. The hash-map can be silenced with the -q flag.

For developers: An attribute is appended to the PhyloBuddy object named hash_map. It is a list of OrderedDict() objects of the form {hash: original_id}, with one OrderedDict per tree.

Argument

Hash length ( int )

Optional. Specify the length of the new hash strings IDs (default = 10). If the number of possible hashes is smaller than twice the total number of taxon labels, then a warning will be printed to stderr and the hash length will be increased automatically until it meets this criteria.

nodes ( exact string )

Optional. Internal node labels will not be hashed by default, but you can choose to hash them by passing in the word 'nodes' (see example 3)

Examples

Input file: Animals.nwk

((((horse,donkey)Equus,((giraffe,deer),cow)Ruminantiamorpha),(fox,wolf)Canis),beluga);
((((((moth,fly),wasp),beetle),((earwig,lotus),stonefly)),dragonfly),spider);

Usage example 1

$: pb Animals.nwk -hi

Output

##### Hash table #####
# Tree 1
bRiTVU2f0G,horse
BjWYboo223,donkey
JAg610SVQQ,giraffe
S0BBcG9clP,deer
jrSNDRrDPp,cow
s01exy7DSM,fox
eHhoCI70PT,wolf
lVbXxzbhoj,beluga

# Tree 2
liXIg2oA6A,moth
HIRDAbddKX,fly
ZnRQXdO3ih,wasp
sFGWn2eZVa,beetle
88Fm2rLfBj,earwig
vBe6yYUCaG,lotus
Y0KZm8mtWG,stonefly
Z2bDkIC3Q1,dragonfly
HNzXgcqOnZ,spider
######################

((((bRiTVU2f0G,BjWYboo223)Equus,((JAg610SVQQ,S0BBcG9clP),jrSNDRrDPp)Ruminantiamorpha),(s01exy7DSM,eHhoCI70PT)Canis),lVbXxzbhoj);
((((((liXIg2oA6A,HIRDAbddKX),ZnRQXdO3ih),sFGWn2eZVa),((88Fm2rLfBj,vBe6yYUCaG),Y0KZm8mtWG)),Z2bDkIC3Q1),HNzXgcqOnZ);

Usage example 2

$: pb Animals.nwk -hi 3

Output

##### Hash table #####
# Tree 1
mWE,horse
9h5,donkey
1e6,giraffe
gGz,deer
wGe,cow
KMn,fox
KNN,wolf
NXq,beluga

# Tree 2
xxS,moth
gLb,fly
IYK,wasp
DRV,beetle
SBv,earwig
8yH,lotus
bK2,stonefly
AHm,dragonfly
nna,spider
######################

((((mWE,9h5)Equus,((1e6,gGz),wGe)Ruminantiamorpha),(KMn,KNN)Canis),NXq);
((((((xxS,gLb),IYK),DRV),((SBv,8yH),bK2)),AHm),nna);

Usage example 3

$: pb Animals.nwk -hi nodes 5

Output

##### Hash table #####
# Tree 1
IrqQt,Equus
EHLZs,horse
t3G1r,donkey
WbYkE,Ruminantiamorpha
5EG4k,giraffe
waOpv,deer
sDjDU,cow
X1HZl,Canis
9kI2R,fox
gxYw0,wolf
SiQWI,beluga

# Tree 2
pffvz,moth
QwlGq,fly
mt9lw,wasp
zqQqh,beetle
ANkAk,earwig
4gu1S,lotus
chrsi,stonefly
F9FHp,dragonfly
hTun1,spider
######################

((((EHLZs,t3G1r)IrqQt,((5EG4k,waOpv),sDjDU)WbYkE),(9kI2R,gxYw0)X1HZl),SiQWI);
((((((pffvz,QwlGq),mt9lw),zqQqh),((ANkAk,4gu1S),chrsi)),F9FHp),hTun1);

Main Toolkit Pages





Further Reading

Clone this wiki locally