setwd ('/data/project/flowers/orthologous/transcriptional_factors') lista1 <- read.delim(file='TFs.list', header=F, stringsAsFactors=F) lista2 <- read.delim(file='PlantTFDB-allxUame-Purple_assm_id60_moresensitive_cov60', header=F, stringsAsFactors=F) colnames(lista1) <- c('ID', 'Desc') colnames(lista2) <- c('Transcript', 'ID', 'pident', 'length', 'mismatch', 'gapopen', 'qstart', 'qend', 'sstart', 'send', 'evalue', 'bitscore') head (lista1) head (lista2) merged_list <- merge(x=lista1, y=lista2, by.x='ID', by.y='ID') head (merged_list) dim(merged_list) library(xlsx) #write.xlsx(merged_list, 'Uame-Purple-merged.list.xls') write.table(merged_list, file='Uame-Purple-merged.list.txt', row.names=F, col.names=T, quote=F, sep="\t")