]> git.donarmstrong.com Git - biopieces.git/blob - bp_usage/create_weight_matrix.wiki
more wikis
[biopieces.git] / bp_usage / create_weight_matrix.wiki
1 =Biopiece: create_weight_matrix=
2
3 ==Synopsis==
4
5 Create a residue composition weight matrix of an alignment in the stream.
6
7 ==Description==
8
9 [create_weight_matrix] calculates the frequency of all residues per column in aligned
10 sequences from the stream - either as exact residue counts or percentages.
11
12 ==Usage==
13
14 {{{
15 ... | create_weight_matrix [options]
16 }}}
17
18 ==Options==
19
20 {{{
21 [-p        | --percent]            -  Output the result in percent  -  Default=absolute
22 [-I <file> | --stream_in=<file>]   -  Read input from stream file   -  Default=STDIN
23 [-O <file> | --stream_out=<file>]  -  Write output to stream file   -  Default=STDOUT
24 }}}
25
26 ==Examples==
27
28 Consider the following alignment in the file `aln.fna` in FASTA format:
29
30 {{{
31 >test5
32 ---TAACAGGCACT
33 >test2
34 -----GAATCGACT
35 >test1
36 --CTAGCTTCGACT
37 >test3
38 ACGAAACTAGCATC
39 >test4
40 ----AGCATCGACT
41 }}}
42
43 To create a weight matrix from the above alignment, read it in with [read_fasta] and pipe the
44 stream through [create_weight_matrix]:
45
46 {{{
47 read_fasta -i aln.fna | create_weight_matrix
48 }}}
49
50 The resulting five records will look the first one below, which is not really understandable:
51
52 {{{
53 V13: 0
54 V11: 0
55 V7: 0
56 V4: 2
57 V3: 3
58 V9: 0
59 V0: -
60 V2: 4
61 V8: 0
62 V12: 0
63 V5: 1
64 V10: 0
65 V1: 4
66 V6: 0
67 V14: 0
68 ---
69 }}}
70
71 To make sense pipe the result through [write_tab] like this:
72
73 {{{
74 read_fasta -i aln.fna | create_weight_matrix | write_tab -x
75
76 -   4   4   3   2   1   0   0   0   0   0   0   0   0   0
77 A   1   0   0   1   4   2   1   3   1   0   0   5   0   0
78 C   0   1   1   0   0   0   4   0   0   3   2   0   4   1
79 G   0   0   1   0   0   3   0   0   1   2   3   0   0   0
80 T   0   0   0   2   0   0   0   2   3   0   0   0   1   4
81 }}}
82
83 The above weight matrix shows the frequencies of all residue types (1st column) found at
84 all positions throughout the alignment.
85
86 To obtain the percentwise frequencies use the `-p` switch to [create_weight_matrix]:
87
88 {{{
89 read_fasta -i aln.fna | create_weight_matrix -p | write_tab -x
90
91 -    80   80   60   40   20   0    0    0    0    0    0    0    0    0
92 A    20   0    0    20   80   40   20   60   20   0    0    100  0    0
93 C    0    20   20   0    0    0    80   0    0    60   40   0    80   20
94 G    0    0    20   0    0    60   0    0    20   40   60   0    0    0
95 T    0    0    0    40   0    0    0    40   60   0    0    0    20   80
96 }}}
97
98 ==See also==
99
100 [read_fasta]
101
102 [write_tab]
103
104 ==Author==
105
106 Martin Asser Hansen - Copyright (C) - All rights reserved.
107
108 mail@maasha.dk
109
110 August 2007
111
112 ==License==
113
114 GNU General Public License version 2
115
116 http://www.gnu.org/copyleft/gpl.html
117
118 ==Help==
119
120 [create_weight_matrix] is part of the Biopieces framework.
121
122 http://code.google.com/p/biopieces/