Skip to content
Snippets Groups Projects
Unverified Commit 29267096 authored by Laurent Modolo's avatar Laurent Modolo
Browse files

MUSIC: nf files for single-end data

parent 5f461c3d
No related branches found
No related tags found
No related merge requests found
profiles {
docker {
docker.temp = 'auto'
docker.enabled = true
process {
$compute_mappability {
container = "music:6613c53"
}
$music_preprocessing {
container = "music:6613c53"
}
$music_sort {
container = "music:6613c53"
}
$music_dedup {
container = "music:6613c53"
}
$music_computation {
container = "music:6613c53"
}
}
}
sge {
process{
$compute_mappability {
beforeScript = "module purge; module load MUSIC/6613c53"
}
$music_preprocessing {
beforeScript = "module purge; module load MUSIC/6613c53"
}
$music_sort {
beforeScript = "module purge; module load MUSIC/6613c53"
}
$music_dedup {
beforeScript = "module purge; module load MUSIC/6613c53"
}
$music_computation {
beforeScript = "module purge; module load MUSIC/6613c53"
}
}
}
}
params.reads_size = 100
params.frag_size = 200
params.begin_l = 50
params.end_l = 500
log.info "bam files : ${params.bam}"
log.info "index files : ${params.index}"
log.info "fasta files : ${params.fasta}"
Channel
.fromPath( params.fasta )
.ifEmpty { error "Cannot find any bam files matching: ${params.fasta}" }
.set { fasta_files }
Channel
.fromPath( params.bam )
.ifEmpty { error "Cannot find any bam files matching: ${params.bam}" }
.map { it -> [(it.baseName =~ /([^\.]*)/)[0][1], it]}
.set { bam_files }
Channel
.fromPath( params.index )
.ifEmpty { error "Cannot find any index files matching: ${params.index}" }
.set { index_files }
process compute_mappability {
tag "${fasta.baseName}"
input:
file index from index_files.collect()
file fasta from fasta_files
output:
file "*.bin" into mappability
file "temp/chr_ids.txt" into chr_ids
script:
"""
generate_multimappability_signal.csh ${fasta} ${params.reads_size} ./
bash temp_map_reads.csh
bash temp_process_mapping.csh
"""
}
process music_preprocessing {
tag "${file_id}"
input:
set file_id, file(bam) from bam_files
file chr_ids from chr_ids.collect()
output:
set file_id, "preprocessed/*.tar" into preprocessed_bam_files
script:
"""
mkdir preprocessed
samtools view *.bam | \
MUSIC -preprocess SAM stdin preprocessed/
mkdir preprocessed/sorted
MUSIC -sort_reads preprocessed/ preprocessed/sorted/
mkdir preprocessed/dedup
MUSIC -remove_duplicates ./preprocessed/sorted 2 preprocessed/dedup/
cd preprocessed
tar -c -f ${file_id}.tar *
"""
}
preprocessed_bam_files_control = Channel.create()
preprocessed_bam_files_chip = Channel.create()
preprocessed_bam_files.choice(
preprocessed_bam_files_control,
preprocessed_bam_files_chip ) { a -> a[0] =~ /.*control.*/ ? 0 : 1 }
process music_computation {
tag "${file_id}"
publishDir "results/peak_calling/${file_id}", mode: 'copy'
input:
set file_id, file(control) from preprocessed_bam_files_chip
set file_id_control, file(chip) from preprocessed_bam_files_control.collect()
file mapp from mappability.collect()
output:
file "*" into music_output_forward
file "*.bed" into peaks_forward
script:
"""
mkdir mappability control chip
mv ${mapp} mappability/
tar -xf ${control} -C control/
tar -xf ${chip} -C chip/
MUSIC -get_per_win_p_vals_vs_FC -chip chip/ -control control/ \
-l_win_step ${params.end_l} \
-l_win_min ${params.end_l} -l_win_max ${params.end_l * 10}
MUSIC -get_multiscale_punctate_ERs \
-chip chip/ -control control/ -mapp mappability/ \
-begin_l ${params.begin_l} -end_l ${params.end_l} -step 1.1 \
-l_mapp ${params.reads_size} -l_frag ${params.frag_size} -q_val 1 -l_p 0
ls -l
"""
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment