FASTQ Sequence Files

December 15th, 2010

A good description of the FASTQ format can be found at Illumina:

"A fastq file is an ASCII encoded text file that stores DNA or RNA sequences and their corresponding IDs and quality scores. It uses unix newlines and consists of 4 lines per sequence unless wrapping occurs due to sequence length. The first line begins with an "@" followed by an identifier (ID) which acts as a label for the read/sequence, plus index and read (pair) numbers. Read numbers are 1 for single reads and 1 or 2 for paired reads. The second line represents a DNA or RNA sequence, and should consist only of standard bases, and IUPAC ambiguity codes (ACTGNURYSWKMBDHV). This line must be wrapped with newlines if the read is longer than 80nt. The third line must be a single "+" which signifies the end of the sequence, optionally followed by the identifier again. The fourth line is a quality score string showing the quality of each base in the prior sequence, represented as the ASCII character corresponding to the quality Phred score + 33. Phred scores must be 0 and 60 (ASCII chars 33 aka "!" to 93 aka "]"). The quality score must also be wrapped to multiple lines if longer than 80 characters, but must be exactly equal in length to it's corresponding sequence."

Example:

@READNAME[#index]/read_number

BASES

+READNAME[#index]/read_number

QUALITIES

As a sanity and QC check the DCC of the 1000 genomes project applies the following rules (source):
Syntax Checks:
-Each header line begins with @
-The third line always starts with a +
-There are four lines in each entry (implied by the above two rules)
-On line3, if a name follows the + sign, the name has to match the one found in line1
-The sequence and quality lines are the same length
-For paired end files, the _1 and _2 files have the same number of reads in them.
-For SOLID colourspace fastq, each read starts with a base followed by a string of numbers

Sequence Checks:
-Read is longer than 35bp for Solexa, 25bp for Solid, and 30 bp for 454
-Read does not contain any N's in the first 25, 30 or 35bp
-Quality values are all 2 or higher in the first 25bp, 30bp or 35bp
-The reads contain more than one type of base in the first 25, 30, or 35bp
-Read does not contain more than 50% Ns in its whole length
-Read does not contain characters other than ATGCN (this rule does not apply to SOLID reads)

Taking it further:

Ensembl Core Database Schema Diagram

November 26th, 2010

To understand the concept of Ensembl and learn how to query the tables I find it extremely useful to have a schema diagram of the database in front of me.

This can be generated by using the schema.sql and foreign_keys.sql files from the sql directory of the Ensembl API cvs checkout. After loading this data into a program like the free MySQL Workbench the tables and connections can be arranged to your liking.

Here is a pdf version I created based on Ensembl core 59 with the MySQL Workbench file.

UPDATE:
Nice schema diagrams and a description of the different tables can now be found on the Ensembl pages!

Genomic Start Coordinates

October 23rd, 2010

Adding to the confusion about different notations of phases/frames, the start coordinates of genomic features are also noted differently between different genome browsers and file formats.

1. One-based

Counting bases starting with "1" at the first position.

Regions are specified by a "closed interval." Used e.g. by the Ensembl genome browser and annotation system, the GFF/GTF, SAM and wiggle file formats.

2. Zero-based

The interbase system counts spaces starting with "0" at the first position.

Regions are specified by a "half-closed-half-open interval". Used by the UCSC genome browser, Chado (the fruitfly browser), the BED, BAM and PSL file formats.

An example:

    One-based


     1 2 3 4 5 6

     | | | | | |

     C G A T G C

    | | | | | | |

    0 1 2 3 4 5 6


    Zero-based

The ATG interval would be described from 3-5 in the first, from 2-5 in the second system.

Gene Models (and the Central Dogma of Molecular Biology)

October 23rd, 2010

What is a Gene Model?

I found the following text on the teaching pages of Prof. Ann Loraine and found it worth repeating (slightly modified) here:

Gene models are hypotheses about the structure of transcripts produced by a gene. Like all models, they may be correct, partly correct, or entirely wrong. Typically, with evidence-based gene-prediction programs, we use information from EST s (expressed sequence tags) , cDNAs or RNASeq reads to evaluate or create gene models. Alternatively models can be derived from the genomic sequence alone, looking for well-known characteristics (open-reading frames, splice-sites, stops, etc.) of the sequence of genes. This approach is called ab-initio gene prediction.

Itís important to remember at all times that a gene model is only that: a model.

To understand what a gene model represents, you need to refresh your memory about how transcription, RNA splicing, and polyadenylation operate.

Most protein-coding genes in eukaryotic organisms (like humans, the research plant Arabidopsis thaliana, fruit flies, etc.) are transcribed into RNA by an enzyme complex called RNA polymerase II, which binds to the five prime end of a gene in its so-called promoter region. The promoter region typically contains binding sites for transcription factors that help the RNA polymerase complex recognize the position in the genomic DNA where it should begin transcription. Many genes have multiple places in the genomic DNA where transcription can begin, and so transcripts arising from the same gene may have different five-prime ends. Transcripts arising from the same gene that have different transcription start sites are said to come from alternative promoters.

Once the RNA polymerase complex binds to the five prime end of gene, it can begin building an RNA copy of the DNA sense strand via the process known as transcription. The ultimate product of transcription is thus called a transcript. During and after transcription, another large complex of proteins and non-coding RNAs called the spliceosome attaches to the growing RNA molecule, cuts out segments of RNA called introns, and joins together (splices) the flanking sequences, which are called exons. Not every newly synthesized transcript is processed in this way; sometimes no introns are removed at all. Genes whose products do not undergo splicing are often called single ?exon genes.

Also, splicing may remove different segments from transcripts arising from the same gene. This variability in splicing patterns is called alternative splicing. In addition to splicing, RNA transcripts undergo another processing reaction called polyadenylation.

In polyadenylation, a segment of sequence at the 3-prime end of the RNA transcript is cut off, and a polymer consisting of adenosine residues called a polyA tail is attached to the 3-prime end of the transcript. The length of polyA tail may vary a lot from transcript to transcript, and the position where it is added may also differ. Genes whose transcripts can receive a polyA tail at more than one location are said to be subject to alternative polyadenylation or alternative 3?prime end processing. One of the functions of this polyA tail is thought to be increased stability of the transcript.

These processing reactions are believed to take place in the nucleus. Ultimately, most of the mature or maturing RNA transcripts are exported from the nucleus into the cytoplasm, where they will be translated by ribosomes into proteins, chains of amino acids that perform work in the cell (such as enzymes) or that provide form and structure (like actin in the cytoskeleton).

The continuous sequence of bases in an RNA that encode a protein is called a coding region, and the coding typically starts with an AUG codon and terminates with one of three possible stop codons. The segments of sequence that comprise a coding region are called CDSs and they generally occupy the same sequences as the exons, apart from the regions five and three prime of the start and stop codons, respectively.

Most RNAs code for one protein sequence, but there are some interesting exceptions in which one mature mRNA may contain more than one translated open reading frame. The three bases where the ribosome initiates translation are called a start codon and the triplet of bases immediately following the last translated codon are called the stop codon. The start codon encodes the amino acid methionine, typically, and the stop codon doesnít code for any amino acid.

A gene model thus consists of a collection of introns and exons and their locations in the genomic sequence, as well as the location of the translated region or region. Thus, a gene model implies a theory about where the RNA polymerase started transcription, as well as the location of the polyadenylation site and the starts and stops of translation. Usually, we draw gene models as showing the location of introns and exons relative to the genomic sequence, as if we are mapping the RNA copy back onto the genomic DNA itself.

This text nicely describes the classical central dogma of (molecular) biology (DNA -> RNA -> protein), what gene models are and some thoughts about gene prediction at the same time...

Repeat Finding and Masking

October 13th, 2010

What are genomic interspersed repeats? [from the RepeatMasker docu] In the mid 1960's scientists discovered that many genomes contain stretches of highly repetitive DNA sequences ( see Reassociation Kinetics Experiments, and C-Value Paradox ). These sequences were later characterized and placed into five categories:

  1. Simple Repeats - Duplications of simple sets of DNA bases (typically 1-5bp) such as A, CA, CGG etc.
  2. Tandem Repeats - Typically found at the centromeres and telomeres of chromosomes these are duplications of more complex 100-200 base sequences.
  3. Segmental Duplications - Large blocks of 10-300 kilobases which are that have been copied to another region of the genome.
  4. Interspersed Repeats
    1. Processed Pseudogenes, Retrotranscripts, SINES - Non-functional copies of RNA genes which have been reintegrated into the genome with the assitance of a reverse transcriptase.
    2. DNA Transposons
    3. Retrovirus Retrotransposons
    4. Non-Retrovirus Retrotransposons ( LINES )

Currently up to 50% of the human genome is repetitive in nature and as improvements are made in detection methods this number is expected to increase.

Software for repeat identification

  • The best known program is RepeatMasker (Adrian Smit, Washington University), that screens DNA sequences for interspersed repeats and low complexity DNA sequences. Sequence comparisons in RepeatMasker are performed by the program cross_match, an efficient implementation of the Smith-Waterman-Gotoh algorithm developed by Phil Green. Alternatively WU-BLAST can be used for faster processing. A web-based analysis can be carried out at repeatmasker.org, but the sequence size limit is 100kb here.
  • Recon and RepeatScout are other (less well-maintained) de novo repeat-finding software packages
  • Dust is a program for filtering low complexity regions from nucleic acid sequences, has been used within BLAST for many years. (Paper in J. Comp. Biol.)
  • TRF is the "Tandem repeats finder". (Paper in NAR)

The default parameters for RepeatMasker as part of the Ensembl gene-prediction pipeline e.g. mouse are:

-nolow -species mouse -s

Further reading: Table in Nature with different programs. See also Tarailo-Graovac and Chen "Using RepeatMasker to Identify Repetitive Elements in Genomic Sequences" in Current Protocols in Bioinformatics, March 2009. See also this RepeatMasker readme at animalgenome.org.