Skip to content

Barcoding tools

Olivo Miotto edited this page Jun 14, 2017 · 22 revisions

Process

The Barcoding tools are a little different from the other tools in that the do not access the BAM file directly, but rather they use VCFs which are created from BAM files from other tools. Hence the process is as follows:

  1. For each sample, we run samtools mpileup (from samtools v1.3) to create a VCF file containing the allele read depths at each SNP in a master list (the SNPs we want in the barcode)
  2. We then run the Barcoding tools to use the read counts in the VCFs to produce genotypes and then concatenate them in the desired order to form barcodes.

SNP List files

We need a list of SNPs that are concatenated to form the barcode. Indeed the list has to be in two different forms:

  • <SNPLIST_NAME>.tab - a tab-separated table of barcoding positions. This has one header line, then one line per barcoding position, in the desired barcode order. The table must have at least two columns, named "Chr" and "Pos", containing the chromosome ID and the position of the barcode variation within the chromosome, respectively. Any additional columns are ignored. The following is an example:
Num     Chr             Pos     Ref     Nonref
1       Pf3D7_02_v3     376222  A       G
2       Pf3D7_02_v3     470013  G       A
3       Pf3D7_03_v3     656861  T       G
[...]
  • <SNPLIST_NAME>.bed - a BED file of barcoding positions. This is needed by samtools and is encoded in the BED format: a space-separate table (no header line), one line per barcode variation, ordered by genomic position. Each line contains three fields: the chromosome ID, and the start and end positions of the barcode variation. For SNPs, the end position is the same as the position in the <SNPLIST_NAME>.tab file (see above), while the start position is one position earlier. [NOTE: as soon as I get round to it, I'll make a tool to generate the BED file from the SNP list automatically]. The following is an example of BED file, corresponding to the SNP list file shown above:
Pf3D7_02_v3 376221 376222
Pf3D7_02_v3 470012 470013
Pf3D7_03_v3 656860 656861
[...]

VCF file generation

We produce one VCF file per sample using samtools, but then the file is reheadered (to fix the sample name) using bcftools. The commands are as follows:

samtools mpileup -I -R -C50 -d 1000 -f <REF_FASTA_FILE> -l <BED_FILE> -v -t AD,DP \
                 -o <RAW_VCFFILE> <BAM_FILE>
bcftools reheader -s <SAMPLE_NAMEFILE> -o <FINAL_VCFFILE> <RAW_VCFFILE>

Clone this wiki locally