| 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">main AugCGP tutorial</a>. |
| 8 | <a href="cactus.html">Cactus alignments and assembly Hubs</a>. |
| 9 | <a href="de_novo.html">AugCGP de novo</a>. |
| 10 | <a href="liftover.html">Annotation transfer with AugCGP</a>. |
| 11 | <a href="rnaseq+liftover.html">Combining RNA-Seq and annotation evidence</a>. |
| 12 | <a href="hgm.html">Cross-species consistency of gene sets</a>. |
| 13 | </font> |
| 14 | <div align="right">Show <a href="javascript:allOn()">all</a> / <a href="javascript:allOff()">no</a> details.</div> |
| 15 | |
| 16 | <h1>RNA-Seq-based prediction with Augustus-cgp</h1> |
| 17 | |
| 18 | This tutorial describes how RNA-Seq data can be incorporated into Augustus-cgp. |
| 19 | In general, the same types of extrinsic evidence can be incorporated as in single-species gene finding with Augustus (including RNA-Seq, cDNA, ESTs, protein sequences, etc). In cgp mode, evidence is species-specific an can be incorporated for each or a subset of genomes. |
| 20 | |
| 21 | <h2 id="rnaseq2hints">1. Generate hints from RNA-Seq</h2> |
| 22 | |
| 23 | For most species raw RNA-Seq data (in fastq format) is readly available and can be downloaded |
| 24 | from the <a href="http://www.ncbi.nlm.nih.gov/sra">NCBI Sequence Read Archive (SRA)</a>.<br><br> |
| 25 | |
| 26 | |
| 27 | <a href="javascript:onoff('tp')" class="dlink"><span id="tp" title="tpd" class="dcross">[+]</span> |
| 28 | <span class="dtitle">Some advice on how to choose the RNA-Seq libraries...</span></a> <br> |
| 29 | <div id="tpd" class="details" style="display:none;"> |
| 30 | <ul> |
| 31 | <li> whenever possible, choose paired-end RNA-Seq reads</li> |
| 32 | <li> pay attention to the timeliness of the data. More recent studies generally use |
| 33 | better sequencing technologies and can produce longer reads.<br> |
| 34 | A read length of at least 2x100 bps is recommended.</li> |
| 35 | <li> check in the protocol, how rRNA is removed. Rather use Poly(A) tagged libraries than |
| 36 | Ribo-Zero depleted libraries, as the latter contain all kinds of non-coding elements and may also |
| 37 | have a high coverage in introns and intergenic regions.</li> |
| 38 | </ul> |
| 39 | </div> |
| 40 | <br> |
| 41 | |
| 42 | In order to integrate RNA-Seq into Augustus, the usual procedure involves |
| 43 | <ul> |
| 44 | <li> aligning RNA-Seq reads to the source genome with a spliced-aligner (f.e. <a href="https://github.com/alexdobin/STAR">STAR</a>)</li> |
| 45 | <li> quality and uniqueness filtering of alignments with <tt>filterBam</tt></li> |
| 46 | <li> generation of intron hints with <tt>bam2hints</tt></li> |
| 47 | <li> generation of exonpart hints with <tt>bam2wig</tt> and <tt>wig2hints.pl</tt></li> |
| 48 | </ul> |
| 49 | We will skip this procedure as it is explained in detail in other tutorials (see section 'RNA-Seq integration' in the <a href="http://bioinf.uni-greifswald.de/bioinf/wiki/pmwiki.php?n=Augustus.Augustus">Augustus Wiki</a>)<br> |
| 50 | and assume that we have generated <a href="data/hints/" >hints files</a> for some of the species (chicken, human, mouse and rhesus) in our clade. |
| 51 | |
| 52 | <h2 id="loadRNASeq">2. Load RNA-Seq hints into the SQLite database</h2> |
| 53 | |
| 54 | <span class="assignment">Prepare</span> a text file with a list of species names and location of |
| 55 | the corresponding hints files.<br><br> |
| 56 | |
| 57 | <a href="javascript:onoff('cft')" class="dlink"><span id="cft" title="cftd" class="dcross">[+]</span> |
| 58 | <span class="dtitle">file format...</span></a> <br> |
| 59 | <div id="cftd" class="details" style="display:none;"> |
| 60 | <pre class="code"> |
| 61 | name_of_genome_1 path/to/hintsfile_1 |
| 62 | name_of_genome_2 path/to/hintsfile_2 |
| 63 | ... |
| 64 | name_of_genome_N path/to/hintsfile_N |
| 65 | </pre> |
| 66 | </div> |
| 67 | </br> |
| 68 | |
| 69 | <pre class="code"> |
| 70 | for f in $PWD/hints/*.gff; do echo -ne "$(basename $f .hints.gff)\t$f\n"; done >hints.tbl |
| 71 | </pre> |
| 72 | |
| 73 | The file <span class="result"><tt>hints.tbl</tt></span> will now look like this (except for the parent directory)<br> |
| 74 | <pre class="code"> |
| 75 | galGal4 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/hints/galGal4.hints.gff |
| 76 | hg38 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/hints/hg38.hints.gff |
| 77 | mm10 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/hints/mm10.hints.gff |
| 78 | rheMac3 /var/www/augustus/htdocs/binaries/tutorial-cgp/data/hints/rheMac3.hints.gff |
| 79 | </pre> |
| 80 | |
| 81 | If you don't have a database with the genomes, yet, <span class="assignment">follow</span> the instructions in |
| 82 | <a href="de_novo.html#loadFa">1. Load genomes ...</a><br> |
| 83 | to create the database <tt>vertebrates.db</tt>.<br><br> |
| 84 | <span class="assignment">Make</span> a copy of the database |
| 85 | <pre class="code"> |
| 86 | cp vertebrates.db vertebrates_rnaseq.db |
| 87 | </pre> |
| 88 | and <span class="assignment">load</span> the hints into the new database |
| 89 | <pre class="code"> |
| 90 | while read line |
| 91 | do |
| 92 | species=$(echo "$line" | cut -f 1) |
| 93 | hints=$(echo "$line" | cut -f 2) |
| 94 | load2sqlitedb --noIdx --species=$species --dbaccess=vertebrates_rnaseq.db $hints |
| 95 | done <hints.tbl |
| 96 | </pre> |
| 97 | <span class="assignment">Finalize</span> database by creating indices on the tables |
| 98 | <pre class="code"> |
| 99 | load2sqlitedb --makeIdx --dbaccess=vertebrates_rnaseq.db |
| 100 | </pre> |
| 101 | You can <span class="assignment">check</span> if loading was successful with following |
| 102 | database query |
| 103 | <pre class="code"> |
| 104 | sqlite3 -header -column vertebrates_rnaseq.db "\ |
| 105 | SELECT count(*) AS '#hints',typename,speciesname\ |
| 106 | FROM (hints as H join featuretypes as F on H.type=F.typeid)\ |
| 107 | natural join speciesnames\ |
| 108 | GROUP BY speciesid,typename;" |
| 109 | </pre> |
| 110 | that returns a summary of how many hints of each type are in the database for each species. |
| 111 | <pre class="code"> |
| 112 | #hints typename speciesname |
| 113 | ---------- ---------- ----------- |
| 114 | 3368 exonpart galGal4 |
| 115 | 129 intron galGal4 |
| 116 | 7905 exonpart hg38 |
| 117 | 267 intron hg38 |
| 118 | 7930 exonpart mm10 |
| 119 | 378 intron mm10 |
| 120 | 11050 exonpart rheMac3 |
| 121 | 265 intron rheMac3 |
| 122 | </pre> |
| 123 | |
| 124 | <h2 id="extrinsic">3. Prepare an extrinsic config file</h2> |
| 125 | |
| 126 | Start by <span class="assignment">copying</span> following extrinsic configuration file: |
| 127 | <pre class="code"> |
| 128 | cp ${AUGUSTUS_CONFIG_PATH}/extrinsic/extrinsic-cgp.cfg extrinsic-rnaseq.cfg |
| 129 | </pre> |
| 130 | <span class="assignment">Open</span> the <tt>extrinsic-rnaseq.cfg</tt> file with a text editor, |
| 131 | <span class="assignment">go</span> to the first <tt>[GROUP]</tt> section and replace the next line |
| 132 | <pre class="code"> |
| 133 | [GROUP] # replace 'none' by the names of genomes with src=W and src=E hints in the database |
| 134 | none |
| 135 | </pre> |
| 136 | as instruced by the names of genomes with RNA-Seq hints, i.e. |
| 137 | <pre class="code"> |
| 138 | [GROUP] # replace 'none' by the names of genomes with src=W and src=E hints in the database |
| 139 | hg38 mm10 rheMac3 galGal4 |
| 140 | </pre> |
| 141 | <a href="javascript:onoff('cfg')" class="dlink"><span id="cfg" title="cfgd" class="dcross">[+]</span> |
| 142 | <span class="dtitle">format of the extrinsic.cfg file in cgp mode ...</span></a> <br> |
| 143 | <div id="cfgd" class="details" style="display:none;"> |
| 144 | In cgp mode hints can be integrated for multiple species. |
| 145 | In order to have different extrinsic config settings for different species, |
| 146 | multiple <tt>[GENERAL]</tt> tables are specified. Each table is followed by a <tt>[GROUP]</tt> section, |
| 147 | a single line, in which a subset of the species is listed, for which the table is valid. |
| 148 | Use the same species identifiers as in the genome alignment and in the phylogenetic tree. |
| 149 | If a species is not assigned to any of the tables, all hints for that species are |
| 150 | ignored. To assign all species to a single table, the key 'all' can be used instead of itemizing |
| 151 | every single species identifier. Use the key 'other' to specify a table for all species, not |
| 152 | listed in any previous table. |
| 153 | Note that the source RM must be specified in case that the softmasking option is turned on. |
| 154 | Also note that all tables have the same dimension, i.e. each table must contain all sources |
| 155 | listed in the section <tt>[SOURCES]</tt>, even sources for which no hints exist for any of species |
| 156 | in group. |
| 157 | </div> |
| 158 | </br> |
| 159 | |
| 160 | <h2 id="runAug">4. Run AUGUSTUS-CGP with RNA-Seq hints</h2> |
| 161 | |
| 162 | <span class="assignment">Create</span> a new folder for the rnaseq experiments and |
| 163 | <span class="assignment">switch</span> to the new directory |
| 164 | <pre class="code"> |
| 165 | mkdir augCGP_rnaseq |
| 166 | cd augCGP_rnaseq |
| 167 | </pre> |
| 168 | For convenience <span class="assignment">assign</span> each alignment chunk to a job ID by |
| 169 | creating softlinks |
| 170 | <pre class="code"> |
| 171 | num=1 |
| 172 | for f in ../mafs/*.maf; do ln -s $f $num.maf; ((num++)); done |
| 173 | </pre> |
| 174 | <span class="assignment">Run</span> Augustus with retrieval of hints from the |
| 175 | database (~3min).<br> |
| 176 | <pre class="code"> |
| 177 | for ali in *.maf |
| 178 | do |
| 179 | id=${ali%.maf} # remove .maf suffix |
| 180 | augustus \ |
| 181 | --species=human \ |
| 182 | --softmasking=1 \ |
| 183 | --treefile=../tree.nwk \ |
| 184 | --alnfile=$ali \ |
| 185 | --dbaccess=../vertebrates_rnaseq.db \ |
| 186 | --speciesfilenames=../genomes.tbl \ |
| 187 | --alternatives-from-evidence=0 \ |
| 188 | --dbhints=1 \ |
| 189 | --UTR=1 \ |
| 190 | --allow_hinted_splicesites=atac \ |
| 191 | --extrinsicCfgFile=../extrinsic-rnaseq.cfg \ |
| 192 | --/CompPred/outdir=pred$id > aug$id.out 2> err$id.out & |
| 193 | done |
| 194 | </pre> |
| 195 | The option <tt>UTR=1</tt> enables the UTR model and is recommended whenever 'exonpart' hints are incorporated.<br><br> |
| 196 | |
| 197 | This will generate the folders <span class="result"><tt>pred*/</tt></span> (one for each alignment chunk) |
| 198 | that contain gff files with gene predictions for each input genome. |
| 199 | <pre class="code"> |
| 200 | bosTau8.cgp.gff |
| 201 | canFam3.cgp.gff |
| 202 | galGal4.cgp.gff |
| 203 | hg38.cgp.gff |
| 204 | mm10.cgp.gff |
| 205 | monDom5.cgp.gff |
| 206 | rheMac3.cgp.gff |
| 207 | rn6.cgp.gff |
| 208 | </pre> |
| 209 | |
| 210 | Note that the parallelization with the bash '&' command above is quite simple and rather for demonstration purposes.<br> |
| 211 | For real applications with several hundreds or thousands of alignment chunks, we recommend to |
| 212 | run job arrays on a compute cluster. |
| 213 | |
| 214 | <h2 id="abinitiopred"><a href="de_novo.html#merge">5. Merge gene predictions from parallel runs</a></h2> |
| 215 | |
| 216 | <h2 id="makeBeds">6. Upload gene predictions into the assembly hub</h2> |
| 217 | <span class="assignment">Convert</span> the final gene predictions from gff to BED format and place |
| 218 | each BED file in a separate folder with the name of the corresponding genome. It is important that directory names are consistent with the names in the HAL alignment. |
| 219 | <pre class="code"> |
| 220 | for f in joined_pred/*.gff |
| 221 | do |
| 222 | mkdir "$(basename $f .gff)" |
| 223 | gtf2bed.pl <$f >$(basename $f .gff)/augCGP_rnaseq.bed --itemRgb=34,139,34 |
| 224 | done |
| 225 | </pre> |
| 226 | Specify any RGB color you like for the track with option <tt>--itemRgb</tt>, e.g. <span style="color:rgb(34,139,34);">34,139,34.</span><br> |
| 227 | The name of the current directory (i.e. <tt>augCGP_rnaseq</tt>) will be used as track name on the browser.<br> |
| 228 | |
| 229 | <span class="assignment">Switch</span> back to the main working directory <tt>data/</tt> |
| 230 | <pre class="code"> |
| 231 | cd .. |
| 232 | </pre> |
| 233 | and rerun the <tt>hal2assemblyHub.py</tt> script. Include gene tracks with option <tt>--bedDirs</tt> |
| 234 | |
| 235 | <pre class="code"> |
| 236 | hal2assemblyHub.py vertebrates.hal vertHub --lod \ |
| 237 | --alignability --gcContent \ |
| 238 | --hub vertCompHub --shortLabel VertebratesCompHub \ |
| 239 | --bedDirs augCGP_rnaseq \ |
| 240 | --tabBed \ |
| 241 | --maxThreads=10 --longLabel "Vertebrates Comparative Assembly Hub" |
| 242 | </pre> |
| 243 | You can also include gene tracks from other exercises by passing a comma-separated list of directories e.g. |
| 244 | <tt>--bedDirs refseq,augCGP_denovo,augCGP_rnaseq,augCGP_liftover,...</tt><br><br> |
| 245 | <span class="assignment">Repeat</span> <a href="cactus.html#loadHub">4. Load the hub and browser the alignment</a>.<br> |
| 246 | </body></html> |