Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add stitch tool #2

Merged
merged 2 commits into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions conf/test_stitch.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nextflow config file for running minimal tests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Defines input files and everything required to run a fast and simple pipeline test.

Use as follows:
nextflow run nf-core/phaseimpute -profile test_stitch,<docker/singularity> --outdir <OUTDIR>

----------------------------------------------------------------------------------------
*/

params {
config_profile_name = 'Minimal Stitch Test profile'
config_profile_description = 'Minimal test dataset to check pipeline function using the tool STITCH'

// Limit resources so that this can run on GitHub Actions
max_cpus = 2
max_memory = '2.GB'
max_time = '1.h'

// Input data
input = "${projectDir}/tests/csv/sample_bam.csv"
input_region = "${projectDir}/tests/csv/region.csv"

// Genome references
fasta = "https://raw.githubusercontent.com/nf-core/test-datasets/phaseimpute/data/reference_genome/21_22/hs38DH.chr21_22.fa"
phased = true

// Impute parameters
step = "impute"
tools = "stitch"
}
5 changes: 5 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,11 @@
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"installed_by": ["vcf_phase_shapeit5"]
},
"stitch": {
"branch": "master",
"git_sha": "3f5420aa22e00bd030a2556dfdffc9e164ec0ec5",
"installed_by": ["modules"]
},
"tabix/bgzip": {
"branch": "master",
"git_sha": "09d3c8c29b31a2dfd610305b10550f0e1dbcd4a9",
Expand Down
7 changes: 7 additions & 0 deletions modules/nf-core/stitch/environment.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

86 changes: 86 additions & 0 deletions modules/nf-core/stitch/main.nf

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

120 changes: 120 additions & 0 deletions modules/nf-core/stitch/meta.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 6 additions & 4 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -199,12 +199,14 @@ profiles {
executor.memory = 8.GB
}

test { includeConfig 'conf/test.config' }
test_full { includeConfig 'conf/test_full.config' }
test_sim { includeConfig 'conf/test_sim.config' }
test { includeConfig 'conf/test.config' }
test_full { includeConfig 'conf/test_full.config' }
test_sim { includeConfig 'conf/test_sim.config' }
test_validate { includeConfig 'conf/test_validate.config' }
test_all { includeConfig 'conf/test_all.config' }
test_quilt { includeConfig 'conf/test_quilt.config' }
test_quilt { includeConfig 'conf/test_quilt.config' }
test_stitch { includeConfig 'conf/test_stitch.config' }

}

// Set default registry for Apptainer, Docker, Podman and Singularity independent of -profile
Expand Down
2 changes: 1 addition & 1 deletion nextflow_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@
"type": "string",
"description": "Step to run.",
"fa_icon": "fas fa-step-forward",
"enum": ["glimpse1", "glimpse2", "quilt"]
"enum": ["glimpse1", "glimpse2", "quilt", "stitch"]
}
}
},
Expand Down
28 changes: 28 additions & 0 deletions subworkflows/local/bam_impute_stitch/bam_impute_stitch.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
include { BCFTOOLS_QUERY } from '../../../modules/nf-core/bcftools/query/main'
include { STITCH } from '../../../modules/nf-core/stitch/main'

workflow BAM_IMPUTE_STITCH {

take:
ch_input // channel: [ val(meta), bam, bai ]
ch_panel_sites

main:

ch_versions = Channel.empty()

// Convert position file to tab-separated file
BCFTOOLS_QUERY(ch_panel_sites)
ch_posfile = BCFTOOLS_QUERY.out.output


// Run STITCH
STITCH( stitch_input, GET_READS.out, reference, seed )



emit:
ch_vcf_tbi // channel: [ meta, vcf, tbi ]
versions = ch_versions // channel: [ versions.yml ]

}
27 changes: 26 additions & 1 deletion workflows/phaseimpute/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,33 @@ workflow PHASEIMPUTE {
error "Glimpse2 not yet implemented"
// Glimpse2 subworkflow
}

if (params.tools.contains("stitch")) {
print("Impute with STITCH")
// STITCH subworkflow

// Make bamlist from bam input
ch_bamlist = ch_input
.map { it[1].tokenize('/').last() }
.collectFile( name: "bamlist.txt", newLine: true, sort: true )

// Get chromosomes
ch_chromosomes = ch_fasta.map{it -> it[2]}
.splitCsv(header: ["chr", "size", "offset", "lidebase", "linewidth", "qualoffset"], sep: "\t")
.map{it -> [chr:it.chr]}

ch_chromosomes.dump(tag:"ch_chromosomes")

// Prepare input for STITCH

// Impute with STITCH
//BAM_IMPUTE_STITCH ( ch_input_stitch, GET_PANEL.out.ch_panel_sites )


}

if (params.tools.contains("quilt")) {
print("Impute with quilt")
print("Impute with QUILT")

// Quilt subworkflow

Expand Down
Loading