Debian Codegraph @

docs/tutorial-cgp/cactus.html

raw symbols SCIP
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
2 <html><head><title>Predicting Genes with AUGUSTUS</title>
3 <link rel="stylesheet" type="text/css" href="augustus.css">
4 <script src="tutorial.js" type="text/javascript"></script>
5 </head><body>
6 <font size=-1>
7 Navigate to <a href="index.html">Lab Session on AUGUSTUS</a>.
8 <a href="scipio.html">Using Scipio</a>.
9 <a href="training.html">Training AUGUSTUS</a>.
10 <a href="ppx.html">AUGUSTUS-PPX</a>.
11 </font>
12 <div align="right">Show <a href="javascript:allOn()">all</a> / <a href="javascript:allOff()">no</a> details.</div>
13
14 <h1>Creating a Whole-Genome-Alignment with progressiveCactus</h1>
15
16
17 This tutorial describes how a whole-genome alignment of multiple genomes can be created with the Cactus aligner.<br>
18 The output alignment is a compressed file in HAL format that can be exported as MAF.
19
20
21 <h2 id="runCactus">1. Running progressive Cactus</h2>
22
23 <span class="assignment">Prepare</span> a text file with the species tree followed by a space-separated list of species names and location of
24 the corresponding genome fasta files (absolute path names required!).<br><br>
25
26 <a href="javascript:onoff('cft')" class="dlink"><span id="cft" title="cftd" class="dcross">[+]</span>
27 <span class="dtitle">file format...</span></a> <br>
28 <div id="cftd" class="details" style="display:none;">
29 <pre class="code">
30 tree in Newick format
31 name_of_genome_1 absolute/path/to/genome_1
32 name_of_genome_2 absolute/path/to/genome_2
33 ...
34 name_of_genome_N absolute/path/to/genome_N
35 </pre>
36 For furter information and optional parameters, read the <a href="https://github.com/glennhickey/progressiveCactus">progressiveCactus manual</a>
37 </div>
38 </br>
39
40 <pre class="code">
41 cp tree.nwk vertebrates.txt
42 for f in $PWD/genomes/*.fa; do echo -ne "$(basename $f .fa)\t$f\n"; done >>vertebrates.txt
43 </pre>
44
45 The file <span class="result"><tt>vertebrates.txt</tt></span> will now look like this (except for the parent directory)<br>
46 <pre class="code">
47 ((monDom5:0.340786,(((hg38:0.035974,rheMac3:0.043601):0.109934,(mm10:0.084509,rn6:0.091589):0.271974):0.020593,(bosTau8:0.18908,canFam3:0
48 .13303):0.032898):0.258392):0.181168,galGal4:0.559442);
49 bosTau8 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/bosTau8.fa
50 canFam3 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/canFam3.fa
51 galGal4 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/galGal4.fa
52 hg38 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/hg38.fa
53 mm10 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/mm10.fa
54 monDom5 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/monDom5.fa
55 rheMac3 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/rheMac3.fa
56 rn6 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/genomes/rn6.fa
57 </pre>
58
59 <span class="assignment">Run</span> progressiveCactus, e.g. using 8 threads (~12min):
60 <pre class="code">
61 runProgressiveCactus.sh vertebrates.txt cactusout vertebrates.hal --maxThreads=8 2>&1 > cactus.out
62 </pre>
63
64 This creates a .hal binary indexed alignment file <span class="result"><tt>vertebrates.hal</tt></span><br><br>
65
66
67 <h2 id="hal2maf">2. Export HAL alignment as MAF</h2>
68
69 Next, we will export the HAL alignment as MAF. Observe, that the MAF format is reference-based, i.e. alignments
70 can only be represented with respect to some reference species. Generally any species can be chosen as reference.
71 We recommend, however, to choose a reference species that 1.) has a high-quality genome assembly and 2.) is placed somewhere
72 in the middle of the clade, e.g. in our case human (hg38). For parallelization of the gene prediction step,
73 we recommend to split the global alignmnent into several overlapping alignment chunks. This can be achieved with <tt>hal2maf_split.pl</tt> using
74 the parameters <tt>--chunksize</tt> that specifies the maximum chunk size (number of bases covered in the reference genome) and
75 <tt>--overlap</tt> that specifies the amount of overlap (number of bases) between two consecutive chunks.
76 Observe that <tt>hal2maf_split.pl</tt> works on top of the HAL tools toolbox, which is also part of the progressiveCactus package.
77 If the <tt>progressiveCactus/submodules/hal/bin</tt> directory in is not in your global PATH, use the parameter <tt>--hal_exec_dir</tt> to point to the directory<br><br>
78
79 <span class="assignment">Export</span> <span class="result"><tt>vertebrates.hal</tt></span> as MAF
80
81 <pre class="code">
82 hal2maf_split.pl --halfile vertebrates.hal --refGenome hg38 --cpus 8 --chunksize 50000 --overlap 25000 --outdir mafs
83 </pre>
84
85 This will generate the directory <span class="result"><tt>mafs/</tt></span> that
86 contains the output alignment chunks in MAF format
87 <pre class="code">
88 -rw-r--r-- 1 stefanie bioinf 392K May 24 19:43 chr16.0-49999.maf
89 -rw-r--r-- 1 stefanie bioinf 307K May 24 19:43 chr16.100000-149999.maf
90 -rw-r--r-- 1 stefanie bioinf 365K May 24 19:43 chr16.125000-174999.maf
91 -rw-r--r-- 1 stefanie bioinf 586K May 24 19:43 chr16.150000-199999.maf
92 -rw-r--r-- 1 stefanie bioinf 395K May 24 19:43 chr16.175000-210154.maf
93 -rw-r--r-- 1 stefanie bioinf 345K May 24 19:43 chr16.25000-74999.maf
94 -rw-r--r-- 1 stefanie bioinf 408K May 24 19:43 chr16.50000-99999.maf
95 -rw-r--r-- 1 stefanie bioinf 418K May 24 19:43 chr16.75000-124999.maf
96 </pre>
97 For demonstration purposes, we chose very small values for the chunk size and overlap.
98 In a more realistic setting, i.e. when working with whole-genome alignments,
99 we recommend a chunk size in the megabase order, e.g. <tt>--chunksize=2500000</tt> and <tt>--overlap=500000</tt> (default values).<br><br>
100
101 <a href="javascript:onoff('nsl')" class="dlink"><span id="nsl" title="nsld" class="dcross">[+]</span>
102 <span class="dtitle">avoid splitting within genes...</span></a> <br>
103 <div id="nsld" class="details" style="display:none;">
104 Gene prediction errors may occur from splitting of the alignment within genes. The smaller the chunk size
105 is chosen, the more likely genes are truncated at alignment boundaries. To avoid this,
106 a list of genic regions/intervals may be passed to <tt>hal2maf_split.pl</tt>. In this case, the splitting is
107 restricted to intergenic regions, e.g. position outside of the given intervals. The genic intervals can be obtained
108 from existing annotations for the reference species, if available.<br><br>
109
110 <span class="assignment">Use</span> the hg38 RefSeq annotation <a href="data/refseq/refseq.hg38.gtf"><tt>refseq/refseq.hg38.gtf</tt></a> to create a text file with a list of genic intervals, in which the splitting is forbidden.
111 Each genic interval is specified as follows: <tt>seqname &lttab> start &lttab> end &ltnewline></tt><br><br>
112 <pre class="code">
113 gtf2gff.pl --printIntron &ltrefseq/refseq.hg38.gtf --out=/dev/stdout | cut -f 1,4,5 >no_split_list.txt
114 </pre>
115 If your annotation is in gtf format as in the example, don't forget to include the intron lines!<br><br>
116 <span class="assignment">Rerun</span> <tt>hal2maf_split.pl</tt> using the parameter <tt>--no_split_list</tt> to pass <span class="result"><tt>no_split_list.txt</tt></span>
117 <pre class="code">
118 hal2maf_split.pl --halfile vertebrates.hal --refGenome hg38 --cpus 8 \
119 --chunksize 50000 --overlap 25000 --no_split_list no_split_list.txt --outdir mafs_good_split
120 </pre>
121 This will generate the directory <span class="result"><tt>mafs_good_split/</tt></span> that
122 contains the following MAF alignments
123 <pre class="code">
124 -rw-r--r-- 1 stefanie bioinf 707K May 25 18:17 chr16.0-91311.maf
125 -rw-r--r-- 1 stefanie bioinf 442K May 25 18:17 chr16.173067-210154.maf
126 -rw-r--r-- 1 stefanie bioinf 913K May 25 18:17 chr16.45035-173067.maf
127 -rw-r--r-- 1 stefanie bioinf 1013K May 25 18:17 chr16.91311-207894.maf
128 </pre>
129 Observe that when using the <tt>--no_split_list</tt> option, the maximum chunk size is not always respected.
130 </div>
131
132 <a href="javascript:onoff('msl')" class="dlink"><span id="msl" title="msld" class="dcross">[+]</span>
133 <span class="dtitle">splitting MAF alignments...</span></a> <br>
134 <div id="msld" class="details" style="display:none;">
135 Let's assume you already have a vetted whole-genome alignment in MAF format.
136 You can split it similarily to HAL alignments into overlapping alignment chunks.
137 Let <tt>hg38</tt> be the reference genome in <tt>aln.maf</tt>.
138 <pre class="code">
139 REF="hg38"
140 </pre>
141 <span class="assignment">Create</span> a tab-separated list of reference chromosomes/scaffolds of and their lengths
142 <pre class="code">
143 grep "^s $REF" aln.maf | perl -ne '@a=split(/\s+/,$_); $a[1]=~s/.*\.//; print "$a[1]\t$a[5]\n";' | sort -u &gtseqlist
144 </pre>
145 <span class="assignment">Cut</span> <tt>aln.maf</tt> into overlapping pieces with the auxiliary tool <tt>filterMaf.pl</tt> from the <tt>scripts/</tt> folder in the Augustus package.
146 <pre class="code">
147 mkdir mafs
148
149 CHUNKSIZE=2500000
150 OVERLAP=500000
151 cat seqlist | while read line
152 do
153 SEQ=$(echo "$line" | cut -f 1)
154 CHRLEN=$(echo "$line" | cut -f 2)
155 for ((start=0; start&ltCHRLEN; start+=(CHUNKSIZE-OVERLAP))); do
156 end=$((start+CHUNKSIZE))
157 if [ $end -ge $CHRLEN ]; then
158 end=$CHRLEN
159 fi
160 filterMaf.pl --interval=${REF}.${SEQ}:$start-$end &ltaln.maf &gtmafs/${SEQ}:$start-$end.maf
161 done
162 done
163 </pre>
164 </div>
165 </br>
166
167 <h2 id="makeHub">3. Build a comparative assembly hub</h2>
168 <pre class="code">
169 hal2assemblyHub.py vertebrates.hal vertHub --lod \
170 --alignability --gcContent \
171 --hub vertCompHub --shortLabel VertebratesCompHub \
172 --maxThreads=10 --longLabel "Vertebrates Comparative Assembly Hub"
173 </pre>
174 Manually <span class="assignment">edit</span> the .html files in the <span class="result"><tt>vertHub/</tt></span> directory, if desired.
175
176 <h2 id="loadHub">4. Load the hub and browse the alignment</h2>
177 <span class="assignment">Copy</span> the <span class="result"><tt>vertHub/</tt></span> directory to a web directory:
178 <pre class="code">
179 scp -r vertHub/ stefanie@greifweb1:/var/www/bioinf/htdocs/stefanie/cgp-tutorial/
180 </pre>
181
182 <span class="assignment">Go</span> to the UCSC Genome Browser <a href="http://genome-euro.ucsc.edu/cgi-bin/hgHubConnect">Track Data Hubs</a> page and paste your <a href="http://bioinf.uni-greifswald.de/bioinf/stefanie/cgp-tutorial/vertHub/hub.txt"><tt>hub.txt</tt></a> url into the "My Hubs" tab.
183 Select a species as reference (e.g. hg38) and click "Go".<br><br>
184
185 <img src="figs/hub.png" width="40%" height="40%"/>
186
187 <h2 id="loadAnno">5. Upload a reference annotation to the hub</h2>
188
189 <span class="assignment">Convert</span> the <a href="data/refseq/refseq.hg38.gtf">hg38 RefSeq annotation</a> to BED format and place it in a folder with the name of the genome
190 <pre class="code">
191 mkdir refseq/hg38
192 gtf2bed.pl &ltrefseq/refseq.hg38.gtf &gtrefseq/hg38/refseq.bed --itemRgb=25,25,112
193 </pre>
194 Specify any RGB color you like for the track with option <tt>--itemRgb</tt>, e.g. <span style="color:rgb(25,25,112);">25,25,112.</span><br>
195 <span class="assignment">Rerun</span> the hal2assemblyHub.py script. Include gene tracks with option --bedDirs.
196 <pre class="code">
197 rm -r jobTree # delete job data from previous run
198 hal2assemblyHub.py vertebrates.hal vertHub --lod \
199 --alignability --gcContent \
200 --hub vertCompHub --shortLabel VertebratesCompHub \
201 --bedDirs refseq \
202 --tabBed \
203 --maxThreads=10 --longLabel "Vertebrates Comparative Assembly Hub"
204 </pre>
205 For further information on the specification of parameter <tt>--bedDirs</tt>, read section <a href="https://github.com/glennhickey/hal/tree/master/assemblyHub#annotations-provided-by-users">'Annotations provided by users'</a> in the assemblyHub manual.<br><br>
206 <a href="javascript:onoff('tah')" class="dlink"><span id="tah" title="tahd" class="dcross">[+]</span>
207 <span class="dtitle">hal2assemblyHub troubleshooting...</span></a> <br>
208 <div id="tahd" class="details" style="display:none;">
209 If the <tt>hal2assemblyHub.py</tt> script returns immediately without error message. Delete the jobTree folder and rerun it again.
210 <pre class="code">
211 rm -r jobtree
212 </pre>
213 Make sure that all auxiliary tools, e.g <tt>hgGcPercent</tt>, are in the global path. If not export
214 <pre class="code">
215 export PATH=/home/stefanie/tools/progressiveCactus/bin:/home/stefanie/tools/progressiveCactus/submodules/kentToolBinaries:$PATH
216 export PYTHONPATH=/home/stefanie/tools/progressiveCactus/submodules:$PYTHONPATH
217 </pre>
218 </div><br>
219 <span class="assignment">Repeat</span> <a href="cactus.html#loadHub">4. Load the hub and browser the alignment</a>.<br>
220 The new track, should be visible in the 'VertebratesCompHub Track Settings' menu, enable it if necessary.<br><br>
221
222 <img src="figs/menu.png" width="40%" height="40%"/>
223 </body>
224 </html>