Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
2058fc96d7
|
|||
|
e4189cab01
|
|||
|
2acec89f84
|
|||
|
91b3e37bd8
|
|||
|
bf33b65191
|
68
README.md
Normal file
68
README.md
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
# locigenesis
|
||||||
|
|
||||||
|
locigenesis is a tool that generates a human T-cell receptor (TCR), runs
|
||||||
|
it through a sequence reader simulation tool and extracts CDR3.
|
||||||
|
|
||||||
|
The goal of this project is to generate both HVR sequences with and
|
||||||
|
without sequencing errors, in order to create datasets for a Machine
|
||||||
|
Learning algorithm.
|
||||||
|
|
||||||
|
## Technologies
|
||||||
|
|
||||||
|
- [immuneSIM](https://github.com/GreiffLab/immuneSIM/): in silico
|
||||||
|
generation of human and mouse BCR and TCR repertoires
|
||||||
|
- [CuReSim](http://www.pegase-biosciences.com/curesim-a-customized-read-simulator/):
|
||||||
|
read simulator that mimics Ion Torrent sequencing
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
This project uses [Nix](https://nixos.org/) to ensure reproducible
|
||||||
|
builds.
|
||||||
|
|
||||||
|
1. Install Nix (compatible with MacOS, Linux and
|
||||||
|
[WSL](https://docs.microsoft.com/en-us/windows/wsl/about)):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
curl -L https://nixos.org/nix/install | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
2. Clone the repository:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git clone https://git.coolneng.duckdns.org/coolneng/locigenesis
|
||||||
|
```
|
||||||
|
|
||||||
|
3. Change the working directory to the project:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd locigenesis
|
||||||
|
```
|
||||||
|
|
||||||
|
4. Enter the nix-shell:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
nix-shell
|
||||||
|
```
|
||||||
|
|
||||||
|
After running these commands, you will find yourself in a shell that
|
||||||
|
contains all the needed dependencies.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
An execution script that accepts 2 parameters is provided, the following
|
||||||
|
command invokes it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
./generation.sh <number of sequences> <number of reads>
|
||||||
|
```
|
||||||
|
|
||||||
|
- \<number of sequences\>: an integer that specifies the number of
|
||||||
|
different sequences to generate
|
||||||
|
- \<number of reads\>: an integer that specifies the number of reads
|
||||||
|
to perform on each sequence
|
||||||
|
|
||||||
|
The script will generate 2 files under the data directory:
|
||||||
|
|
||||||
|
|HVR.fastq | curesim-HVR.fastq |
|
||||||
|
|:----:|:-----:|
|
||||||
|
|Contains the original CDR3 sequence|Contains CDR3 after the read simulation, with sequencing errors |
|
||||||
56
README.org
56
README.org
@@ -1,56 +0,0 @@
|
|||||||
* locigenesis
|
|
||||||
|
|
||||||
locigenesis is a tool that generates a human T-cell receptor (TCR), runs it through a sequence reader simulation tool and extracts CDR3.
|
|
||||||
|
|
||||||
The goal of this project is to generate both HVR sequences with and without sequencing errors, in order to create datasets for a Machine Learning algorithm.
|
|
||||||
|
|
||||||
** Technologies
|
|
||||||
|
|
||||||
- [[https://github.com/GreiffLab/immuneSIM/][immuneSIM]]: in silico generation of human and mouse BCR and TCR repertoires
|
|
||||||
- [[http://www.pegase-biosciences.com/curesim-a-customized-read-simulator/][CuReSim]]: read simulator that mimics Ion Torrent sequencing
|
|
||||||
|
|
||||||
** Installation
|
|
||||||
|
|
||||||
This project uses [[https://nixos.org/][Nix]] to ensure reproducible builds.
|
|
||||||
|
|
||||||
1. Install Nix (compatible with MacOS, Linux and [[https://docs.microsoft.com/en-us/windows/wsl/about][WSL]]):
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
curl -L https://nixos.org/nix/install | sh
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
1. Clone the repository:
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
git clone https://git.coolneng.duckdns.org/coolneng/locigenesis
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
3. Change the working directory to the project:
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
cd locigenesis
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
4. Enter the nix-shell:
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
nix-shell
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
After running these commands, you will find yourself in a shell that contains all the needed dependencies.
|
|
||||||
|
|
||||||
** Usage
|
|
||||||
|
|
||||||
An execution script that accepts 2 parameters is provided, the following command invokes it:
|
|
||||||
|
|
||||||
#+begin_src shell
|
|
||||||
./generation.sh <number of sequences> <number of reads>
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
- <number of sequences>: an integer that specifies the number of different sequences to generate
|
|
||||||
- <number of reads>: an integer that specifies the number of reads to perform on each sequence
|
|
||||||
|
|
||||||
The script will generate 2 files under the data directory:
|
|
||||||
|
|
||||||
| HVR.fastq | Contains the original CDR3 sequence |
|
|
||||||
| CuReSim-HVR.fastq | Contains CDR3 after the read simulation, with sequencing errors |
|
|
||||||
@@ -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