| 
47
 | 
     1 args <- commandArgs(trailingOnly = TRUE)
 | 
| 
 | 
     2 
 | 
| 
 | 
     3 naive.file = args[1]
 | 
| 
 | 
     4 shm.file = args[2]
 | 
| 
 | 
     5 output.file = args[3]
 | 
| 
 | 
     6 
 | 
| 
 | 
     7 naive = read.table(naive.file, sep="\t", header=T, quote="", fill=T)
 | 
| 
 | 
     8 shm.merge = read.table(shm.file, sep="\t", header=T, quote="", fill=T)
 | 
| 
 | 
     9 
 | 
| 
 | 
    10 
 | 
| 
 | 
    11 final = merge(naive, shm.merge[,c("Sequence.ID", "best_match")], by.x="ID", by.y="Sequence.ID")
 | 
| 
 | 
    12 print(paste("nrow final:", nrow(final)))
 | 
| 
 | 
    13 names(final)[names(final) == "best_match"] = "Sample"
 | 
| 
 | 
    14 final.numeric = final[,sapply(final, is.numeric)]
 | 
| 
 | 
    15 final.numeric[is.na(final.numeric)] = 0
 | 
| 
 | 
    16 final[,sapply(final, is.numeric)] = final.numeric
 | 
| 
 | 
    17 print(paste("nrow final:", nrow(final)))
 | 
| 
 | 
    18 final2 = final
 | 
| 
 | 
    19 final2$Sample = gsub("[0-9]", "", final2$Sample)
 | 
| 
 | 
    20 final = rbind(final, final2)
 | 
| 
 | 
    21 final$Replicate = 1
 | 
| 
 | 
    22 
 | 
| 
 | 
    23 write.table(final, output.file, quote=F, sep="\t", row.names=F, col.names=T)
 |