Implement HVR sequence alignment

This commit is contained in:
coolneng 2021-03-27 09:36:59 +01:00
parent 3a10380d8c
commit 3209641768
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 18 additions and 2 deletions

View File

@ -18,11 +18,27 @@ parse_data <- function(files) {
vdj_dataframe <- construct_dataframe(vdj_alignment) vdj_dataframe <- construct_dataframe(vdj_alignment)
return(list(sequences, vdj_dataframe)) return(list(sequences, vdj_dataframe))
} }
align_sequence <- function(sequence, vdj_segment) {
return(Biostrings::pairwiseAlignment(
pattern = sequence,
subject = vdj_segment,
type = "global-local",
gapOpening = 1
))
} }
align_sequences <- function(sequences, vdj_segments) {
perform_alignment <- function(sequences, vdj_segments) {
sequence_alignment <- mcmapply(sequences,
vdj_segments$hvr_region,
FUN = align_sequence,
mc.cores = 4
)
return(sequence_alignment)
} }
input_files <- c("data/curesim_sequence.fastq", "data/vdj_alignment.csv") input_files <- c("data/curesim_sequence.fastq", "data/vdj_alignment.csv")
data <- parse_data(input_files) data <- parse_data(input_files)
alignment <- perform_alignment(sequences = data[[1]], vdj_segments = data[[2]])
print(alignment)