<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Nextflow |</title><link>https://chtsai0105.github.io/tags/nextflow/</link><atom:link href="https://chtsai0105.github.io/tags/nextflow/index.xml" rel="self" type="application/rss+xml"/><description>Nextflow</description><generator>HugoBlox Kit (https://hugoblox.com)</generator><language>en-us</language><lastBuildDate>Fri, 22 May 2026 11:33:54 -0700</lastBuildDate><image><url>https://chtsai0105.github.io/media/icon_hu_6ea0838c0c3bf85b.png</url><title>Nextflow</title><link>https://chtsai0105.github.io/tags/nextflow/</link></image><item><title>Nextflow SNP calling workflow</title><link>https://chtsai0105.github.io/projects/nextflow/</link><pubDate>Fri, 22 May 2026 11:33:54 -0700</pubDate><guid>https://chtsai0105.github.io/projects/nextflow/</guid><description>&lt;p&gt;&lt;strong&gt;
&lt;/strong&gt; is an automated, scalable Nextflow pipeline engineered for high-throughput short-read variant calling, joint regenotyping, and cohort-scale population genomics.&lt;/p&gt;
&lt;p&gt;While standard GATK Best Practices offer sensitive joint genotyping across large cohorts, their Java-based architectures often incur heavy compute runtimes and high memory overhead. To solve this, &lt;strong&gt;
&lt;/strong&gt; implements an end-to-end workflow centered around &lt;strong&gt;BWA-MEM2&lt;/strong&gt;, &lt;strong&gt;SAMtools&lt;/strong&gt;, and &lt;strong&gt;BCFtools&lt;/strong&gt;—mimicking the two-pass rigor of GATK joint genotyping while maintaining the speed and low resource footprint of native C/C++ utilities.&lt;/p&gt;
&lt;hr&gt;
&lt;div class="mermaid"&gt;flowchart LR
subgraph " "
subgraph params
v9["meta"]
v0["ref_fasta"]
v4["cohort_id"]
end
v3{ }
v7([BWAMEM2_INDEX])
v11([FASTP])
v12([BWAMEM2_MEM])
v13([SAMTOOLS_FIXMATE])
v14([SAMTOOLS_SORT])
v15([SAMTOOLS_MARKDUP])
v17([SNPCALLING])
v19([BCFTOOLS_MERGE])
v21([FILTER])
v23([CHUNK_VCF])
v27([JOINT_REGENOTYPE])
v29([BCFTOOLS_CONCAT])
v31([FILTER_FINAL])
v33([BCFTOOLS_STATS])
subgraph s1[" "]
v4["cohort_id"]
v5([SAMTOOLS_FAIDX])
end
v0 --&gt; v3
v0 --&gt; v5
v4 --&gt; v5
v0 --&gt; v7
v4 --&gt; v7
v9 --&gt; v11
v0 --&gt; v12
v7 --&gt; v12
v11 --&gt; v12
v12 --&gt; v13
v0 --&gt; v14
v4 --&gt; v14
v13 --&gt; v14
v0 --&gt; v15
v4 --&gt; v15
v14 --&gt; v15
v0 --&gt; v17
v4 --&gt; v17
v15 --&gt; v17
v0 --&gt; v19
v17 --&gt; v19
v4 --&gt; v19
v19 --&gt; v21
v21 --&gt; v23
v0 --&gt; v27
v4 --&gt; v27
v23 --&gt; v27
v15 --&gt; v27
v27 --&gt; v29
v29 --&gt; v31
v31 --&gt; v33
v3 --&gt; s1
end
&lt;/div&gt;
&lt;p&gt;Steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Preprocessing &amp;amp; Alignment:&lt;/strong&gt; Raw paired-end reads undergo quality filtering and adapter trimming via &lt;code&gt;fastp&lt;/code&gt;, followed by indexing and alignment to the reference genome with &lt;code&gt;bwa-mem2&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Alignment Sanitization:&lt;/strong&gt; Mappings are processed through &lt;code&gt;samtools fixmate&lt;/code&gt; (retaining properly paired reads with &lt;code&gt;-m&lt;/code&gt;), coordinate-sorted via &lt;code&gt;samtools sort&lt;/code&gt;, and marked for duplicates using &lt;code&gt;samtools markdup&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Pass 1 — Per-Sample Discovery &amp;amp; Cohort Merge:&lt;/strong&gt; Individual candidate variant sites are called across each sample with &lt;code&gt;bcftools mpileup | bcftools call&lt;/code&gt; (haploid/custom ploidy supported). The resulting sample VCFs are merged across the cohort (&lt;code&gt;bcftools merge&lt;/code&gt;) and filtered (&lt;code&gt;QUAL &amp;gt;= 30&lt;/code&gt;, &lt;code&gt;AC &amp;gt; 0&lt;/code&gt;) to build an initial candidate site catalog.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;VCF Chunking &amp;amp; Parallel Regenotyping:&lt;/strong&gt; The merged candidate VCF is split into manageable genomic chunks (e.g., 50 kb intervals). All cohort BAMs are then re-evaluated in parallel against each chunk using &lt;code&gt;bcftools mpileup&lt;/code&gt; with target site forcing and &lt;code&gt;bcftools call -C alleles --insert-missed&lt;/code&gt; to recover marginal coverage, invariant reference alleles, and missing genotype states across every individual.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Concatenation &amp;amp; Final Quality Filtering:&lt;/strong&gt; The regenotyped chunks are assembled with &lt;code&gt;bcftools concat --naive&lt;/code&gt; and subjected to final strict filtering (&lt;code&gt;bcftools view -m2 -M2 -v snps -i 'AC&amp;gt;0 &amp;amp;&amp;amp; QUAL&amp;gt;=30'&lt;/code&gt;) to yield a high-confidence, biallelic SNP matrix.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Downstream Population Analytics:&lt;/strong&gt; The pipeline generates comprehensive summary metrics via &lt;code&gt;bcftools stats&lt;/code&gt; and produces indexed VCFs ready for direct integration into &lt;strong&gt;linkage disequilibrium (LD) decay assays&lt;/strong&gt;, population structure profiling (PCA/Admixture), and demographic modeling.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h3 id="highlights"&gt;Highlights&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Two-Pass Joint Genotyping Logic:&lt;/strong&gt; Combines cohort-wide candidate discovery with chunked, multi-sample regenotyping (&lt;code&gt;--insert-missed&lt;/code&gt;) to resolve reference calls and low-depth alleles without GATK JVM overhead.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Streamlined SAMtools/BCFtools Core:&lt;/strong&gt; Minimizes I/O bottlenecks and intermediate format conversions by chaining native command-line utilities.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;SLURM-Optimized Parallelism:&lt;/strong&gt; Features chunked parallel scatter/gather steps and pre-configured execution profiles (e.g., &lt;em&gt;Rhodotorula&lt;/em&gt; cohorts) tuned for high-performance computing clusters.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reproducible &amp;amp; Modular:&lt;/strong&gt; Implemented in Nextflow DSL2 using standard &lt;code&gt;nf-core&lt;/code&gt; modules, Conda environment integration, and automated dynamic resource allocation (&lt;code&gt;task.attempt&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;</description></item></channel></rss>