Compare commits
6 Commits
760d78108c
...
0.2.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
3d8e0fe114
|
|||
|
2058fc96d7
|
|||
|
e4189cab01
|
|||
|
2acec89f84
|
|||
|
91b3e37bd8
|
|||
|
bf33b65191
|
@@ -63,5 +63,6 @@ command invokes it:
|
|||||||
|
|
||||||
The script will generate 2 files under the data directory:
|
The script will generate 2 files under the data directory:
|
||||||
|
|
||||||
|HVR.fastq |Contains the original CDR3 sequence |
|
|HVR.fastq | curesim-HVR.fastq |
|
||||||
|CuReSim-HVR.fastq | Contains CDR3 after the read simulation, with sequencing errors |
|
|:----:|:-----:|
|
||||||
|
|Contains the original CDR3 sequence|Contains CDR3 after the read simulation, with sequencing errors |
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
"homepage": "",
|
"homepage": "",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "a565a2165ab6e195d7c105a8416b8f4b4d0349a4",
|
"rev": "359e6542e1d41eb18df55c82bdb08bf738fae2cf",
|
||||||
"sha256": "1x90qm533lh8xh172rqfcj3pwg8imyx650xgr41rqppmm6fli4w1",
|
"sha256": "05v28njaas9l26ibc6vy6imvy7grbkli32bmv0n32x6x9cf68gf9",
|
||||||
"type": "tarball",
|
"type": "tarball",
|
||||||
"url": "https://github.com/NixOS/nixpkgs/archive/a565a2165ab6e195d7c105a8416b8f4b4d0349a4.tar.gz",
|
"url": "https://github.com/NixOS/nixpkgs/archive/359e6542e1d41eb18df55c82bdb08bf738fae2cf.tar.gz",
|
||||||
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
"url_template": "https://github.com/<owner>/<repo>/archive/<rev>.tar.gz"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,7 +34,11 @@ parse_metadata <- function(metadata) {
|
|||||||
#' @return A \code{character} containing the gene sequence
|
#' @return A \code{character} containing the gene sequence
|
||||||
match_id_sequence <- function(names, vdj_segments, id) {
|
match_id_sequence <- function(names, vdj_segments, id) {
|
||||||
matches <- grep(names, pattern = id)
|
matches <- grep(names, pattern = id)
|
||||||
row <- matches[1]
|
if(id == "TRBJ2-2"){
|
||||||
|
row <- matches[2]
|
||||||
|
} else {
|
||||||
|
row <- matches[1]
|
||||||
|
}
|
||||||
return(as.character(vdj_segments[row]))
|
return(as.character(vdj_segments[row]))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,8 +110,9 @@ get_cys_coordinates <- function(alignment) {
|
|||||||
insertion <- unlist(Biostrings::insertion(alignment))
|
insertion <- unlist(Biostrings::insertion(alignment))
|
||||||
deletion <- unlist(Biostrings::deletion(alignment))
|
deletion <- unlist(Biostrings::deletion(alignment))
|
||||||
delta_coordinates <- handle_indels(insertion, deletion, cys, alignment)
|
delta_coordinates <- handle_indels(insertion, deletion, cys, alignment)
|
||||||
cys_start <- cys$start + delta_coordinates$start
|
read_start <- unlist(start(Biostrings::Views(alignment)))
|
||||||
cys_end <- cys$end + delta_coordinates$end
|
cys_start <- cys$start + delta_coordinates$start + read_start - 1
|
||||||
|
cys_end <- cys$end + delta_coordinates$end + read_start
|
||||||
return(list("start" = cys_start, "end" = cys_end))
|
return(list("start" = cys_start, "end" = cys_end))
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -126,7 +131,7 @@ get_hvr_sequences <- function(sequences, vdj_segments, cores = detectCores()) {
|
|||||||
)
|
)
|
||||||
cys_coordinates <- parallel::mclapply(v_alignment, FUN = get_cys_coordinates)
|
cys_coordinates <- parallel::mclapply(v_alignment, FUN = get_cys_coordinates)
|
||||||
cys_df <- as.data.frame(do.call(rbind, cys_coordinates))
|
cys_df <- as.data.frame(do.call(rbind, cys_coordinates))
|
||||||
remaining <- Biostrings::subseq(sequences, start = unlist(cys_df$end))
|
remaining <- Biostrings::subseq(sequences, start = unlist(cys_df$end) + 1)
|
||||||
j_alignment <- parallel::mcmapply(remaining,
|
j_alignment <- parallel::mcmapply(remaining,
|
||||||
df$j_seq,
|
df$j_seq,
|
||||||
FUN = align_sequence,
|
FUN = align_sequence,
|
||||||
@@ -145,4 +150,4 @@ get_hvr_sequences <- function(sequences, vdj_segments, cores = detectCores()) {
|
|||||||
|
|
||||||
data <- parse_data(file = "data/curesim_sequence.fastq")
|
data <- parse_data(file = "data/curesim_sequence.fastq")
|
||||||
hvr <- get_hvr_sequences(sequences = data[[1]], vdj_segments = data[[2]])
|
hvr <- get_hvr_sequences(sequences = data[[1]], vdj_segments = data[[2]])
|
||||||
Biostrings::writeXStringSet(hvr, "data/CuReSim-HVR.fastq", format = "fastq")
|
Biostrings::writeXStringSet(hvr, "data/curesim-HVR.fastq", format = "fastq")
|
||||||
|
|||||||
Reference in New Issue
Block a user