Skip to content

Commit

Permalink
MAINT: refactored conpair code
Browse files Browse the repository at this point in the history
  • Loading branch information
Phuong-Le committed Sep 6, 2024
1 parent 1d72c5a commit ecb0102
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion modules/conpairFilter.nf
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ process conpairFilter {
path concordance
path contamination
path samples_path
val concordance_threshold
val contamination_threshold_samples
val contamination_threshold_match


output:
Expand All @@ -16,6 +19,6 @@ process conpairFilter {
script:
outfile = "sample_paths_contamination_filtered.txt"
"""
conpair_contamination_filter.py --samples_path ${samples_path} --concordance_path ${concordance} --contamination_path ${contamination} --concordance_threshold ${params.concordance_threshold} --contamination_threshold_samples ${params.contamination_threshold_samples} --contamination_threshold_match ${params.contamination_threshold_match} --outfile ${outfile}
conpair_contamination_filter.py --samples_path ${samples_path} --concordance_path ${concordance} --contamination_path ${contamination} --concordance_threshold ${concordance_threshold} --contamination_threshold_samples ${contamination_threshold_samples} --contamination_threshold_match ${contamination_threshold_match} --outfile ${outfile}
"""
}
5 changes: 4 additions & 1 deletion modules/conpairPileup.nf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@ process conpairPileup {
input:
tuple val(match_normal_id), val(sample_id), path(bam), path(bai)
path(marker_bed)
path(reference_genome)
path(reference_genome_dict)
path(reference_genome_idx)

output:
tuple val(match_normal_id), val(sample_id), path(pileup)

script:
pileup = "${sample_id}.pileup"
"""
gatk --java-options -Xmx10g Pileup -R ${params.reference_genome} -I ${bam} -L ${marker_bed} -O ${pileup} -verbose -RF NotDuplicateReadFilter -RF CigarContainsNoNOperator -RF MatchingBasesAndQualsReadFilter
gatk --java-options -Xmx10g Pileup -R ${reference_genome} -I ${bam} -L ${marker_bed} -O ${pileup} -verbose -RF NotDuplicateReadFilter -RF CigarContainsNoNOperator -RF MatchingBasesAndQualsReadFilter
"""

}
2 changes: 2 additions & 0 deletions modules/validate.nf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ validParams = [
marker_txt: 'path',
vcfilter_config: '',
reference_genome: 'path',
reference_genome_dict: 'path',
reference_genome_idx: 'path',
high_depth_region: 'path',
phylogenetics: 'boolean',
with_topology: '',
Expand Down
2 changes: 2 additions & 0 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ params {
marker_txt = ""
vcfilter_config = ""
reference_genome = ""
reference_genome_dict = ""
reference_genome_idx = ""
high_depth_region = ""
phylogenetics = true
phylogenetics_outdir_basename = ""
Expand Down
6 changes: 3 additions & 3 deletions workflows/conpair_filter_with_match_normal.nf
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ workflow CONPAIR_FILTER_WITH_MATCH_NORMAL {
sample_pileup_input_ch = Channel.of(sample_paths)
.splitCsv( header: true, sep : '\t' )
.map { row -> tuple( row.match_normal_id, row.sample_id, row.bam, row.bai ) }
pileup_sample = conpairPileupSample(sample_pileup_input_ch, marker_bed)
pileup_sample = conpairPileupSample(sample_pileup_input_ch, marker_bed, params.reference_genome, params.reference_genome_dict, params.reference_genome_idx)
// normal
match_pileup_input_ch = Channel.of(sample_paths)
.splitCsv( header: true, sep : '\t' )
.map { row -> tuple( row.match_normal_id, row.match_normal_id, row.bam_match, row.bai_match ) }
.unique()
pileup_match = conpairPileupMatch(match_pileup_input_ch, marker_bed)
pileup_match = conpairPileupMatch(match_pileup_input_ch, marker_bed, params.reference_genome, params.reference_genome_dict, params.reference_genome_idx)

// Concordance between sample and match normal
concordance_input_ch = pileup_sample.combine(pileup_match)
Expand All @@ -41,7 +41,7 @@ workflow CONPAIR_FILTER_WITH_MATCH_NORMAL {
.collectFile( name: 'conpair_out/contamination.txt', newLine: true )

// Filtering contamination based on concordance and contamination
(sample_paths_conpaired, conpair_log, concordance_path, contamination_path) = conpairFilter(concordance_output_ch, contamination_output_ch, params.sample_paths)
(sample_paths_conpaired, conpair_log, concordance_path, contamination_path) = conpairFilter(concordance_output_ch, contamination_output_ch, params.sample_paths, params.concordance_threshold, params.contamination_threshold_samples, params.contamination_threshold_match)


emit:
Expand Down

0 comments on commit ecb0102

Please sign in to comment.