Package: ikiss
Table of ContentsAbout iKISS1. Install dependencies and clone iKISS1.1 Installing in cluster mode1.2 Installing in local mode2. Running a datatest2.1 In CLUSTER mode2.2 In LOCAL mode3. Running your data3.1. Adapt config.yaml3.1.1 WORKFLOW section3.1.2 PARAMS section=> 1. KMERS_MODULE=> 2. PCADAPT=> 3. LFMM=> 4. MAPPING_KMERS=> 5. ASSEMBLY_KMERS=> 6. INTERSECT3.2. Adapt cluster_config.yamlRULES4. Running iKISS5. iKISS outputAuthorsContributeursThanksLicenseHomepage:https://forge.ird.fr/diade/iKISSAbout iKISSiKISS (Kmer Inference sSelection)is a snakemake pipeline able to decompose reads into kmers and extract kmers under selection.iKISS uses KmersGWAShttps://github.com/voichek/kmersGWAS, pcadapthttps://cran.r-project.org/web/packages/pcadapt/readme/README.htmland lfmmhttps://bcm-uga.github.io/lfmm/articles/lfmmto select genomics regions under selection.1. Install dependencies and clone iKISSCheck dependencies for iKISS : python and singularityInstall  singularity and python3 in your local machine OR use module load to add singularity and python3 in your environment if you are working in a cluster :moduleloadsystem/python/3.8.12moduleloadsystem/singularity/3.6.0iKISS is NOW available as a PyPI package (recommended)python3-mpipinstallikissOR you can also install iKISS from git repositorypython3-mpipinstallikiss@git+https://forge.ird.fr/diade/iKISS.git#ORgitclonehttps://forge.ird.fr/diade/iKISS.gitcdiKISSpython3-mpipinstall.1.1 Installing in cluster modeInstall iKISS in cluster mode usingsingularitycontainer from ikiss_utilitieshttps://itrop.ird.fr/ikiss_utilities/ikissinstall_cluster--helpikissinstall_cluster--schedulerslurm--envsingularity1.2 Installing in local modeikissinstall_local--helpikissinstall_local2. Running a datatestRunning test with a datatest from iKISS_utilities in a repertory TESTikisstest_install--helpikisstest_install-dTEST2.1 In CLUSTER modeLaunching suggested command line done by iKISS, in CLUSTER mode :Please run command line ‘ikiss create_cluster_config’ before the first run and modify theads, ram, node and computer ressources.
iKISS do a copy of cluster_config.yaml file into your home “/home/$USER/.config/ikiss/cluster_config.yaml”ikissrun_cluster--helpikisscreate_cluster_configIf singularity was selected in installation of iKISS, it could be needed to give argument –singularity-args "–bind $HOME" to Snakemake, by using :ikissrun_cluster--helpikissrun_cluster-cTEST/data_test_config.yaml--singularity-args"--bind$HOME"# @IFBikissrun_cluster-cTEST/data_test_config.yaml--singularity-args"--bind /shared:/shared"#you can also use snakemake parametters as --rerun-incomplete --nolockImportant Note: In i-Trop cluster, run iKISS using ONLY a node, data has to be in “/scratch” of chosen node. Usenodelist : nodeXparametter inside of cluster_config.yaml file.2.2 In LOCAL modelaunching suggested command line done by iKISS, in LOCAL mode:ikissrun_local--helpikissrun_local-t8-cTEST/data_test_config.yaml--singularity-args"--bind$HOME"In local mode, its possible to allocate threads to some rules using–set-threadssnakemake argument such asikissrun_local-t8-cTEST/data_test_config.yaml--set-threadskmers_gwas_per_sample=4mapping_kmers=2filter_bam=2kmer_position_from_bam=4pcadapt=2extract_kmers_from_bed=23. Running your data3.1. Adapt config.yamlBefore to run iKISS, adaptconfig.yamlby using :ikisscreate_configAdaptconfig.yamlfile with path to fastq files (FASTQ) and outfile (OUTPUT) in theDATAsection.DATA:FASTQ:'./DATATEST/fastq'OUTPUT:'./OUTPUT-KISS/':warning if yours reads are ilumina paired, you need rename reads SAMPLE_R1.fastq.gz and SAMPLE_R2.fastq.gz. For single reads use SAMPLE_R1.fastq.gziKISS uses compressed ans decompressed fastq files.3.1.1 WORKFLOW sectionParameter iKISS steps using the section WORKFLOW and parameter it with the PARAMS sections.In WORKFLOW section:KMERS_GWAS step has to be activated by default.PCADAPT, LFMM, MAPPING or ASSEMBLY are optional. Active or deactivate these steps using true or false.KMERS_GWASconvert reads in kmers, filter them and create a format ready to use in population genomics!PCADAPTdetects genetic markers (kmers here ^^) involved in biological adaptation and provides outlier detection based on Principal Component Analysis (PCA).LFMMis used by iKISS for testing correlations between kmers and environmental data.MAPPING_KMERScan optionally be used to align kmers to a genomic reference (if it is available ! ).ASSEMBLY_KMERScan optionally assembly significant kmers obtained by pcadapt or lfmmINTERSECTcan optionally calculate how many kmers (if MAPPING_KMERS is activated ) or contigs(if ASSEMBLY_KMERS is activated) are found in FEATURES (gene by default)WORKFLOW:KMERS_MODULE:truePCADAPT:trueLFMM:trueMAPPING_KMERS:trueASSEMBLY_KMERS:trueINTERSECT:True3.1.2 PARAMS sectionIn the PARAMS section, tools parameters can be modified and adapted.=> 1. KMERS_MODULEKMERS_GWAS module decompose reads into kmers and create a binary table of presence/absence of kmers. This table can be filter to use only most informative kmers into the populations. PLINK format outfiles are obtained in this module.PARAMS:KMERS_MODULE:KMER_SIZE:31MAC:2P:0.2MAF:0.05B:1000000# nb kmers in each bed fileSPLIT_LIST_SIZE:100000MIN_LIST_SIZE:50000KMER_SIZEis the length of kmers (should be between 15-31)MACis the minor allele count (min allowed appearance of a kmer)Pis the minimum percent of appearance in each strand formMAFis the minimum allele frequencyBis the number of kmers in each bed fileSPLIT_LIST_SIZEis the nb of kmers by bed fileMIN_LIST_SIZEindicates the minimal number of kmers allowed in the smaller bed file after splitting=> 2. PCADAPTPCADAPT detects kmers involved in biological adaptation and provides outlier detection based on Principal Component Analysis (PCA)PARAMS:PCADAPT:K:2SAMPLES:"samples.txt"CORRECTION:'FDR'ALPHA:0.05K: number K of principal componentsSAMPLES: you need to generate asamples.txtfile.  This file contains two columns (tab delimitations) : accession_id and phenotype_value. It will be used by PCADAPT.accession_id: contains exactly same name of samples in FASTQ.phenotype_value(int): contains sample group (wild=1, cultivated=2 for example)accession_idgroupClone122Clone142Clone162Clone202Clone21Clone41Clone81CORRECTION: kmers outliers are obtained using a correction of BONFERONNI, BH or FDR model.ALPHA: modify the alpha cutoff for outlier detection=> 3. LFMMLFMM is used by iKISS for testing correlations between kmers and environmental data.PARAMS:LFMM:K:2PHENOTYPE_FILE:"pheno.txt"PHENOTYPE_PCA_ANALYSIS:falseCORRECTION:'BH'ALPHA:0.05Kare the latent factors used in LFMM association analysesPHENOTYPE_FILE: an phenotype file is obligatory in LFMM analysis. You can give to iKISS PCA results, climate variables, etc.A PCA can reveal some ‘structure’ in the genotype data and it could help you to fix K parameter.PHENOTYPE_PCA_ANALYSISIfPHENOTYPE_PCA_ANALYSISis true, iKISS automatically run PCA using the file given by user in the PHENOTYPE_FILE key. This PHENOTYPE_FILE can be a PCA result for example.IfPHENOTYPE_PCA_ANALYSISis false, iKISS use directly the PHENOTYPE_FILE as ‘phenotype’ to LFMM analysis. Kmers are used as ‘genotype’ data.Here, a example of a phenotype file with climate variablesaccession_idgroupb2.Mean_Diurnal_Rangeb3.Isothermalityb4.Temp_Seasonalityb5.Max_Temp_of_Warmest_Monthb6.Min_Temp_of_Coldest_Monthb7.Temp_Annual_Rangeb8.Mean_Temp_of_Wettest_Quarterb9.Mean_Temp_of_Driest_Quarterb10.Mean_Temp_of_Warmest_Quarterb11.Mean_Temp_of_Coldest_Quarterb12.Annual_Precipitationb13.Precipitation_of_Wettest_Monthb14.Precipitation_of_Driest_Monthb15.Precipitation_Seasonalityb16.Precipitation_of_Wettest_Quarterb17.Precipitation_of_Driest_Quarterb18.Precipitation_of_Warmest_Quarterb19.Precipitation_of_Coldest_QuarterClone1229968123031016614425022625822614622493685731754917Clone14210068123530115514624121724821715252593676031857518Clone16293651389310168142250223258223141626407357985448Clone2021545539554031232802962343152141186201841070450Clone211525536174031282752872423162201738001671530180Clone411685157194148632831520132218120120166180170Clone81NANANANANANANANANANANANANANANANANANACORRECTION: kmers outliers are obtained using a correction of BONFERONNI, BH or FDR model.ALPHA: modify the alpha cutoff for outlier detection=> 4. MAPPING_KMERSMAPPING_KMERS section in PARAMS can optionally be used to align kmers to a genomic reference. It could give a idea of selected regions in a genome.PARAMS:MAPPING_KMERS:REF:"reference.fasta"MODE:bwa-alnINDEX_OPTIONS:""OPTIONS:"-n0.04"FILTER_FLAG:4FILTER_QUAL:10Use a reference file in theREFsection.ParametterMODEusingbwa-alnorbwa-mem2Set up theINDEX_OPTIONSaccording to the MODE you have chosen.Ifbwa-mem2leaf emptyIfbwa-aln“-a bwtsw” or “”Set options according of chosen mapper in theOPTIONSkey.Ifbwa-mem2default parameters -A 1 -B 4;Ifbwa-aln-n 0.04Obtained bam could be filtered usingFILTER_FLAG(-F 4 by default) andFILTER_QUAL(mapq>10 by defaut) params.=> 5. ASSEMBLY_KMERSASSEMBLY_KMERS section in PARAMS can optionally be used to assembly significant kmers obtained by pcadapt or/and lfmm.Contigs are assembled by iKISS using  mergeTags from dekupl packagehttps://github.com/Transipedia/dekupl-mergeTags.Chose minimal overlap size “OVERLAP_SIZE” allowed to assembly kmers.Feel free to filter contigs by size “FILTER_CONTIG_SIZE”.Assembled contigs could be mapped activatingMAPPING_CONTIGS. This mapping can be launch versus aREFreference file using bwa-mem2 by default.
Reference file used in this step can be a different reference fromMAPPING_KMERSoptions. Feel free of change parametters of mapping usingMAPPING_OPTIONSAssembled contigs could be used by blastn against a database, you can also try to annotate them!PARAMS:ASSEMBLY:OVERLAP_SIZE:15FILTER_CONTIG_SIZE:100MAPPING_CONTIGS:True# if MAPPING_CONTIGS is activate, ikiss maps contigs vs REF using bwamem2REF:'reference.fasta'MAPPING_OPTIONS:""=> 6. INTERSECTiKISS uses bedtools intersect to calculate how many kmers/contigs are mapped inFEATURES(gene by default).TheseFEATURESare filtered from the annotationGFFfileb before use bedtools intersect.iKISS filtered kmers/contigs by usingFILTER_MAPQ_STATSand minimal kmers/contigs numberFILTER_MIN_STATSby FEATURE.PARAMS:INTERSECT:GFF:'reference.gff'FEATURE:'gene'FILTER_MAPQ_STATS:'15'3.2. Adapt cluster_config.yamlIf you will run ikiss in cluster, adaptcluster_config.yaml:ikissedit_cluster_configInsidecluster_config.yaml, adapt partition to your favorite cluster and change memory and cpu number in by__default__key or in rules you need :__default__:cpus-per-task:4mem-per-cpu:10Gpartition:"normal"nodelist:node19output:'slurm_logs/stdout/{rule}/{wildcards}.o'error:'slurm_logs/error/{rule}/{wildcards}.e'job-name:'{rule}.{wildcards}'kmers_gwas_per_sample:cpus-per-task:4mem-per-cpu:10GRULESHere you can quickly find iKISS snakemake rules list :rulekmers_gwas_per_sample*rulekmers_to_userulekmers_tableruleextract_kmers_from_bedruleindex_refruleindex_ref_to_assemblyrulemapping_kmersrulefilter_bamrulekmer_position_from_bam*rulemerge_kmer_positionrulesamtools_mergerulepcadapt*rulemerge_methodruleoutliers_positionruleextracting_features_from_gffrulekmers_bedtools_intersectruleget_pca_from_phenotyperulelfmm*rulemergetagsrulemapping_contigsrulecontigs_bedtools_intersectruleintersect_and_contigsruleintersect_and_outliersrulefastq_statsrulereport_ikissrulehtml_ikissrules with a*can be parallelised.4. Running iKISSRun iKISS byikiss run_localorikiss run_clusteras explained in “Running a datatest” section.5. iKISS outputThis is a overwiew of iKISS output directory:OUTPUT-KISS/config_corrected.yaml0.FASTQ_STATS└──fastq_stats.txt1.KMERS_MODULE├──Clone12├──Clone14├──Clone16├──Clone2├──Clone20├──Clone4└──Clone82.KMERS_TABLE├──kmers_list_paths.txt├──kmers_table.names├──kmers_table.table├──kmers_to_use├──kmers_to_use.no_pass_kmers├──kmers_to_use.shareness├──kmers_to_use.stats.both├──kmers_to_use.stats.only_canonical└──kmers_to_use.stats.only_non_canonical3.TABLE2BED├──log├──output_file.0.bed├──output_file.0.bim├──output_file.0.fam├──output_file.1.bed├──output_file.1.bim├──output_file.1.fam├──output_file.2.bed├──output_file.2.bim├──output_file.2.fam├──output_file.3.bed├──output_file.3.bim├──output_file.3.fam├──output_file.4.bed├──output_file.4.bim└──output_file.4.fam4.EXTRACT_FASTA├──output_file.0.fasta.gz├──output_file.1.fasta.gz├──output_file.2.fasta.gz├──output_file.3.fasta.gz└──output_file.4.fasta.gz5.RANGES├──output_file.0├──output_file.1├──output_file.2├──output_file.3└──output_file.46.LFMM├──output_file.0_10_LFMM_outliers.csv├──output_file.0_10_LFMM_pvalues.csv├──output_file.0_10_LFMM.rplot.pdf...6.LFMM_PHENO├──PCA_from_phenotype.csv├──PCA_from_phenotype.html└──PCA_from_phenotype.ipynb6.PCADAPT├──output_file.0_10_PCADAPT_outliers.csv├──output_file.0_10_PCADAPT_pvalues.csv├──output_file.0_10_PCADAPT.rplot.pdf├──output_file.0_10_PCADAPT_scores.csv...7.MERGED_LFMM├──merged_LFMM_outliers.csv└──merged_LFMM_pvalues.csv7.MERGED_PCADAPT├──merged_PCADAPT_outliers.csv└──merged_PCADAPT_pvalues.csv8.MAPPING_KMERS├──bam_files.txt├──output_file.0_vs_reference.bam├──output_file.0_vs_reference_FMQ.bam├──output_file.0_vs_reference.sai├──output_file.0_vs_reference_sorted.bam├──output_file.0_vs_reference_sorted.bam.bai├──output_file.0_vs_reference_sorted.bam.idxstats├──output_file.0_vs_reference_sorted.bam.stats...9.KMERPOSITION├──output_file.0_vs_reference_KMERPOSITION.txt├──output_file.1_vs_reference_KMERPOSITION.txt├──output_file.2_vs_reference_KMERPOSITION.txt├──output_file.3_vs_reference_KMERPOSITION.txt└──output_file.4_vs_reference_KMERPOSITION.txt10.MERGE_KMERPOSITION├──kmer_position_merged.txt└──kmer_position_samtools_merge.bam11.OUTLIERS_LFMM_POSITION└──outliers_with_position.csv11.OUTLIERS_PCADAPT_POSITION└──outliers_with_position.csv12.ASSEMBLY_OUTLIERS_LFMM├──contigs_LFMM_vs_reference.bam├──contigs_LFMM_vs_reference.sorted.bam├──contigs_LFMM_vs_reference.sorted.bam.bai├──contigs_LFMM_vs_reference.sorted.bam.idxstats├──contigs_LFMM_vs_reference.sorted.bam.stats├──outliers_LFMM_mergetags.csv└──outliers_LFMM_mergetags.fasta12.ASSEMBLY_OUTLIERS_PCADAPT├──contigs_PCADAPT_vs_reference.bam├──contigs_PCADAPT_vs_reference.sorted.bam├──contigs_PCADAPT_vs_reference.sorted.bam.bai├──contigs_PCADAPT_vs_reference.sorted.bam.idxstats├──contigs_PCADAPT_vs_reference.sorted.bam.stats├──outliers_PCADAPT_mergetags.csv└──outliers_PCADAPT_mergetags.fasta13.GFF_FEATURES└──extracted.gff14.CONTIGS_INTERSECT_LFMM└──contigs_intersect_annotation.bed14.CONTIGS_INTERSECT_PCADAPT└──contigs_intersect_annotation.bed14.KMERS_INTERSECT└──kmers_bedtools_intersect_annotation.bed15.CONTIGS_LFMM_INTERSECT└──global_intersect_stats15.CONTIGS_PCADAPT_INTERSECT└──global_intersect_stats15.OUTLIERS_LFMM_INTERSECT├──global_intersect_stats└──outliers_intersect_stats15.OUTLIERS_PCADAPT_INTERSECT├──global_intersect_stats└──outliers_intersect_statsREF├──reference2.fasta├──reference2.fasta.0123├──reference2.fasta.amb├──reference2.fasta.ann├──reference2.fasta.bwt.2bit.64├──reference2.fasta.pac├──reference.fasta├──reference.fasta.amb├──reference.fasta.ann├──reference.fasta.bwt├──reference.fasta.pac└──reference.fasta.saREPORT├──iKISS_report.csv├──iKISS_report.html├──iKISS_report.ipynb├──PCA_from_phenotype.html└──PCA_from_phenotype.ipynbBENCHMARKLOGSNote : we recommended to remove 1.KMER_GWAS repertory after analysis.AuthorsJulie Orjuela (IRD) develops iKISSYves Vigouroux (IRD) is the big boss with a lot of ideas and contributions!ContributeursDjamel Boubred (Bioinformatics Student at IRD) and Tram VI (Ph.D student IRD) have also contributed by debugging and test with rice and coffea datasets.Sebastien Ravel has also contributed with the snakecdysis python package developpement.ThanksThanks to Ndomassi Tando (i-Trop IRD) for his administration support.The authors acknowledge the IRD i-Trop HPC (South Green Platform) from IRD Montpellier for providing HPC resources that contributed to this work.https://bioinfo.ird.fr/-http://www.southgreen.frLicenseLicensed under MIT.Intellectual property belongs to IRD and authors.iKISS uses recycled code from the culebrONT project of SouthGreen platformhttps://culebront-pipeline.readthedocs.io/en/latest/.
iKISS uses SnakEcdysis packagehttps://snakecdysis.readthedocs.io/en/latest/package.htmlto perform installation and execution in local and cluster mode.