TITLE: Genotyping chip data lift-over to reference genome build GRCh38/hg38
AUTHORS: Kalle Pärn, Javier Nunez Fontarnau, Marita A. Isokallio, Timo Sipilä, Elina Kilpelainen, Aarno Palotie, Samuli Ripatti, Priit Palta

[DESCRIPTION]
<div class = "text-blocks"></div>

[STEPS]
?. [Genome build lift-over]
If the genotyping chip used an older reference genome version (e.g. GRCh37/hg19) and is in PLINK format, the data have to be lifted over to human genome build version 38 (GRCh38/hg38).For the genome build lift-over we suggest Will Rayner's method.Download your genotyping chip specific build 38 zip file (strand and position files) and 'update_build.sh' script from: http://www.well.ox.ac.uk/~wrayner/strand/To download the files:If the genotyping chip platform information is lost, you can try Chipendium to identify the platform based on your data. See Will Rayner's web page for more information: http://mccarthy.well.ox.ac.uk/chipendium/ui/IMPORTANT NOTES:• 'update_build.sh' uses hardcoded command 'plink', make sure you have exported the path correctly or replace the plink commands with full path to your PLINK v1.9 installation.• The method assumes the chip data in Illumina TOP strand format. If this is not the case, you might need to use ILMN or SOURCE strand files, as instructed on the Will Rayner's web page, or follow the optional steps to fix potential issues.Uncompress the downloaded files and use the .strand file to run the script with the command below.Input files:
• DATASET = input file prefix of PLINK format files (.bed, .bim, .fam)
• .zip strand files corresponding the genotyping chip• .strand corresponding the unzipped genotyping chip .strand file• OUTPUT = output file prefix of PLINK format files (.bed, .bim, .fam)Output files:
• OUTPUT.bed• OUTPUT.bim• OUTPUT.fam
?. [Lift-over verification]
To confirm the successful genome build lift-over, chip data allele frequencies are compared against the reference data allele frequencies. In this step, chip data allele frequency file is generated.We define the VCF-style frequency file format for GRCh38/hg38 as follows:CHR - Chromosome code (with 'chr' tag, e.g. 'chr1')SNP - Variant identifier in format CHR_POS_REF_ALTREF - Reference allele (A, C, G, T)ALT - Alternative allele (A, C, G, T)AF - Allele frequency (values from 0 to 1)Convert the chip data files to VCF with Plink v2 using the reference genome fasta file to force the correct reference alleles. Calculate the AF values and generate the frequency file.Input files (from Step 2):• DATASET.bed• DATASET.bim• DATASET.famOutput files:• DATASET.vcf.gz• DATASET_AF.vcf.gz• DATASET.frqFor the most accurate solution, use Plink v2 and BCFtools as follows:Step 3.1Step 3.2QUICK'n'DIRTY ALTERNATIVE WAY TO GENERATE THE FREQUENCY FILEQuick and dirty way is to use Plink v1.9 and awk to generate the correct format AF file as indicated in the protocol Version 1 Step 3 (it is accessible by pressing the Version 2 button on the top left corner of this protocol).Note: In that approach, the number of variants is duplicated and should be taken into consideration when evaluating the results with the plotting script in the next step!
?. [OPTIONAL: data consistency verification (PLINK format)]
Steps 11-13 are meant to tackle possible issues we have observed in various legacy data sets in PLINK format.If for some reason your .fam file does not include the sex information (e.g. a VCF converted to PLINK format files loses the sex information), this information need to be added into the .fam file from a separate file.Confirm that the sex information is present in the 5th column for all samples.If not, obtain the sex information from the original source of your data and update the .fam file as suggested in the comman below.Input files:• DATASET_genders.txt - containing FID and IID in the first two columns and sex information in the third column as 1 = male, 2 = female or 0 = ambiguous• DATASET.bed• DATASET.bim• DATASET.famOutput files:• DATASET_updated_genders.bed• DATASET_updated_genders.bim• DATASET_updated_genders.fam
?. [OPTIONAL: data consistency verification (PLINK format)]
Steps 11-13 are meant to tackle possible issues we have observed in various legacy data sets in PLINK format.Sometimes the alleles are marked for instance as 'B', and such variants should be excluded.Confirm that the alleles are in standard format i.e. A, C, G or T.If not, correct the inconsistency by removing variants with non-standard allele notation as suggested in the command below.Input files:• DATASET.bed• DATASET.bim• DATASET.famOutput files:• DATASET_Bvariantlist.txt• DATASET_clean.bed• DATASET_clean.bim• DATASET_clean.fam
?. [OPTIONAL: data consistency verification (PLINK format)]
Steps 11-13 are meant to tackle possible issues we have observed in various legacy data sets in PLINK format.Make sure no duplicate samples exist. Redundant individual IDs (IIDs) can cause some issues when working with VCF files. In case of duplicates, consider excluding them or adding a running number to those sample/individual IDs in the .fam file.Input file:• DATASET.famOutput file:• DATASET_nodups.fam
?. [Requirements and preparatory steps]
The protocol is aimed for lifting genotyping chip data from older reference genome build versions over to human reference genome build version GRCh38/hg38.The protocol is aimed for lifting PLINK format genotyping chip data from older reference genome build versions over to GRCh38/hg38 and to VCF format.For a 'quick and dirty' lift-over you can jump straight to Step 2 and only run that.For high-quality and verified results we strongly recommend running at least through Steps 1-4 and Steps 9-10, and if required, run also Steps 5-8.If your PLINK format files have issues (e.g. non-standard allele notations or missing genders), see Steps 11-13 for troubleshooting.Throughout the protocol we assume Bash shell.
This Step 1 defines the requirements for the protocol (e.g. required software packages and reference files) and suggests example commands how to process the files into suitable formats.1.0 Docker imagesWe have prepared docker images to ease up the preparatory steps depending on your application: genotype-liftover-imputation-protocols-lightgenotype-liftover-imputation-protocols-fullLight image contains the software packages installed (Step 1.1), the reference genome (Step 1.2.6) and example scripts to run commands in each step (Steps 2-9). Full image contains the software packages installed (Step 1.1), preprepared publically available reference files (as defined in Step 1.2) and example scripts to run commands in each step (Steps 2-9).Additional to this protocol, the images contain software packages and files required for genotype imputation protocol version 2:https://www.protocols.io/view/genotype-imputation-workflow-v3-0-xbgfijwThe docker images are available at Docker hub. To pull the image, use the command below and replace  with 'light' or 'full' according to which image you want: !! If you don't want to use Docker, you can install the software packages by yourself (Step 1.1), and either download preprepared files (below) or prepare the files by yourself (Step 1.2 and 1.3).Preprepared reference data (included into the docker images as listed above) are also available for separate downloading at:https://console.cloud.google.com/storage/browser/fimm-public-data/Imputation/ And example scripts how to run each step at:https://console.cloud.google.com/storage/browser/fimm-public-data/Imputation/dockers/genotype-chip-data-liftover-protocol/1.1 Software packages1.1.1 Download and install the software packages Required software packages are listed below with the versions that were used in the protocol below. However, use of the newest versions is recommended.PLINK v1.9 http://www.cog-genomics.org/plink/1.9/PLINK v2.0 (Jan 02 2019 or later version) https://www.cog-genomics.org/plink/2.0/R v3.4.1 (or later version) https://www.r-project.org/R package data.table https://github.com/Rdatatable/data.table/wiki/InstallationBCFtools v1.7 (or later version) http://www.htslib.org/download/ 1.1.3 Export the pathsOnce installed, export the correct paths to environment variable PATH.  BCFtools plugin usage requires environment variable BCFTOOLS_PLUGINS exported, e.g: 1.1.4 Install the R packageOnce R is installed, the 'data.table' package can be installed in R, e.g.: 1.2. Reference dataReference variant allele frequency file is required for comparison of the chip genotyped variant allele frequencies in order to identify possible allele swaps and variants with unexpected allele frequency discrepancies. Note: Chromosome notation in the reference data should follow the GRCh38/hg38 notations ('chr#' for autosomal chromosomes and 'chrX' for chromosome 23). 1.2.1 Obtain the reference variant allele frequency data
If population-specific data are available (e.g. from a corresponding WGS effort) using these data would be preferrable.Process the data as instructed in Steps 1.2.2-1.2.4. If population-specific reference data is not available, for instance 1000 Genomes Project (www.nature.com/articles/nature15393) data can be used instead.We have prepared (as described below in Steps 1.2.2-1.2.4) the 1000 Genomes Project GRCh38/hg38 data (downloaded from the EBI FTP site: ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/supporting/GRCh38_positions/) to generate variant allele frequency files for 1000GP ALL and EUR samples. The corresponding allele frequency files are available for downloading at our Google Cloud bucket: https://console.cloud.google.com/storage/browser/fimm-public-data/1000GP/If you use these files, you can skip creating the frequency file and jump to Step 1.3. Otherwise (if you want to create your own/alternative 1000GP-based custom reference frequency file), follow the steps below.  1.2.2 Check for multiallelic sitesConfirm that multiallelic sites (if present) in your reference data files are decomposed. If they are not, use the example command below to split the multiallelic sites into biallelic records:  1.2.3 Check the chromosome notationConfirm that the chromosome notation in your reference data files follows the GRCh38/h38 notations as 'chr#' for autosomal, 'chrX' for chromosome 23 and 'chrM' for mitochondrial sites. If not, use for instance bcftools to rename the chromosomes:  1.2.4 Generate the allele frequency fileGenerate a tab-delimited file of the reference data allele frequencies, one line per variant, with columns CHR, SNP (as CHR_POS_REF_ALT), REF, ALT, AF (including the header line). Use the reference data VCF files as input with the example command below and save the generated frequency file as 'ref_data.frq'.# Check your reference data VCF and if it does NOT contain AF in the INFO field, calculate it with BCFTools +fill-tags plugin  # Note: BCFTools plugins require environmental variable BCFTOOLS_PLUGINS exported export BCFTOOLS_PLUGINS=/path/to/bcftools/plugins_folder # Calculate AF for each chromosome VCF file for chr in {1..23}; do     bcftools +fill-tags ref_data_chr${chr}.vcf.gz -Oz -o ref_data_AF_chr${chr}.vcf.gz -- -t AF done  # Generate a tab-delimited header for the allele frequency file echo -e 'CHR\tSNP\tREF\tALT\tAF' > ref_data.frq  # Query the required fields from the reference VCF files and append to the allele frequency file for chr in {1..23}; do     bcftools query -f '%CHROM\t%CHROM\_%POS\_%REF\_%ALT\t%REF\t%ALT\t%INFO/AF\n' ref_data_chr${chr}.vcf.gz >> ref_data.frq doneNote: Chromosome notation should follow the GRCh38/hg38 notations ('chr#' for autosomal chromosomes and 'chrX' for chromosome 23).1.2.5 Generate a VCF file without genotypesIn an optional step, a reference VCF file containing RSIDs is required. To operate with smaller files, drop genotypes from your reference data for instance as indicated in the command below:  1.2.6 Reference genome fastaHomo Sapiens assembly hg38 version 0 is used here (match the reference genome always according to your reference data) and the required files are:Homo_sapiens_assembly38.fastaHomo_sapiens_assembly38.fasta.faiThe files are available for downloading at Broad Insitute storage in Google cloud at https://console.cloud.google.com/storage/browser/broad-references/hg38/v0/?pli=1  1.3. You are ready to start! As the last prepatory step, let's go over the required input data file(s) and also expected final output files!  1.3.1 Protocol input filesInput data is the chip genotype data in PLINK format (here v1.9).More details on the PLINK formats can be found at PLINK web page: http://www.cog-genomics.org/plink/1.9/formats .bed - binary representation of genotype calls .bim - extended variant information file including six columns:Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or nameVariant identifierPosition in morgans or centimorgans (safe to use dummy value of '0')Chromosomal base-pair coordinateAllele 1 (corresponding to clear bits in .bed; usually minor)Allele 2 (corresponding to set bits in .bed; usually major) .fam - sample information file including six columns:Light image contains the software packages installed (Step 1.1), the reference genome (Step 1.2.6) and example scripts to run commands in each step (Steps 2-9). Full image contains the software packages installed (Step 1.1), preprepared publically available reference files (as defined in Step 1.2) and example scripts to run commands in each step (Steps 2-9).Additional to this protocol, the images contain software packages and files required for genotype imputation protocol version 2:https://www.protocols.io/view/genotype-imputation-workflow-v3-0-xbgfijwThe docker images are available at Docker hub. To pull the image, use the command below and replace  with 'light' or 'full' according to which image you want:!! If you don't want to use Docker, you can install the software packages by yourself (Step 1.1), and either download preprepared files (below) or prepare the files by yourself (Step 1.2 and 1.3).Preprepared reference data (included into the docker images as listed above) are also available for separate downloading at:https://console.cloud.google.com/storage/browser/fimm-public-data/Imputation/And example scripts how to run each step at:https://console.cloud.google.com/storage/browser/fimm-public-data/Imputation/dockers/genotype-chip-data-liftover-protocol/1.1 Software packages1.1.1 Download and install the software packages Required software packages are listed below with the versions that were used in the protocol below. However, use of the newest versions is recommended.PLINK v1.9 http://www.cog-genomics.org/plink/1.9/PLINK v2.0 (Jan 02 2019 or later version) https://www.cog-genomics.org/plink/2.0/R v3.4.1 (or later version) https://www.r-project.org/R package data.table https://github.com/Rdatatable/data.table/wiki/InstallationBCFtools v1.7 (or later version) http://www.htslib.org/download/1.1.3 Export the pathsOnce installed, export the correct paths to environment variable PATH. BCFtools plugin usage requires environment variable BCFTOOLS_PLUGINS exported, e.g:1.1.4 Install the R packageOnce R is installed, the 'data.table' package can be installed in R, e.g.:1.2. Reference dataReference variant allele frequency file is required for comparison of the chip genotyped variant allele frequencies in order to identify possible allele swaps and variants with unexpected allele frequency discrepancies.Note: Chromosome notation in the reference data should follow the GRCh38/hg38 notations ('chr#' for autosomal chromosomes and 'chrX' for chromosome 23).1.2.1 Obtain the reference variant allele frequency data
If population-specific data are available (e.g. from a corresponding WGS effort) using these data would be preferrable.Process the data as instructed in Steps 1.2.2-1.2.4.If population-specific reference data is not available, for instance 1000 Genomes Project (www.nature.com/articles/nature15393) data can be used instead.We have prepared (as described below in Steps 1.2.2-1.2.4) the 1000 Genomes Project GRCh38/hg38 data (downloaded from the EBI FTP site: ftp://ftp.1000genomes.ebi.ac.uk/vol1/ftp/release/20130502/supporting/GRCh38_positions/) to generate variant allele frequency files for 1000GP ALL and EUR samples.The corresponding allele frequency files are available for downloading at our Google Cloud bucket: https://console.cloud.google.com/storage/browser/fimm-public-data/1000GP/If you use these files, you can skip creating the frequency file and jump to Step 1.3. Otherwise (if you want to create your own/alternative 1000GP-based custom reference frequency file), follow the steps below.1.2.2 Check for multiallelic sitesConfirm that multiallelic sites (if present) in your reference data files are decomposed. If they are not, use the example command below to split the multiallelic sites into biallelic records:1.2.3 Check the chromosome notationConfirm that the chromosome notation in your reference data files follows the GRCh38/h38 notations as 'chr#' for autosomal, 'chrX' for chromosome 23 and 'chrM' for mitochondrial sites. If not, use for instance bcftools to rename the chromosomes:1.2.4 Generate the allele frequency fileGenerate a tab-delimited file of the reference data allele frequencies, one line per variant, with columns CHR, SNP (as CHR_POS_REF_ALT), REF, ALT, AF (including the header line).Use the reference data VCF files as input with the example command below and save the generated frequency file as 'ref_data.frq'.Note: Chromosome notation should follow the GRCh38/hg38 notations ('chr#' for autosomal chromosomes and 'chrX' for chromosome 23).1.2.5 Generate a VCF file without genotypesIn an optional step, a reference VCF file containing RSIDs is required. To operate with smaller files, drop genotypes from your reference data for instance as indicated in the command below:1.2.6 Reference genome fastaHomo Sapiens assembly hg38 version 0 is used here (match the reference genome always according to your reference data) and the required files are:Homo_sapiens_assembly38.fastaHomo_sapiens_assembly38.fasta.faiThe files are available for downloading at Broad Insitute storage in Google cloud at https://console.cloud.google.com/storage/browser/broad-references/hg38/v0/?pli=1  1.3. You are ready to start! As the last prepatory step, let's go over the required input data file(s) and also expected final output files!  1.3.1 Protocol input filesInput data is the chip genotype data in PLINK format (here v1.9).More details on the PLINK formats can be found at PLINK web page: http://www.cog-genomics.org/plink/1.9/formats .bed - binary representation of genotype calls .bim - extended variant information file including six columns:Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or nameVariant identifierPosition in morgans or centimorgans (safe to use dummy value of '0')Chromosomal base-pair coordinateAllele 1 (corresponding to clear bits in .bed; usually minor)Allele 2 (corresponding to set bits in .bed; usually major) .fam - sample information file including six columns:The files are available for downloading at Broad Insitute storage in Google cloud at https://console.cloud.google.com/storage/browser/broad-references/hg38/v0/?pli=11.3. You are ready to start! As the last prepatory step, let's go over the required input data file(s) and also expected final output files!1.3.1 Protocol input filesInput data is the chip genotype data in PLINK format (here v1.9).More details on the PLINK formats can be found at PLINK web page: http://www.cog-genomics.org/plink/1.9/formats.bed - binary representation of genotype calls .bim - extended variant information file including six columns:Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or nameVariant identifierPosition in morgans or centimorgans (safe to use dummy value of '0')Chromosomal base-pair coordinateAllele 1 (corresponding to clear bits in .bed; usually minor)Allele 2 (corresponding to set bits in .bed; usually major) .fam - sample information file including six columns:.bim - extended variant information file including six columns:Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or nameVariant identifierPosition in morgans or centimorgans (safe to use dummy value of '0')Chromosomal base-pair coordinateAllele 1 (corresponding to clear bits in .bed; usually minor)Allele 2 (corresponding to set bits in .bed; usually major) .fam - sample information file including six columns:Chromosome code (either an integer, or 'X'/'Y'/'XY'/'MT'; '0' indicates unknown) or nameVariant identifierPosition in morgans or centimorgans (safe to use dummy value of '0')Chromosomal base-pair coordinateAllele 1 (corresponding to clear bits in .bed; usually minor)Allele 2 (corresponding to set bits in .bed; usually major) .fam - sample information file including six columns:Family ID ('FID')Within-family ID ('IID'; cannot be '0')Within-family ID of father ('0' if father isn't in dataset)Within-family ID of mother ('0' if mother isn't in dataset)Sex code ('1' = male, '2' = female, '0' = unknown)Phenotype value ('1' = control, '2' = case, '-9'/'0'/non-numeric = missing data if case/control)Family ID ('FID')Within-family ID ('IID'; cannot be '0')Within-family ID of father ('0' if father isn't in dataset)Within-family ID of mother ('0' if mother isn't in dataset)Sex code ('1' = male, '2' = female, '0' = unknown)Phenotype value ('1' = control, '2' = case, '-9'/'0'/non-numeric = missing data if case/control)1.3.2 Final protocol output files:The final file here is a VCF format file lifted over to human genome reference build 38 (GRCh38/hg38).
?. [Lift-over confirmation]
Once you have successfully lifted over your chip data, verify the lift-over by checking variant positions and alleles.For instance, compare the positions and alleles in your lifted data to known GRCh38/hg38 positions and alleles e.g. from dbSNP https://www.ncbi.nlm.nih.gov/SNP/.
?. [Lift-over verification]
Compare the chip data allele frequencies (created in Step 3) to the reference data allele frequencies (created in Step 1.2.4).Copy and save the R script below as 'compare_AF.R' and run it as suggested in the command below. The R script requires data.table package installed (for suggested instructions, see Step 1.1).
Inside the R script, intersection of the reference data and chip data variants (same SNP ID in format CHR_POS_REF_ALT) are formed and corresponding allele frequencies are plotted against each other.Here, we use 0.1 as a threshold for AF comparison i.e. if chip data AF differs more than 10 pp from the reference data AF, it is marked as discordant. However, less conservative values may be more suitable if a population specific reference data is not available.Input files:• DATASET.frq (Step 3)• ref_data.frq (Step 1.2.4)Output file:• DATASET_AF.png• *_comparison.txt a log file containing variant counts from the comparisonInspect the plot:See example plots at the section 'Expected results' below.Successful genome build lift-over:- Nearly all chip data variant allele frequencies correlate with the panel variant allele frequencies and data shows tight, uniform diagonal line with increasing slope 1.-> Continue with Step 9Unsuccessful genome build lift-over:- Some of the chip data variant allele frequencies correlate with the reference data variant allele frequencies, whereas some of the chip data show negative correlation with the reference data variant allele frequencies. Hence, an x-shaped plot is observed. These are likely incorrectly flipped variant alleles and/or ambiguous variant alleles with strand issues.- Large proportion of the chip data variants do not intersect with the reference data variants.-> Continue with Step 5 to reflip the problematic alleles.!! If needed, fix unsuccesful flipping as indicated in the following steps (Steps 5-8).Start by saving the R-script below as 'compare_AF.R.Run the above R Chip data compared to p script as follows:
?. [OPTIONAL: identify and fix flipping for ambiguous alleles (PLINK format)]
If an x-shaped plot was observed in Step 4 (or still after Step 5), likely some ambiguous alleles have been wrongly flipped. These may be identified by comparing the AF values to reference data AF and observing inverse values (e.g. most of those marked in red for the bad dataset in the expected results plot in Step 4). Extract ambiguous alleles with inverse AF from the frequency file (generated in Step 3) and flip them with plink v1.9. Input files:• DATASET.frq (Step 3)• ref_data.frq (Step 1.2.4)• DATASET.vcf.gz (Step 3)• DATASET.bed (Step 2 / Step 5)• DATASET.bim (Step 2 / Step 5)• DATASET.fam (Step 2 / Step 5)Output files:• DATASET_flippable_AF.txt• DATASET_ambiguous_for_flipping.rsid• DATASET_ambiguous_flipped.bed• DATASET_ambiguous_flipped.bim• DATASET_ambiguous_flipped.famStart by saving the R-script below as 'find_ambiguous.R':Run the 'find_ambiguous.R' as follows:Extract the RSIDs from the VCF file (generated in Step 3):Flip the ambiguous alleles in the lifted files (generated in Step 2 or Step 5) with plink v1.9:Confirm the results again as indicated in Step3 and Step4.
?. [OPTIONAL: identify and fix flipping for unambiguous alleles]
Align the VCF to the reference genome and identify multiallelic sites. Multiallelic sites are formed, when the reference allele at a position does NOT match with the reference genome base. Presumably due to wrong strand orientation in comparison to the lift-over strand file, those alleles were mistakenly flipped in Step 2. It is worthwhile to try to flip these variants again to restore the correct strand orientation.Input files:• DATASET.vcf.gz (Step 3)• DATASET.bed (Step 2)• DATASET.bim (Step 2)• DATASET.fam (Step 2)• ref_data.frq (Step 1.2.4)Output files:• DATASET_nonreference_alleles.rsid• DATASET_nonreference_flipped.bed• DATASET_nonreference_flipped.bim• DATASET_nonreference_flipped.famFirst, identify the sites with a wrong REF allele:Then, flip the identified sites with plink v1.9 (input files generated at Step 2):Finally, confirm the results again as indicated in Step3 and Step4.
?. [OPTIONAL: allele fixes based on reference data RSIDs (VCF format)]
More variants can be rescued by comparing the chip data sites to a reference data based on RSIDs. Here, it is important to note, that both datasets use the same RSID versions.Input files:• ref_data.vcf.gz (Step 1.2.5)• DATASET.vcf.gz (Step 3)Output files:• DATASET_fixref.vcf.gzUse the reference data RSIDs to correct chip data positions and alleles:Confirm the results again as indicated in Step3.2 and Step4.
?. [OPTIONAL: allele fixes based on reference data RSIDs (VCF format)]
Continue to fix the alleles with BCFtools fixref plugin by forcing allele flipping (use with caution and confirm the correctness of the results carefully!).Input files:• DATASET.vcf.gz (Step 7)Output files:• DATASET_fixref_force.vcf.gzUse BCFtools fixref plugin to force flipping as follows:Confirm the results again as indicated in Step3.2 and Step4.
?. [VCF format and reference genome alignment]
For any downstream processing, it is advisable to always confirm that your VCF data is aligned to the correct reference genome. As a final step, align the VCF to the reference genome and exclude variants which show wrong reference allele. The alignment also swaps alleles and left-aligns indels where required. To our experience, alignment sometimes forms duplicate records from indels, and thus, duplicate removal is added as a final step.If you have stopped the lift-over procedure in PLINK format steps and the downstream processes require VCF format, first convert the PLINK format files to VCF format as indicated in Step 3. Input files:• DATASET.vcf.gz (your final step taken)Output files:• DATASET_aligned.vcf.gzAlign to the reference genome with BCFtools, keep only bi-allelic sites (i.e. remove those where REF does not match the reference genome) and remove any duplicate records (considering CHR, POS, REF, ALT to preserve multiallelic sites if present):Confirm the results again as indicated in Step3 (ignore the Plink command and run only BCFtools command) and Step4.