Skip to content

Commit

Permalink
Merge pull request #91 from loosolab/estimation_motifs
Browse files Browse the repository at this point in the history
Estimation motifs
  • Loading branch information
renewiegandt authored Jan 23, 2019
2 parents 6e7811c + e2494a0 commit 987bf7f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion config/create_gtf.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
params{
tissue=""
tissues=""
}
2 changes: 1 addition & 1 deletion config/footprint_extraction.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ params{
window_length = 200
step = 100
percentage = 0
max_bp_between = 6
gap_penalty = 6
}
6 changes: 3 additions & 3 deletions config/motif_estimation.config
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ params {
min_seq = 10

//glam2
motif_min_len = 8
motif_max_len = 20
interation = 10000
motif_min_key = 8
motif_max_key = 20
iteration = 10000

//tomtom
tomtom_treshold = 0.01
Expand Down
21 changes: 18 additions & 3 deletions pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@

//creating_gtf
params.organism=""
params.tissue=""
params.tissues=""

if (params.bigwig == "" || params.bed == "" || params.organism == "" || params.genome_fasta == "" || params.motif_db == "" || params.config == "" || "${params.help}" != "0" ){
log.info """
Expand Down Expand Up @@ -144,20 +144,27 @@ int_params = ["window_length", "step", "min_size_fp", "max_size_fp", "kmer",
"aprox_motif_len", "motif_occurence", "min_seq_length", "global",
"sequence_coverage", "memory", "throw_away_seq", "strand",
"min_seq", "motif_min_key", "motif_max_key", "iteration",
"edge_weight", "best_motif", "min_gap", "gap_penalty", "edge_weight"]
"edge_weight", "best_motif", "min_gap", "gap_penalty", "edge_weight",
"threads", ]
req_params = ["bigwig", "bed", "genome_fasta", "motif_db", "config"]
all_params = int_params + req_params + ["organism" , "identity", "tfbsscan_method",
"percentage", "tomtom_treshold", "motif_similarity_thresh", "out",
"tissues", "gtf_path", "cluster_motif", "tfbs_path", "help"]

valid_organism = ["hg38", "hg19", "mm9", "mm10"]
valid_tfbsscan_methods = ["moods","fimo"]

params.each { key, value ->
if (!(all_params.contains(key))){
println("Warning: Parameter $key is unknown. Please check for typos or the parameter list!")
}
if(int_params.contains(key)) {
if (!("${value}" ==~ /\d+/ )){
println("ERROR: $key needs to be an Integer")
System.exit(2)
}
}
if(req_params.contains(key)) {
if(req_params.contains(key) || (key == "gtf_path" && value != "") ) {
if(!file(value).exists()) {
println("ERROR: $key not found. Please check the given path.")
System.exit(2)
Expand Down Expand Up @@ -243,12 +250,20 @@ process overlap_with_known_TFBS {
script:
if(params.tfbs_path == ""){
"""
if [[ ! -x "${path_bin}/1.2_filter_motifs/compareBed.sh" ]]
then
chmod +x ${path_bin}/1.2_filter_motifs/compareBed.sh
fi
python ${path_bin}/1.2_filter_motifs/tfbsscan.py --use ${params.tfbsscan_method} --core ${params.threads} -m ${db} -g ${fasta} -o ./known_tfbs -b ${bed_peaks}
${path_bin}/1.2_filter_motifs/compareBed.sh --data ${bed_footprints} --motifs ./known_tfbs --fasta ${fasta} -o ${name}_unknown.bed -min ${params.min_size_fp} -max ${params.max_size_fp}
cp -r ./known_tfbs/ ${params.out}/1.2_filter_motifs/
"""
} else {
"""
if [[ ! -x "${path_bin}/1.2_filter_motifs/compareBed.sh" ]]
then
chmod +x ${path_bin}/1.2_filter_motifs/compareBed.sh
fi
${path_bin}/1.2_filter_motifs/compareBed.sh --data ${bed_footprints} --motifs ${known_tfbs} --fasta ${fasta} -o ${name}_unknown.bed -min ${params.min_size_fp} -max ${params.max_size_fp}
"""
}
Expand Down

0 comments on commit 987bf7f

Please sign in to comment.