Tutorial

First steps with DNA sequences

Count bases, cut a gene out of a genome and read it from the other strand with seqtk. A gentle start for a class or for anyone new to sequence files. All in your browser.

What you will learn

  • Read a FASTA file and count its bases
  • Use a BED file to cut a region out of a genome
  • Reverse-complement a sequence
  • Recognise start and stop codons

The data

The genome of bacteriophage PhiX174 (NC_001422.1, 5,386 bp) and gene-G.bed, the position of gene G, which codes for the virus’s major spike protein.

Tools in this tutorial

seqtk
A small toolkit for FASTA and FASTQ files: counts reads and bases, reports base composition, extracts regions and reverse-complements sequences.

Watch it first

The whole tutorial in under 3 minutes, recorded in the live app. The run is sped up.

Steps

  1. 01

    Load the genome and the region

    Open the Workflow Builder at biochef.app. In File manager, upload phix174.fasta and gene-G.bed, and tick phix174.fasta for the Input node. New to the editor? The map reads tutorial shows each move with screenshots.

  2. 02

    Count the bases

    Search comp and add Comp (SEQTK); connect the genome to it and add an Output. seqtk comp reports, for each sequence, its length and how many A, C, G and T it has.

  3. 03

    Cut out one gene

    Select the genome Input and add Subseq (SEQTK): genome into in, a second Input with gene-G.bed into regions. The BED file holds one line: the sequence name, a start and an end. BED counts from 0, so 2394 2922 means positions 2395 to 2922. Add an Output.

  4. 04

    Read the other strand

    Select Subseq and add Seq (SEQTK). Switch on reverse_complement: DNA has two strands, and this writes the gene as read from the opposite one. Add an Output and press ▶.

    Workflow: genome into Comp (SEQTK) with an Output, and with the BED into Subseq (SEQTK) with an Output, then Seq (SEQTK) with an Output.
  5. 05

    Look at the gene

    Click the Subseq Output. The sequence starts with ATG, the start codon, and ends with TGA, a stop codon: this stretch of DNA codes for a protein, the major spike protein G.

    Output with gene G in FASTA format, named NC_001422.1:2395-2922, starting with ATG.

What you should see

name          length  A     C     G     T
NC_001422.1   5386    1291  1157  1254  1684

>NC_001422.1:2395-2922   528 bp, starts ATGTTTCAGACT…, ends …CTTAAGTGA
reverse complement       starts TCACTTAAGTGG…

Shortened here; seqtk comp prints more columns (ambiguous bases and CpG counts, among others). The genome is 44.76% G+C. Gene G is 528 bp: 176 codons, the last one a stop. Its reverse complement starts with TCA, the reverse complement of the stop codon TGA.

Use the finished workflow

Import the finished workflow, data included, and press ▶. Remember that an exported workflow contains the data loaded in its Input nodes.

Exercise: is the gene richer in G+C than the genome?

Add a second Comp (SEQTK) after Subseq, with its own Output, and run again. Gene G has A=106, C=114, G=108, T=200: 42.05% G+C, a little lower than the genome’s 44.76%.

Show the solution
Output of seqtk comp for gene G: length 528, A 106, C 114, G 108, T 200.

From a test to a full run

The browser is the place to build and test a workflow on small data like this. For full datasets, the same workflow file is meant to run next to the data with the BioChef agent, which is in development. See Workflows for how the two fit together.

More tutorials: all BioChef tutorials.

This tutorial is licensed under CC BY 4.0. If you use BioChef in your work, please cite Rosa et al., BMC Bioinformatics 2026. BioChef is listed in bio.tools as biotools:biochef.