Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
renewiegandt committed Dec 16, 2018
1 parent a2f15b3 commit e330274
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
12 changes: 8 additions & 4 deletions bin/merge_similar_clusters.R
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env Rscript

# Merging FASTA-files, which motifs are similar.
#
#
# @parameter tsv_in <string> Path to TSV file generated by Tomtom.
# The input for Tomtom is a from all clusters merged meme-file.
# @parameter file_list <string> Numerically sorted whitespace separated list of absolute fasta-file paths
Expand All @@ -10,7 +10,7 @@

args = commandArgs(trailingOnly = TRUE)

tsv_in <- args[1]
tsv_in <- args[1]
file_list <- args[2]
min_weight <- args[3]

Expand Down Expand Up @@ -38,7 +38,7 @@ edgelist <- sim_not_unique[query_cluster != target_cluster]
g <- igraph::graph_from_edgelist(as.matrix(edgelist))
# converting graph to adjacency matrix
adj_matrix <- igraph::get.adjacency(g, names = T)
# generating weighted graph from adjacency matrix
# generating weighted graph from adjacency matrix
g_adj <- igraph::graph_from_adjacency_matrix(adj_matrix, weighted = T)

# get subgraphs from graph with edges of weight > min_weight
Expand All @@ -47,7 +47,11 @@ png('motif_clusters.png')
plot(s1)
dev.off()
clust <- igraph::clusters(s1)

if (clust$no < 1){
b <- lapply(files, function(f){
system(paste("cat",f,">",basename(f)))
})
}
# merge FASTA-files depending on the clustered graphs
a <- lapply(seq(from = 1, to = clust$no, by = 1), function(i){
cl <- as.vector(which(clust$membership %in% c(i)))
Expand Down
10 changes: 5 additions & 5 deletions pipeline.nf
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ All arguments can be set in the configuration files
System.exit(2)
} else {
Channel.fromPath(params.bigwig).map {it -> [it.simpleName, it]}.set {bigwig_input}
Channel.fromPath(params.bed).set {bed_input}
Channel.fromPath(params.bed).into {bed_input; bed_for_tfbsscan}
Channel.fromPath(params.genome_fasta).into {fa_overlap; fa_scan; fa_overlap_2}
Channel.fromPath(params.motif_db).into {db_for_motivscan; db_for_tomtom}
Channel.fromPath(params.config).set {config}
Expand Down Expand Up @@ -205,6 +205,7 @@ process footprint_extraction {
"""
}

for_tfbs = fa_overlap.combine(db_for_motivscan).combine(bed_for_tfbsscan)

/*
Expand All @@ -216,8 +217,7 @@ process extract_known_TFBS {
publishDir "${params.out}/known_TFBS/", mode: 'copy', pattern: '*.bed'

input:
file (fasta) from fa_overlap
file (db) from db_for_motivscan
set file (fasta), file (db), file (bed) from for_tfbs

output:
val ('done') into known_TFBS_for_overlap
Expand All @@ -227,7 +227,7 @@ process extract_known_TFBS {

script:
"""
python ${path_bin}/tfbsscan.py --use moods --core ${params.threads} -m ${db} -g ${fasta} -o ${params.create_known_tfbs_path}
python ${path_bin}/tfbsscan.py --use moods --core ${params.threads} -m ${db} -g ${fasta} -o ${params.create_known_tfbs_path} -b ${bed}
"""
}

Expand Down Expand Up @@ -417,7 +417,7 @@ Merging FASTA-files of similar clusters
process merge_fasta {
conda "${path_env}"
publishDir "${params.out}/esimated_motifs/merged_fasta/", mode: 'copy'

echo true
input:
set file (motiv_sim), val (fasta_list) from files_for_merge_fasta

Expand Down

0 comments on commit e330274

Please sign in to comment.