Autocycler combine - rrwick/Autocycler GitHub Wiki

Basics

This is the final step in an Autocycler assembly, where the resolved sequences for each cluster are combined into a single assembly.

Example command

autocycler combine -a autocycler_out -i autocycler_out/clustering/qc_pass/cluster_*/5_final.gfa

This command takes an Autocycler directory and one or more cluster graphs (typically 5_final.gfa). It will create consensus_assembly.fasta, consensus_assembly.gfa and consensus_assembly.yaml files in the Autocycler directory.

Full usage

Usage: autocycler combine [OPTIONS] --autocycler_dir <AUTOCYCLER_DIR> --in_gfas <IN_GFAS>...

Options:
  -a, --autocycler_dir <AUTOCYCLER_DIR>  Autocycler directory (required)
  -i, --in_gfas <IN_GFAS>...             Autocycler cluster GFA files (one or more required)
  -r, --reads <READS>...                 Reads in FASTQ format to set consentig depths [default: none]
      --depth_kmer <DEPTH_KMER>          K-mer size used for read-based depths [default: 19]
  -t, --threads <THREADS>                Number of CPU threads [default: 8]
  -h, --help                             Print help
  -V, --version                          Print version

Notes

  • While Autocycler combine is typically run using each cluster's final graph (5_final.gfa), it can also be run on earlier graphs (e.g. 4_merged.gfa) if desired.
  • If --reads are provided, then the consensus_assembly.fasta file will contain depth information (e.g. depth=87.3). Otherwise, there will be no depth information in the FASTA file.
  • --depth_kmer and --threads are only used when --reads are provided. Otherwise, they have no effect.

Read depth

Prior to running Autocycler combine, depth (defined by the DP:f: tag in the GFA files) has been defined in terms of input assemblies. E.g. if a tig has a depth of 12, that means it occurs 12 times in the input contigs. These depths are not always whole numbers, because when sequences are merged together, the merged sequence takes a length-weighted mean of their depths. If you run Autocycler combine without providing reads, this will still be true for the combined assembly outputs (consensus_assembly.*).

However, for genome assemblies, 'depth' usually means read depth. So if you do provide reads (via --reads), then the depths in the combined assembly will be read depths. For most users and situations, this is probably preferable.

In order to quickly assign read depths to sequences, Autocycler combine does the following:

  • Identifies all non-repeat k-mers in the consensus assembly, which will be used to determine depth. Repeat k-mers (occur multiple times in the consensus assembly) are ignored.
  • Counts the occurrences of the consensus assembly's k-mers in the read set.
  • Assigns each sequence a depth using the winsorised mean of its non-repeat k-mer counts, i.e. the mean after any unusually high counts are reduced to a limit.
  • To account for read errors, the depths are then scaled up. A read k-mer only matches the assembly if it is error-free, so the scaling factor is derived from the fraction of read k-mers which are found in the assembly and the length of the read.

Other notes:

  • While it would be typical to use the same read set as was used to generate the assembly, this is not required. For example, you could use ONT reads to generate the Autocycler assembly but then use Illumina reads at this step to assign the depth.
  • The default k-mer size is 19. This is large enough that most k-mers in the assembly will not be repeats (and are therefore able to be used for depth) but small enough that exact matches should occur with sufficient frequency in most long-read sets.
  • K-mers which span the links between tigs are used as well, so tigs shorter than the k-mer size can still be given a depth. A tig only misses out if all of its k-mers are repeats or if its part of the graph is too short to contain a k-mer. Such tigs get read_depth: unavailable in consensus_assembly.yaml and depth=unavailable in their consensus_assembly.fasta header. In consensus_assembly.gfa they get a depth of zero, as the GFA format requires the depth tag to be a number, so the GFA cannot distinguish them from tigs which the reads genuinely gave a depth of zero.
  • Reads which have too few k-mers in common with the consensus assembly are excluded, so contamination doesn't affect the depths. If no reads at all match, Autocycler combine will quit with an error.

Toy example

(The toy example is introduced on the Autocycler compress page.)

Since both of the clusters in the toy example were successfully resolved into a single circular consentig, Autocycler combine simply creates a single assembly with both of these consentigs.

autocycler combine

⚠️ **GitHub.com Fallback** ⚠️