| 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="rnaseq.html">AugCGP with RNA-Seq</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>Annotation Liftover with Augustus-cgp</h1> |
| 17 | |
| 18 | An increasingly important strategy in genome annotation is the transfer of annotations from |
| 19 | well-annotated genomes to genomes of closely related species.<br> |
| 20 | In this tutorial, we will show how Augustus-cgp can be utilized for this particular application by |
| 21 | compiling the RefSeq annotation for human into 'CDS' and 'intron' hints. |
| 22 | |
| 23 | |
| 24 | <h2 id="refseq2hints">1. Generate 'CDS' and 'intron' hints from annotations</h2> |
| 25 | |
| 26 | Use the <a href="data/refseq/refseq.hg38.gtf">hg38 RefSeq annotation</a> (in gtf format) and convert it into gff format by |
| 27 | <span class="assignment">moving</span> stop codons into the coding sequence and <span class="assignment">including</span> intron lines. |
| 28 | <pre class="code" style="font-size:small"> |
| 29 | grep -P "\t(CDS|stop_codon|start_codon)\t" refseq/refseq.hg38.gtf | gtf2gff.pl --printIntron --includeStopInCDS --out=refseq/refseq.hg38.gff |
| 30 | </pre> |
| 31 | <a href="javascript:onoff('anno')" class="dlink"><span id="anno" title="annod" class="dcross">[+]</span> |
| 32 | <span class="dtitle">What if my annotation is not in GTF format? ...</span></a> <br> |
| 33 | <div id="annod" class="details" style="display:none;"> |
| 34 | You may have to adjust the previous command for annotations in any other format (GFF3, BED, GenePred, etc.). |
| 35 | Ensure that following items are respected |
| 36 | <ul> |
| 37 | <li> the stop codon is included in the terminal exon</li> |
| 38 | <li> 'CDS' and 'intron' features are required</li> |
| 39 | <li> ony include 'intron' features for introns between two CDS exons</li> |
| 40 | <li> coordinates are 1-based [start,end]</li> |
| 41 | </ul> |
| 42 | </div> |
| 43 | </br> |
| 44 | <span class="assignment">Grep</span> all CDS and intron lines and |
| 45 | <span class="assignment">replace</span> the last column in the gff by a manual source |
| 46 | <pre class="code"> |
| 47 | grep -P "\t(CDS|intron)\t" refseq/refseq.hg38.gff | cut -f1-8 | perl -pe 's/$/\tsource=M/' >refseq/hg38.hints.gff |
| 48 | </pre> |
| 49 | Finally, <span class="assignment">summarize</span> multiple identical hints into a single one with multiplicity |
| 50 | <pre class="code"> |
| 51 | sort -n -k 4,4 refseq/hg38.hints.gff | sort -s -n -k 5,5 | sort -s -n -k 3,3 | sort -s -k 1,1 | join_mult_hints.pl >temp |
| 52 | mv temp refseq/hg38.hints.gff |
| 53 | </pre> |
| 54 | |
| 55 | <h2 id="loadAnno">2. Load annotation hints into the database</h2> |
| 56 | |
| 57 | If you don't have a database with the genomes, yet, <span class="assignment">follow</span> the instructions in |
| 58 | <a href="de_novo.html#loadFa">1. Load genomes ...</a><br> |
| 59 | to create the database <tt>vertebrates.db</tt>.<br><br> |
| 60 | <span class="assignment">Make</span> a copy of the database |
| 61 | <pre class="code"> |
| 62 | cp vertebrates.db vertebrates_anno.db |
| 63 | </pre> |
| 64 | and <span class="assignment">load</span> the annotation hints into the new database |
| 65 | <pre class="code"> |
| 66 | load2sqlitedb --species=hg38 --dbaccess=vertebrates_anno.db refseq/hg38.hints.gff |
| 67 | </pre> |
| 68 | |
| 69 | You can <span class="assignment">check</span> if loading was successful with following |
| 70 | database query |
| 71 | <pre class="code"> |
| 72 | sqlite3 -header -column vertebrates_anno.db "SELECT count(*) AS '#hints',typename,speciesname FROM |
| 73 | (hints as H join featuretypes as F on H.type=F.typeid) natural join speciesnames group by speciesid,typename;" |
| 74 | </pre> |
| 75 | that returns a summary of how many hints of each type are in the database for each species. |
| 76 | <pre class="code"> |
| 77 | #hints typename speciesname |
| 78 | ---------- ---------- ----------- |
| 79 | 86 CDS hg38 |
| 80 | 78 intron hg38 |
| 81 | </pre> |
| 82 | |
| 83 | <h2 id="extrinsic">3. Prepare an extrinsic config file</h2> |
| 84 | |
| 85 | Start by <span class="assignment">copying</span> following extrinsic configuration file: |
| 86 | <pre class="code"> |
| 87 | cp ${AUGUSTUS_CONFIG_PATH}extrinsic/extrinsic-cgp.cfg extrinsic-anno.cfg |
| 88 | </pre> |
| 89 | <span class="assignment">Open</span> the <tt>extrinsic-anno.cfg</tt> file with a text editor, |
| 90 | <span class="assignment">go</span> to the second <tt>[GROUP]</tt> section and replace the following line |
| 91 | <pre class="code"> |
| 92 | [GROUP] # replace 'none' by the names of genomes with src=M hints in the database |
| 93 | none |
| 94 | </pre> |
| 95 | as instruced by the names of genomes with annotation hints, i.e. |
| 96 | <pre class="code"> |
| 97 | [GROUP] # replace 'none' by the names of genomes with src=M hints in the database |
| 98 | hg38 |
| 99 | </pre> |
| 100 | <a href="javascript:onoff('cfg')" class="dlink"><span id="cfg" title="cfgd" class="dcross">[+]</span> |
| 101 | <span class="dtitle">format of the extrinsic.cfg file in cgp mode ...</span></a> <br> |
| 102 | <div id="cfgd" class="details" style="display:none;"> |
| 103 | In cgp mode hints can be integrated for multiple species. |
| 104 | In order to have different extrinsic config settings for different species, |
| 105 | multiple <tt>[GENERAL]</tt> tables are specified. Each table is followed by a <tt>[GROUP]</tt> section, |
| 106 | a single line, in which a subset of the species is listed, for which the table is valid. |
| 107 | Use the same species identifiers as in the genome alignment and in the phylogenetic tree. |
| 108 | If a species is not assigned to any of the tables, all hints for that species are |
| 109 | ignored. To assign all species to a single table, the key 'all' can be used instead of itemizing |
| 110 | every single species identifier. Use the key 'other' to specify a table for all species, not |
| 111 | listed in any previous table. |
| 112 | Note that the source RM must be specified in case that the softmasking option is turned on. |
| 113 | Also note that all tables have the same dimension, i.e. each table must contain all sources |
| 114 | listed in the section <tt>[SOURCES]</tt>, even sources for which no hints exist for any of species |
| 115 | in group. |
| 116 | </div> |
| 117 | </br> |
| 118 | |
| 119 | <h2 id="runAug">4. Run AUGUSTUS-CGP with annotation hints</h2> |
| 120 | |
| 121 | <span class="assignment">Create</span> a new folder for the liftover experiments and |
| 122 | <span class="assignment">switch</span> to the new directory |
| 123 | <pre class="code"> |
| 124 | mkdir augCGP_liftover |
| 125 | cd augCGP_liftover |
| 126 | </pre> |
| 127 | For convenience <span class="assignment">assign</span> each alignment chunk to a job ID by |
| 128 | creating softlinks |
| 129 | <pre class="code"> |
| 130 | num=1 |
| 131 | for f in ../mafs/*.maf; do ln -s $f $num.maf; ((num++)); done |
| 132 | </pre> |
| 133 | <span class="assignment">Run</span> Augustus with retrieval of hints from the |
| 134 | database (~3min).<br> |
| 135 | <pre class="code"> |
| 136 | for id in *.maf |
| 137 | do |
| 138 | augustus \ |
| 139 | --species=human \ |
| 140 | --softmasking=1 \ |
| 141 | --treefile=../tree.nwk \ |
| 142 | --alnfile=$id \ |
| 143 | --dbaccess=../vertebrates_anno.db \ |
| 144 | --speciesfilenames=../genomes.tbl \ |
| 145 | --alternatives-from-evidence=0 \ |
| 146 | --dbhints=1 \ |
| 147 | --allow_hinted_splicesites=atac \ |
| 148 | --extrinsicCfgFile=../extrinsic-anno.cfg \ |
| 149 | --/CompPred/outdir=pred${id%.maf} > aug${id%.maf}.out 2> err${id%.maf}.out & |
| 150 | done |
| 151 | </pre> |
| 152 | This will generate the folders <span class="result"><tt>pred*/</tt></span> (one for each alignment chunk) |
| 153 | that contain gff files with gene predictions for each input genome. |
| 154 | <pre class="code"> |
| 155 | bosTau8.cgp.gff |
| 156 | canFam3.cgp.gff |
| 157 | galGal4.cgp.gff |
| 158 | hg38.cgp.gff |
| 159 | mm10.cgp.gff |
| 160 | monDom5.cgp.gff |
| 161 | rheMac3.cgp.gff |
| 162 | rn6.cgp.gff |
| 163 | </pre> |
| 164 | |
| 165 | Note that the parallelization with the bash '&' command above is quite simple and rather for demonstration purposes.<br> |
| 166 | For real applications with several hundreds or thousands of alignment chunks, we recommend to |
| 167 | run job arrays on a compute cluster. |
| 168 | |
| 169 | <h2 id="abinitiopred"><a href="de_novo.html#merge">5. Merge gene predictions from parallel runs</a></h2> |
| 170 | |
| 171 | <h2 id="makeBeds">6. Upload gene predictions into the assembly hub</h2> |
| 172 | <span class="assignment">Convert</span> the final gene predictions from gff to BED format and place |
| 173 | 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. |
| 174 | <pre class="code"> |
| 175 | for f in joined_pred/*.gff |
| 176 | do |
| 177 | mkdir "$(basename $f .gff)" |
| 178 | gtf2bed.pl <$f >$(basename $f .gff)/augCGP_liftover.bed --itemRgb=0,0,225 |
| 179 | done |
| 180 | </pre> |
| 181 | Specify any RGB color you like for the track with option <tt>--itemRgb</tt>, e.g. <span style="color:rgb(0,0,225);">0,0,225.</span><br> |
| 182 | The name of the current directory (i.e. <tt>augCGP_liftover</tt>) will be used as track name on the browser.<br> |
| 183 | |
| 184 | <span class="assignment">Switch</span> back to the main working directory <tt>data/</tt> |
| 185 | <pre class="code"> |
| 186 | cd .. |
| 187 | </pre> |
| 188 | and rerun the <tt>hal2assemblyHub.py</tt> script. Include gene tracks with option <tt>--bedDirs</tt> |
| 189 | |
| 190 | <pre class="code"> |
| 191 | hal2assemblyHub.py vertebrates.hal vertHub --lod \ |
| 192 | --alignability --gcContent \ |
| 193 | --hub vertCompHub --shortLabel VertebratesCompHub \ |
| 194 | --bedDirs augCGP_liftover \ |
| 195 | --tabBed \ |
| 196 | --maxThreads=10 --longLabel "Vertebrates Comparative Assembly Hub" |
| 197 | </pre> |
| 198 | You can also include gene tracks from other exercises by passing a comma-separated list of directories e.g. |
| 199 | <tt>--bedDirs refseq,augCGP_denovo,augCGP_rnaseq,augCGP_liftover,...</tt><br><br> |
| 200 | <span class="assignment">Repeat</span> <a href="cactus.html#loadHub">4. Load the hub and browser the alignment</a>.<br> |
| 201 | </body></html> |