Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
Merge branch 'main' of https://github.com/jakubkala/kmerFilters

# Conflicts:
#	R/motifs.R
  • Loading branch information
KrystynaGrzesiak committed Aug 19, 2024
2 parents f7450ad + 4d3e3ed commit 0571b1e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
11 changes: 11 additions & 0 deletions R/motifs.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,21 @@ add_motifs <- function(motifs, sequence, max_attempts = 20) {
maximum_motifs_positions <- lapply(motifs, function(x)
seq(sequence_len - length(x) + 1))

<<<<<<< HEAD
positions_to_sample <- maximum_motifs_positions
motifs_positions <- numeric(length(motifs))
attempt <- 1
ith_motif <- 1
=======
if(any(motifs_grid < 1)) {
stop("Some of positions are invalid!")
}

for (i in 1:nrow(motifs_grid)) {
list_of_masks <- list()
injected_sequence <- sequence
injected_positions <- logical(length(sequence))
>>>>>>> 4d3e3ed55070425b5635338c4a6b18bc4f41fb1e

while(attempt <= max_attempts & ith_motif <= length(motifs)) {
dummy_ok <- TRUE
Expand Down
3 changes: 2 additions & 1 deletion R/sequences.R
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ generate_sequence_data <- function(n_seq,
attr(sequences, "motifs_map") <- motifs_map
attr(sequences, "masks") <- list_of_masks
attr(sequences, "target") <- target
attr(sequences, "motifs_set") <- motifs
sequences
}

Expand Down Expand Up @@ -182,7 +183,7 @@ generate_kmer_data <- function(n_seq,
nrow = nrow(test_dat),
ncol = ncol(test_dat))
attr(test_res, "max_injection") <- attr(test_dat, "max_injection")
attr(test_res, "motifs_set") <- motifs
attr(test_res, "motifs_set") <- attr(test_dat, "motifs_set")
attr(test_res, "motifs_map") <- attr(test_dat, "motifs_map")
attr(test_res, "masks") <- attr(test_dat, "masks")
attr(test_res, "target") <- attr(test_dat, "target")
Expand Down

0 comments on commit 0571b1e

Please sign in to comment.