Entering edit mode
8 months ago
I0110
▴
160
I am using HMMER recently and somehow found the output (space delimited) difficult to parse. There are several tools I found but seem not working. I figured out some simple code for linux terminal to make the HMMER output to tab delimited.
#Parse HMMER
#remove all lines start with #
sed '/^#/ d' < ~/Desktop/data/HMMER.txt > ~/Desktop/data/HMMER2.txt
#make multiple spaces to one space
tr -s " " < ~/Desktop/data/HMMER2.txt > ~/Desktop/data/HMMER3.txt
#replace space with tab
tr ' ' '\t' < ~/Desktop/data/HMMER3.txt > ~/Desktop/data/HMMER_tab.txt
#you need to add the column names back
You can add the column names back in R like:
HMMER <- read.delim(file="~/Desktop/data/HMMER_tab.txt",header=F,stringsAsFactors=F,sep="\t")
colnames(HMMER) <- c("target_name","t_accession","query_name",
"q_accession","full_seq_E_value","full_score",
"full_bias","best_1_E_value","best_1_score",
"best_1_bias","exp","reg","clu","ov","env",
"dom","rep","inc","description_of_target")
Nice, thank you so much!