Skip to content

Commit

Permalink
add PCA (to be renamed) subworkflow to the targene workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Olivier Labayle committed Jun 5, 2024
1 parent a204a32 commit 58a31e1
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 50 deletions.
2 changes: 1 addition & 1 deletion modules/simulations.nf
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ process NullSimulationEstimation {

process RealisticSimulationEstimation {
label 'simulation_image'
publishDir "${params.OUTDIR}/null_simulation_results", mode: 'symlink'
publishDir "${params.OUTDIR}/realistic_simulation_results", mode: 'symlink'

input:
path origin_dataset
Expand Down
5 changes: 4 additions & 1 deletion workflows/pca.nf
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,8 @@ workflow PCA {
GeneticConfounders(IIDGenotypes.out)

emit:
GeneticConfounders.out
traits = ExtractTraits.out
iid_genotypes = IIDGenotypes.out
pcs = GeneticConfounders.out

}
18 changes: 6 additions & 12 deletions workflows/simulations.nf
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,14 @@ workflow NULL_SIMULATION {
rngs = Channel.fromList(params.RNGS)
bgen_files = Channel.fromPath("$params.BGEN_FILES", checkIfExists: true).collect()

// Extract Traits
traits = EXTRACT_TRAITS()

// PCA
pcs = PCA()
PCA()

// generate main dataset and estimand configuration files
EstimationInputs(
bgen_files,
traits,
pcs,
PCA.out.traits,
PCA.out.pcs,
estimands_files,
bqtls_file,
transactors_files,
Expand Down Expand Up @@ -62,19 +59,16 @@ workflow REALISTIC_SIMULATION {
sample_sizes = Channel.fromList(params.SAMPLE_SIZES)
rngs = Channel.fromList(params.RNGS)
bgen_files = Channel.fromPath("$params.BGEN_FILES", checkIfExists: true).collect()

// Extract Traits
traits = EXTRACT_TRAITS()

// PCA
pcs = PCA()
PCA()

// Realistic Simulation Inputs
simulation_inputs = RealisticSimulationInputs(
estimands_files.collect(),
bgen_files,
traits,
pcs,
PCA.out.traits,
PCA.out.pcs,
ga_trait_table
)
dataset = simulation_inputs.dataset
Expand Down
45 changes: 9 additions & 36 deletions workflows/targene.nf
Original file line number Diff line number Diff line change
@@ -1,56 +1,29 @@
include { PCA } from './pca.nf'
include { EstimationInputs } from '../subworkflows/estimation_inputs.nf'
include { IIDGenotypes; GeneticConfounders } from '../subworkflows/confounders.nf'
include { ExtractTraits } from '../subworkflows/extract_traits.nf'
include { EstimationWorkflow } from '../subworkflows/estimation.nf'
include { SVPWorkflow } from '../subworkflows/svp.nf'

workflow TARGENE {
// Define Parameters
bgen_files = Channel.fromPath("$params.BGEN_FILES", checkIfExists: true).collect()
estimands_file = Channel.value(file("$params.ESTIMANDS_FILE"))
estimator_config = Channel.value(file("${params.ESTIMATOR_FILE}"))

// DEPRECATED: LEGACY TO BE REMOVED
bqtls_file = Channel.value(file("$params.BQTLS"))
transactors_files = Channel.fromPath("$params.TRANS_ACTORS").collect()
extra_confounders = Channel.value(file("$params.EXTRA_CONFOUNDERS"))
extra_treatments = Channel.value(file("$params.ENVIRONMENTALS"))
extra_covariates = Channel.value(file("$params.EXTRA_COVARIATES"))

ukb_encoding_file = params.UKB_ENCODING_FILE
ukb_config = Channel.value(file("$params.UKB_CONFIG", checkIfExists: true))
ukb_withdrawal_list = Channel.value(file("$params.UKB_WITHDRAWAL_LIST", checkIfExists: true))
traits_dataset = Channel.value(file("$params.TRAITS_DATASET", checkIfExists: true))

qc_file = Channel.value(file("$params.QC_FILE", checkIfExists: true))
flashpca_excl_reg = Channel.value(file("$params.FLASHPCA_EXCLUSION_REGIONS", checkIfExists: true))
ld_blocks = Channel.value(file("$params.LD_BLOCKS", checkIfExists: true))
bed_files = Channel.fromFilePairs("$params.BED_FILES", size: 3, checkIfExists: true){ file -> file.baseName }

estimator_config = Channel.value(file("${params.ESTIMATOR_FILE}"))

// Extract Traits
ExtractTraits(
traits_dataset,
ukb_config,
ukb_withdrawal_list,
ukb_encoding_file,
)

// IID Genotypes
IIDGenotypes(
flashpca_excl_reg,
ld_blocks,
bed_files,
qc_file,
ExtractTraits.out,
)

// Genetic confounders
GeneticConfounders(IIDGenotypes.out)
PCA()

// generate main dataset and estimand configuration files
EstimationInputs(
bgen_files,
ExtractTraits.out,
GeneticConfounders.out,
PCA.out.traits,
PCA.out.pcs,
estimands_file,
bqtls_file,
transactors_files,
Expand All @@ -66,11 +39,11 @@ workflow TARGENE {
estimator_config,
)

// Generate sieve estimates
// Generate sieve variance plateau estimates
if (params.SVP == true){
sieve_results = SVPWorkflow(
EstimationWorkflow.out.hdf5_result,
IIDGenotypes.out,
PCA.out.iid_genotypes,
)
}
}

0 comments on commit 58a31e1

Please sign in to comment.