Debian Codegraph @

doc/manual.rst

raw ◀ ▶
Source reconstructed at patch state 2 of 3 — not the installed (fully patched) source.
3 Debian patches touch this file
1 ==========
2 ipdSummary
3 ==========
4
5 ------------------------------------------------------
6 Detect DNA base-modifications from kinetic signatures.
7 ------------------------------------------------------
8
9 :Date: December 2015
10 :Manual section: 1
11
12 DESCRIPTION
13 ===========
14
15 kineticsTool loads IPDs observed at each position in the genome, and compares those IPDs to value expected for unmodified DNA, and outputs the result of this statistical test.
16 The expected IPD value for unmodified DNA can come from either an *in-silico control* or an *amplified control*. The in silico control is trained by PacBio and shipped with the package. It predicts predicts the IPD using the local sequence context around the current position.
17 An amplified control dataset is generated by sequencing unmodified DNA with the same sequence as the test sample. An amplified control sample is usually generated by whole-genome amplification of the original sample.
18
19
20 Dependencies
21 ------------
22 kineticsTools depends on:
23 * pbcore (http://github.com/PacificBiosciences/pbcore)
24 * numpy
25 * scipy
26
27 Modification Detection
28 ----------------------
29 The basic mode of kineticsTools does an independent comparison of IPDs at each position on the genome, for each strand, and emits various statistics to CSV and GFF (after applying a significance filter).
30
31 Modifications Identification
32 ----------------------------
33 kineticsTools also has a *Modification Identification* mode that can decode multi-site IPD 'fingerprints' into a reduced set of calls of specific modifications. This feature has the following benefits:
34 * Different modifications occurring on the same base can be distinguished (for example m5C and m4C)
35 * The signal from one modification is combined into one statistic, improving sensitivity, removing extra peaks, and correctly centering the call
36
37 OPTIONS
38 =======
39
40 Please call this program with **--help** to see the available options.
41
42 Algorithm
43 =========
44
45 Synthetic Control
46 -----------------
47 Studies of the relationship between IPD and sequence context reveal that most of the variation in mean IPD across a genome can be predicted from a 12-base sequence context surrounding the active site of the DNA polymerase. The bounds of the relevant context window correspond to the window of DNA in contact with the polymerase, as seen in DNA/polymerase crystal structures. To simplify the process of finding DNA modifications with PacBio data, the tool includes a pre-trained lookup table mapping 12-mer DNA sequences to mean IPDs observed in C2 chemistry.
48
49
50 Filtering and Trimming
51 ----------------------
52
53 kineticsTools uses the Mapping QV generated by BLASR or pbmm2 and stored in the alignments or BAM file (or AlignmentSet) to ignore reads that aren't confidently mapped. The default minimum Mapping QV required is 10, implying that BLASR has :math:`90\%` confidence that the read is correctly mapped. Because of the range of readlengths inherent in PacBio dataThis can be changed in using the --mapQvThreshold command line argument, or via the SMRTPortal configuration dialog for Modification Detection.
54
55 There are a few features of PacBio data that require special attention in order to achieve good modification detection performance.
56 kineticsTools inspects the alignment between the observed bases and the reference sequence -- in order for an IPD measurement to be included in the analysis, the PacBio read sequence must match the reference sequence for :math:`k` around the cognate base. In the current module :math:`k=1`
57 The IPD distribution at some locus be thought of as a mixture between the 'normal' incorporation process IPD, which is sensitive to the local sequence context and DNA modifications and a contaminating 'pause' process IPD which have a much longer duration (mean >10x longer than normal), but happen rarely (~1% of IPDs).
58 Note: Our current understanding is that pauses do not carry useful information about the methylation state of the DNA, however a more careful analysis may be warranted. Also note that modifications that drastically increase the
59 Roughly 1% of observed IPDs are generated by pause events. Capping observed IPDs at the global 99th percentile is motivated by theory from robust hypothesis testing. Some sequence contexts may have naturally longer IPDs, to avoid capping too much data at those contexts, the cap threshold is adjusted per context as follows:
60 capThreshold = max(global99, 5*modelPrediction, percentile(ipdObservations, 75))
61
62
63 Statistical Testing
64 -------------------
65 We test the hypothesis that IPDs observed at a particular locus in the sample have a longer means than IPDs observed at the same locus in unmodified DNA. If we have generated a Whole Genome Amplified dataset, which removes DNA modifications, we use a case-control, two-sample t-test. This tool also provides a pre-calibrated 'synthetic control' model which predicts the unmodified IPD, given a 12 base sequence context. In the synthetic control case we use a one-sample t-test, with an adjustment to account for error in the synthetic control model.
66
67
68 Example Usage
69 =============
70
71 Basic use with BAM input, GFF output::
72
73 ipdSummary aligned.bam --reference ref.fasta --identify m6A,m4C --gff basemods.gff
74
75 With dataset input, methyl fraction calculation and GFF+CSV output::
76
77 ipdSummary mapped.alignmentset.xml --reference ref.fasta --identify m6A,m4C --methylFraction --gff basemods.gff --csv kinetics.csv
78
79
80 Inputs
81 ======
82
83 Aligned Reads
84 -------------
85
86 A standard PacBio alignment file - either AlignmentSet XML or BAM -
87 containing alignments and IPD information supplies the kinetic data used to perform modification detection.
88
89 Reference Sequence
90 ------------------
91
92 The tool requires the reference sequence used to perform alignments. This can
93 be either a FASTA file or a ReferenceSet XML.
94
95 Outputs
96 =======
97
98 The modification detection tool provides results in a variety of formats suitable for in-depth statistical analysis,
99 quick reference, and comsumption by visualization tools such as PacBio SMRTView.
100 Results are generally indexed by reference position and reference strand. In all cases the strand value refers to the strand carrying the modification in DNA sample. Remember that the kinetic effect of the modification is observed in read sequences aligning to the opposite strand. So reads aligning to the positive strand carry information about modification on the negative strand and vice versa, but in this toolkit we alway report the strand containing the putative modification.
101
102 The following output options are available:
103
104 - ``--gff FILENAME``: GFF format
105 - ``--csv FILENAME``: comma-separated value format
106 - ``--bigwig FILENAME``: BigWig file (mostly only useful for SMRTView)
107
108 If you are running base modification analysis through SMRT Link or a pbsmrtpipe
109 pipeline, the GFF, HDF5, and BigWig outputs are automatically generated.
110
111
112 modifications.gff
113 -----------------
114 The modifications.gff is compliant with the GFF Version 3 specification (http://www.sequenceontology.org/gff3.shtml). Each template position / strand pair whose p-value exceeds the pvalue threshold appears as a row. The template position is 1-based, per the GFF spec. The strand column refers to the strand carrying the detected modification, which is the opposite strand from those used to detect the modification. The GFF confidence column is a Phred-transformed pvalue of detection.
115
116 **Note on genome browser compatibility**
117
118 The modifications.gff file will not work directly with most genome browsers. You will likely need to make a copy of the GFF file and convert the _seqid_ columns from the generic 'ref0000x' names generated by PacBio, to the FASTA headers present in the original reference FASTA file. The mapping table is written in the header of the modifications.gff file in ``#sequence-header`` tags. This issue will be resolved in the 1.4 release of kineticsTools.
119
120 The auxiliary data column of the GFF file contains other statistics which may be useful downstream analysis or filtering. In particular the coverage level of the reads used to make the call, and +/- 20bp sequence context surrounding the site.
121
122 ================ ===========
123 Column Description
124 ================ ===========
125 seqid Fasta contig name
126 source Name of tool -- 'kinModCall'
127 type Modification type -- in identification mode this will be m6A, m4C, or m5C for identified bases, or the generic tag 'modified_base' if a kinetic event was detected that does not match a known modification signature
128 start Modification position on contig
129 end Modification position on contig
130 score Phred transformed p-value of detection - this is the single-site detection p-value
131 strand Sample strand containing modification
132 phase Not applicable
133 attributes Extra fields relevant to base mods. IPDRatio is traditional IPDRatio, context is the reference sequence -20bp to +20bp around the modification, and coverage level is the number of IPD observations used after Mapping QV filtering and accuracy filtering. If the row results from an identified modification we also include an identificationQv tag with the from the modification identification procedure. identificationQv is the phred-transformed probability of an incorrect identification, for bases that were identified as having a particular modification. frac, fracLow, fracUp are the estimated fraction of molecules carrying the modification, and the 5% confidence intervals of the estimate. The methylated fraction estimation is a beta-level feature, and should only be used for exploratory purposes.
134 ================ ===========
135
136 modifications.csv
137 -----------------
138
139 The modifications.csv file contains one row for each (reference position, strand) pair that appeared in the dataset with coverage at least x.
140 x defaults to 3, but is configurable with '--minCoverage' flag to ipdSummary.py. The reference position index is 1-based for compatibility with the gff file the R environment. Note that this output type scales poorly and is not
141 recommended for large genomes; the HDF5 output should perform much better in
142 these cases. We have preserved the CSV option to support legacy applications
143 but this is no longer produce by the pipelines in SMRT Link/pbsmrtpipe.
144
145
146 Output columns
147 --------------
148
149 **in-silico control mode**
150
151 ================ ===========
152 Column Description
153 ================ ===========
154 refId reference sequence ID of this observation
155 tpl 1-based template position
156 strand native sample strand where kinetics were generated. '0' is the strand of the original FASTA, '1' is opposite strand from FASTA
157 base the cognate base at this position in the reference
158 score Phred-transformed pvalue that a kinetic deviation exists at this position
159 tMean capped mean of normalized IPDs observed at this position
160 tErr capped standard error of normalized IPDs observed at this position (standard deviation / sqrt(coverage)
161 modelPrediction normalized mean IPD predicted by the synthetic control model for this sequence context
162 ipdRatio tMean / modelPrediction
163 coverage count of valid IPDs at this position (see Filtering section for details)
164 frac estimate of the fraction of molecules that carry the modification
165 fracLow 2.5% confidence bound of frac estimate
166 fracUpp 97.5% confidence bound of frac estimate
167 ================ ===========
168
169 **case-control mode**
170
171 ================ ===========
172 Column Description
173 ================ ===========
174 refId reference sequence ID of this observation
175 tpl 1-based template position
176 strand native sample strand where kinetics were generated. '0' is the strand of the original FASTA, '1' is opposite strand from FASTA
177 base the cognate base at this position in the reference
178 score Phred-transformed pvalue that a kinetic deviation exists at this position
179 caseMean mean of normalized case IPDs observed at this position
180 controlMean mean of normalized control IPDs observed at this position
181 caseStd standard deviation of case IPDs observed at this position
182 controlStd standard deviation of control IPDs observed at this position
183 ipdRatio tMean / modelPrediction
184 testStatistic t-test statistic
185 coverage mean of case and control coverage
186 controlCoverage count of valid control IPDs at this position (see Filtering section for details)
187 caseCoverage count of valid case IPDs at this position (see Filtering section for details)
188 ================ ===========
189
190 SEE ALSO
191 ========
192
193 **summarizeModifications**\ (1)