Save vj_sequences in a dataframe

This commit is contained in:
coolneng 2021-04-22 01:18:25 +02:00
parent a7c1df5ce2
commit 83819b296b
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 8 additions and 13 deletions

View File

@ -32,13 +32,13 @@ get_vj_sequence <- function(metadata, names, vdj_segments) {
}
fetch_vj_sequences <- function(sequences, vdj_segments) {
vj_sequences <- mclapply(names(sequences),
vj_sequences <- sapply(names(sequences),
names(vdj_segments),
vdj_segments,
FUN = get_vj_sequence,
mc.cores = detectCores()
FUN = get_vj_sequence
)
return(c(vj_sequences[1], vj_sequences[2]))
results <- data.frame(t(vj_sequences))
return(results)
}
align_sequence <- function(sequence, vdj_segment) {
@ -52,15 +52,10 @@ align_sequence <- function(sequence, vdj_segment) {
# TODO Extract CDR3
get_hvr_sequences <- function(sequences, vdj_segments) {
vj_sequences <- fetch_vj_sequences(sequences, vdj_segments)
v_alignment <- parallel::mcmapply(sequences,
vj_sequences[1],
FUN = align_sequence
)
j_alignment <- parallel::mcmapply(sequences,
vj_sequences[2],
FUN = align_sequence
)
df <- fetch_vj_sequences(sequences, vdj_segments)
v_alignment <- parallel::mcmapply(sequences, df$v_seq, FUN = align_sequence)
j_alignment <- parallel::mcmapply(sequences, df$j_seq, FUN = align_sequence)
print(v_alignment)
}
data <- parse_data(file = "data/curesim_sequence.fastq")