---
title: "ClusTCR2"
output: rmarkdown::html_vignette
vignette: >
  %\VignetteIndexEntry{ClusTCR2}
  %\VignetteEngine{knitr::rmarkdown}
  %\VignetteEncoding{UTF-8}
---

This package is for performing the single cell RNA-seq T cell receptor (TCR) sequence similarity of the hypervariable CDR3 sequence in the TCR. This package was based on the python software ClusTCR. This uses an edit distance (hamming distance) of one and of the same v_gene. 

```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
```

```{r setup, echo=TRUE}
library(ClusTCR2)
```

Step 1. Example of how to use ClusTCR = hamming distance and creating the matrix. 

```{r, echo=TRUE}
# Example usage of mcl_cluster function with a stored file
example_file <- read.csv(system.file("extdata", "my_data.csv",package = "ClusTCR2"))
# Perform clustering using mcl_cluster function
step1 <- ClusTCR(example_file,allele = FALSE)
# Print the result
step1[1:6,1:6]
```

Step 2. Creating both the file need for visulising the motif and network from step 1. 

```{r, echo=TRUE}
# Example usage of mcl_cluster function with a stored file
step2 <- mcl_cluster(step1)
step2[[1]][1:3,1:3]
head(step2[[2]][1:6,1:6])
```

Visualization: Network plot

```{r, echo=TRUE}
# Visualization of the network plot
netplot_ClusTCR2(step2, label = "Name_selected", Clust_selected = 1)
```

Visualization: Motif plot

```{r, echo=TRUE}
# Visualization of the network plot
# step2[[1]]
subset(step2[[1]],step2[[1]]$Clust_size_order == 1)
motif_plot(step2,Clust_selected = 1)
```
