-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.Rhistory
More file actions
133 lines (133 loc) · 5.03 KB
/
Copy path.Rhistory
File metadata and controls
133 lines (133 loc) · 5.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
library(seqRFLP)
data(fil.phy)
x <- data(fil.phy)
x
data(fil.phy)
ConvFas(fil = fil.phy, type = "phy")
x <- ConvFas(fil = fil.phy, type = "phy")
x <- ConvFas(fil = fil.phy, type = "phy")
View(x)
library(alakazam)
library(tidyverse)
library(UpSetR)
library(data.table)
library(stringdist)
library(seqRFLP)
import <- function (path, id, group) {
airr_data <- read_tsv(path)
data_rows <- nrow(airr_data)
airr_data <- airr_data %>%
mutate(sample = rep(id, data_rows), condition = rep(group, data_rows))
} # id = sample to be add; group = condition to be add
a84 <- import("~/Documentos/Immcantation/A84_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "A84", "G1")
aa104 <- import("~/Documentos/Immcantation/AA104_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AA104", "G1")
aa70 <- import("~/Documentos/Immcantation/AA70_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AA70", "G3")
aa74 <- import("~/Documentos/Immcantation/AA74_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AA74", "G4")
ad54 <- import("~/Documentos/Immcantation/AD54_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AD54", "G1")
au42 <- import("~/Documentos/Immcantation/AU42_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AU42", "G3")
au72 <- import("~/Documentos/Immcantation/AU72_atleast-2_igh_db-pass_parse-select_clone-pass_germ-pass.tsv", "AU72", "G4")
gene_samples <- function(list_samples) {
data_full <- Reduce(function(x, y) merge(x, y, all=TRUE), list_samples)
x <- data_full %>%
mutate(v_call = ifelse(str_detect(v_call, ","), str_extract(v_call, "^.*(?=(,))"), v_call)) %>%
mutate(v_call = ifelse(str_detect(v_call, ","), str_extract(v_call, "^.*(?=(,))"), v_call)) %>%
mutate(j_call = ifelse(str_detect(j_call, ","), str_extract(j_call, "^.*(?=(,))"), j_call)) %>%
mutate(j_call = ifelse(str_detect(j_call, ","), str_extract(j_call, "^.*(?=(,))"), j_call))
}
allele_remove <- function (sample) {
new_vcall <- gsub("\\*.*","", sample$v_call)
new_jcall <- gsub("\\*.*","", sample$j_call)
sample_new <- sample %>%
mutate(v_call = new_vcall) %>%
mutate(j_call = new_jcall)
}
cdr3_finder <- function(lenght) {
df.cdr3[which(df.cdr3$cdr3_lenght == lenght), ]
}
data_list <- list(a84, aa104, aa70, aa74, ad54, au42, au72)
data.filtered <- gene_samples(data_list) # Sample dataset without multiple V and J genes in rows
data.filtered.final <- allele_remove(data.filtered) # Remove Unecessary allele VJ genes information
data.teste <- data.filtered.final %>%
filter(v_call == "IGHV1-111" | v_call == "IGHV1-156" | v_call == "IGHV1-200" | v_call == "IGHV1S2" |
v_call == "IGHV2-161" | v_call == "IGHV2-174" | v_call == "IGHV2S1" | v_call == "IGHV3-100" |
v_call == "IGHV3-103" | v_call == "IGHV3-118" | v_call == "IGHV3-134" | v_call == "IGHV3-136" |
v_call == "IGHV3-16" | v_call == "IGHV3-178" | v_call == "IGHV3-183" | v_call == "IGHV3-30" |
v_call == "IGHV3-54" | v_call == "IGHV3S4" | v_call == "IGHV3S42" | v_call == "IGHV4-127" |
v_call == "IGHV4-169" | v_call == "IGHV4-57" | v_call == "IGHV4-65" | v_call == "IGHV4-93" |
v_call == "IGHV5-20" | v_call == "IGHV5-43" | v_call == "IGHV6-1" | v_call == "IGHV7-114")
df.cdr3 <- data.teste %>%
select(v_call, j_call, cdr3, junction_aa, sample, condition) %>%
mutate(cdr3_lenght = str_length(cdr3))
cdr3_len15 <- cdr3_finder(15) # CP Negativo
df.cdr3
df.cdr3
df.cdr3
View(df.cdr3)
cdr3_len24.unique
cdr3_len24.unique <- cdr3_len24 %>% # Faz o vector com todos os AA unicos presentes nesse comprimento
select(junction_aa) %>%
distinct() %>%
as.vector()
cdr3_len24 <- cdr3_finder(24) # CP Negativo
cdr3_len24.unique <- cdr3_len24 %>% # Faz o vector com todos os AA unicos presentes nesse comprimento
select(junction_aa) %>%
distinct() %>%
as.vector()
cdr3_len24.unique
cdr3_len24.unique
aaq <- as.vector(cdr3_len24)
aaq
aaq <- as.vector(cdr3_len24.unique)
aaq
cdr3_len24.unique <- cdr3_len24 %>% # Faz o vector com todos os AA unicos presentes nesse comprimento
select(junction_aa) %>%
distinct() %>%
as.vector()
aaq <- as.vector(cdr3_len24.unique)
aaq
cdr3_len24.unique
aaq <- vector(cdr3_len24.unique)
aaq <- as.vector(cdr3_len24.unique)
aaq
aaq <- as.vector(cdr3_len24.unique)
data(cdr3_len24.unique)
ConvFas(fil = cdr3_len24.unique, type = "fas")
ConvFas(fil = cdr3_len24.unique, type = "fas")
aqq <- as.tibble(cdr3_len24.unique)
aqq
View(aqq)
as.fasta(aqq)
dataframe2fas(aqq)
View(dataframe2fas(aqq))
x <- dataframe2fas(aqq)
write.csv(x, "~/Documentos/")
write.csv(x, "aqq.csv")
write.csv(x, "aqq.csv")
library(xlsx)
install.packages("xlsx")
library(xlsx)
data(mtcars)
cars.df <- data(mtcars)
cars.df
library(tidyverse)
data(mtcars)
mtcars
names <- mtcars[1, ]
names
names <- mtcars[ , 1]
names
names <- mtcars[1, ]
names
library(seqRFLP)
names <- c("Dimitri", "Waldeyr", "Marcelo", "Fulano")
names
names.df <- as_tibble(names)
names.df
names.df.fa <- dataframe2fas(names.df)
names.df.fa
write.csv(names.df)
write.csv(names.df, "names.df.csv")
write.csv(names.df, "~/Documentos/names.df.csv")
write.csv(names.df, "~/Documentos/names.df.txt")
names.df.fa <- dataframe2fas(names.df)
write.csv(names.df.fa, "~/Documentos/names.df.fa.txt")