Did I find the right examples for you? yes no

# cogent.align.weights.util.Weights

All Samples(20)  |  Call(16)  |  Derive(0)  |  Import(4)

```from cogent.parse.tree import DndParser
from cogent.util.array import hamming_distance
from cogent.align.weights.util import Weights, number_of_pseudo_seqs,\
pseudo_seqs_exact, pseudo_seqs_monte_carlo, row_to_vote, distance_matrix,\
eigenvector_for_largest_eigenvalue, DNA_ORDER,RNA_ORDER,PROTEIN_ORDER,\
```
```
#create a dictionary of {seq_id: weight}
weight_dict = Weights(dict(zip(alignment.Names,weights)))
return weight_dict

```
```        votes = row_to_vote(array(temp)) #change distances to votes
weight_dict = Weights(dict(zip(aln_array.Names,weights)))
weight_dict.normalize() #normalize

```
```        votes = row_to_vote(array(temp))
weight_dict = Weights(dict(zip(alignment.Names,weights)))
weight_dict.normalize()
return weight_dict
```
```    d = pos_weights.Data

result = Weights()

for key,seq in alignment.items():
```

```from cogent.parse.tree import DndParser
from cogent.util.array import hamming_distance
from cogent.align.weights.util import Weights, number_of_pseudo_seqs,\
pseudo_seqs_exact, pseudo_seqs_monte_carlo, row_to_vote, distance_matrix,\
eigenvector_for_largest_eigenvalue, DNA_ORDER,RNA_ORDER,PROTEIN_ORDER,\
```
```
#create a dictionary of {seq_id: weight}
weight_dict = Weights(dict(zip(alignment.Names,weights)))
return weight_dict

```
```        votes = row_to_vote(array(temp)) #change distances to votes
weight_dict = Weights(dict(zip(aln_array.Names,weights)))
weight_dict.normalize() #normalize

```
```        votes = row_to_vote(array(temp))
weight_dict = Weights(dict(zip(alignment.Names,weights)))
weight_dict.normalize()
return weight_dict
```
```    d = pos_weights.Data

result = Weights()

for key,seq in alignment.items():
```

```from cogent.core.sequence import DnaSequence, RnaSequence
from cogent.core.moltype import DNA, RNA
from cogent.align.weights.util import Weights, number_of_pseudo_seqs,\
pseudo_seqs_exact, pseudo_seqs_monte_carlo, row_to_vote, distance_matrix,\
eigenvector_for_largest_eigenvalue, DNA_ORDER,RNA_ORDER,PROTEIN_ORDER,\
```
```    def test_weights(self):
"""Weights: should behave like a normal dict and can be normalized
"""
w = Weights({'seq1':2, 'seq2':3, 'seq3':10})
self.assertEqual(w['seq1'],2)
```

```from cogent.core.sequence import DnaSequence, RnaSequence
from cogent.core.moltype import DNA, RNA
from cogent.align.weights.util import Weights, number_of_pseudo_seqs,\
pseudo_seqs_exact, pseudo_seqs_monte_carlo, row_to_vote, distance_matrix,\
eigenvector_for_largest_eigenvalue, DNA_ORDER,RNA_ORDER,PROTEIN_ORDER,\
```
```    def test_weights(self):
"""Weights: should behave like a normal dict and can be normalized
"""
w = Weights({'seq1':2, 'seq2':3, 'seq3':10})
self.assertEqual(w['seq1'],2)
```