10
|
1 library(Biostrings)
|
|
2 input_fasta = commandArgs(T)[1]
|
|
3 ## for testing input_fasta="/mnt/raid/454_data/RE2_benchmark/REPET_annotation/Prunus_persica/DANTE_proteins_filtered.fasta"
|
|
4 s = readAAStringSet(input_fasta)
|
|
5 names_table = do.call("rbind", strsplit(names(s)," "))
|
|
6 head(names_table)
|
|
7 classification_table = paste(names_table[,1], gsub("|","\t",names_table[,3], fixed = TRUE), sep="\t")
|
|
8 cat(unique(classification_table), sep="\n", file = paste(input_fasta, ".classification", sep = ""))
|
|
9
|
|
10 new_fasta_names = paste("NA-", names_table[,2], "__", names_table[,1], sep="")
|
|
11
|
|
12 names(s) = new_fasta_names
|
|
13
|
|
14 writeXStringSet(s, filepath = paste(input_fasta, ".db",sep=''))
|