anchor_scores <- data.frame()
anchor_scores
hla_alles <- ["HLA-A*02:01", "HLA-B*03:05"]
hla_alleles <- list(["HLA-A*02:01", "HLA-B*03:05"])
hla_alleles <- list("HLA-A*02:01", "HLA-B*03:05")
hla_alleles
anchor_scores.colnames <- hla_alleles
anchor_scores
for (peptide_length in 8:11) {
  for (allele in alleles) {
for (peptide_length in 8:11) {
  for (allele in hla_alleles) {
anchor_data <- list()
anchor_data[[8]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_8_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[9]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_9_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[10]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_10_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[11]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_11_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
library(curl)
anchor_data[[8]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_8_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[9]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_9_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[10]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_10_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
anchor_data[[11]] <- read.table(curl("https://raw.githubusercontent.com/griffithlab/pVACtools/ae938113ddbbe6c6eeecebf94459d449facd2c2f/tools/pvacview/data/Normalized_anchor_predictions_11_mer.tsv"), sep = "\t", header = TRUE, stringsAsFactors = FALSE)
for (peptide_length in 8:11) {
  for (allele in hla_alleles) {
for (peptide_length in 8:11) {
per_allele_anchor_scores <- list()
  for (allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[peptide_length]][anchor_data[[peptide_length]]["HLA"] == hla_allele][2:(peptide_length + 1)])
}
anchors_scores$peptide_length <- per_allele_anchor_scores
}
for (peptide_length in 8:11) {
per_allele_anchor_scores <- list()
  for (hla_allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[peptide_length]][anchor_data[[peptide_length]]["HLA"] == hla_allele][2:(peptide_length + 1)])
}
anchors_scores$peptide_length <- per_allele_anchor_scores
}
for (peptide_length in 8:11) {
per_allele_anchor_scores <- list()
  for (hla_allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[peptide_length]][anchor_data[[peptide_length]]["HLA"] == hla_allele][2:(peptide_length + 1)])
}
anchor_scores$peptide_length <- per_allele_anchor_scores
}
per_allele_anchor_scores <- list()
  for (hla_allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[peptide_length]][anchor_data[[peptide_length]]["HLA"] == hla_allele][2:(peptide_length + 1)])
}
per_allele_anchor_scores
hla_alleles
hla_alleles <- c("HLA-A*02:01", "HLA-B*03:05")
hla_alleles
  for (hla_allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[peptide_length]][anchor_data[[peptide_length]]["HLA"] == hla_allele][2:(peptide_length + 1)])
}
per_allele_anchor_scores
  for (hla_allele in hla_alleles) {
per_allele_anchor_scores$allele <- as.numeric(anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)])
}
per_allele_anchor_scores
anchor_data[[8]][anchor_data[[8]]["HLA"] == "HLA-A*02:01"][2:(8 + 1)]
per_length_anchor_scores <- data.frame()
for (length in 8:11) {
  per_length_anchor_scores$length <- anchor_data[[length]][anchor_data[[length]]["HLA"] == hla_allele][2:(length + 1)]
}
per_length_anchor_scores <- dict()
per_length_anchor_scores <- list()
for (length in 8:11) {
  per_length_anchor_scores$length <- anchor_data[[length]][anchor_data[[length]]["HLA"] == hla_allele][2:(length + 1)]
}
per_length_anchor_scores
8_mer_scores = anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
8_mer_scores <- anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
eight_mer_scores <- anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
nine_mer_scores <- anchor_data[[9]][anchor_data[[9]]["HLA"] == hla_allele][2:(9 + 1)]
ten_mer_scores <- anchor_data[[9]][anchor_data[[9]]["HLA"] == hla_allele][2:(9 + 1)]
ten_mer_scores <- anchor_data[[10]][anchor_data[[10]]["HLA"] == hla_allele][2:(10 + 1)]
eight_mer_scores
hla_allele
hla_allele[0]
hla_allele
anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
anchor_data[[8]]["HLA"] 
hla_allele <- HLA-C*08:15
hla_allele <- "HLA-C*08:15"
hla_allele
anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
eight_mer_scores <- anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)]
nine_mer_scores <- anchor_data[[9]][anchor_data[[9]]["HLA"] == hla_allele][2:(9 + 1)]
ten_mer_scores <- anchor_data[[10]][anchor_data[[10]]["HLA"] == hla_allele][2:(10 + 1)]
eleven_mer_scores <- anchor_data[[11]][anchor_data[[11]]["HLA"] == hla_allele][2:(11 + 1)]
per_length_anchor_scores <- data.frame(eight_mer_scores, nine_mer_scores, ten_mer_scores, eleven_mer_scores)
eight_mer_scores
nine_mer_scores
ten_mer_scores
eleven_mer_scores
eight_mer_scores <- anchor_data[[8]][anchor_data[[8]]["HLA"] == hla_allele][2:(8 + 1)] + "" + "" + ""
per_length_anchor_scores <- list(eight_mer_scores, nine_mer_scores, ten_mer_scores, eleven_mer_scores)
per_length_anchor_scores
ind <- which(lengths(per_length_anchor_scores) < 11)
ind
if (any(ind)) L[ind] <- lapply(L[ind], append, NA, after = 7)
if (any(ind)) per_length_anchor_scores[ind] <- lapply(per_length_anchor_scores[ind], append, NA)
per_length_anchor_scores
lapply(per_length_anchor_scores, `length<-`, max(lengths(per_length_anchor_scores)))
per_length_anchor_scores
per_length_anchor_scores <- lapply(per_length_anchor_scores, `length<-`, max(lengths(per_length_anchor_scores)))
per_length_anchor_scores
exit
q()
