Skip to content

Commit

Permalink
pahase
Browse files Browse the repository at this point in the history
  • Loading branch information
RuthEberhardt committed Apr 30, 2024
1 parent 3c0d580 commit a1d3ba8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 10 deletions.
2 changes: 1 addition & 1 deletion bin/split_samples.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ def split_samples(sample_list, batch_size):
def write_sample_lists(sample_list_split, outdir):
i = 1
for lst in sample_list_split:
sample_file = outdir + "/samples_" + str(i) + ".txt"
sample_file = outdir + "/samples_" + str(i)
with open(sample_file, 'w') as sf:
sf.write(('\n').join(lst))
sf.write('\n')
Expand Down
7 changes: 7 additions & 0 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,13 @@ process {
memory = { check_max( 200.GB * task.attempt, 'memory' ) }
}

withLabel:process_phase {
cpus = { check_max( 8 * task.attempt, 'cpus' ) }
memory = { check_max( 20.GB * task.attempt, 'memory' ) }
time = { check_max( 12.h * task.attempt, 'time' ) }
}


withLabel:error_ignore {
errorStrategy = 'ignore'
}
Expand Down
2 changes: 1 addition & 1 deletion modules/local/split_samples/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ process SPLIT_SAMPLES {
path(vcf_in)

output:
path('samples_*.txt'), emit: sample_lists
path('samples_*'), emit: sample_lists

script:
"""
Expand Down
8 changes: 5 additions & 3 deletions modules/local/split_vcfs/main.nf
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
process SPLIT_VCFS {

label 'process_medium'

input:
tuple path(vcf), path(sample_list)

output:
tuple path('vcf_sample_subset.vcf.gz'), path('vcf_sample_subset.vcf.gz.csi'), emit: split_vcfs
tuple path('vcf_sample_subset_*.vcf.gz'), path('vcf_sample_subset_*.vcf.gz.csi'), emit: split_vcfs

script:
"""
bcftools view -S $sample_list $vcf -Oz -o vcf_sample_subset.vcf.gz
bcftools index vcf_sample_subset.vcf.gz
bcftools view -S $sample_list $vcf -Oz -o vcf_sample_subset_${sample_list}.vcf.gz
bcftools index vcf_sample_subset_${sample_list}.vcf.gz
"""

}
2 changes: 1 addition & 1 deletion modules/nf-core/glimpse2/phase/main.nf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
process GLIMPSE2_PHASE {
tag "$meta.id"
label 'process_medium'
label 'process_phase'

beforeScript """
if cat /proc/cpuinfo | grep avx2 -q
Expand Down
19 changes: 15 additions & 4 deletions workflows/run_glimpse.nf
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,31 @@ workflow RUN_GLIMPSE {
vcf_samples = vcf.combine(SPLIT_SAMPLES.out.sample_lists.flatten())

SPLIT_VCFS(vcf_samples)
// // SPLIT_VCFS.out.split_vcfs.view()

ref = channel.fromPath("${params.refdir}*.bin")

phase_meta = [id: 'phase']

phase_input = SPLIT_VCFS.out.split_vcfs.combine(ref).map{
vcf, index , ref_bin ->
[[], vcf, index, [], [], [], ref_bin, [], []]
[phase_meta, vcf, index, [], [], [], ref_bin, [], []]
}
phase_input2 = ['', params.fasta, params.fai]

//phase_input.view()


GLIMPSE2_PHASE(phase_input, phase_input2)

GLIMPSE2_PHASE.out.versions.view()

// phase_input = vcf_samples.combine(ref).map {
// vcf, samples, ref_bin ->
// [phase_meta, vcf, [], samples, [], [], ref_bin, [], []]

// }

// phase_input2 = ['', params.fasta, params.fai]

// GLIMPSE2_PHASE(phase_input, phase_input2)


}

0 comments on commit a1d3ba8

Please sign in to comment.