Implement cysteine location in v_alignment

This commit is contained in:
coolneng 2021-04-27 19:34:01 +02:00
parent 4dec2061fc
commit c250c139dd
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 13 additions and 2 deletions

View File

@ -50,11 +50,22 @@ align_sequence <- function(sequence, vdj_segment) {
))
}
locate_cysteine <- function(sequence, v_segment) {
codons <- Biostrings::DNAStringSet(c("TGT", "TGC"))
matches <- Biostrings::matchPDict(
pdict = codons,
subject = DNAString(toString(v_segment))
)
position <- as.data.frame(intersect(matches[[1]], matches[[2]]))
return(position)
}
# TODO Extract CDR3
get_hvr_sequences <- function(sequences, vdj_segments) {
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)
hvr_start <- parallel::mcmapply(sequences, v_alignment, FUN = locate_cysteine)
hvr_start_df <- as.data.frame(t(hvr_start))
}
data <- parse_data(file = "data/curesim_sequence.fastq")