0

文件 1:

Locus        Gene name
chr1         AT1G27893.6
chr3         AT3G28270.3
chr4         AT5G46005.1
chr8         AT8G59300.5

文件 2:

Gene name              Type                  Short_description
AT1G01010.1       protein_coding        AP2/B3-like transcriptional factor 
AT3G28270.3       protein_coding        NAC domain containing protein 1
AT8G59300.5       protein_coding        mitochondrial ribosomal protein S7
ATMG01270.1       protein_coding        FRIGIDA like 2  family member

输出:

基因座 基因名称 类型 Short_description

chr3           AT3G28270.3        protein_coding        NAC domain containing protein 1
chr4           AT8G59300.5        protein_coding        mitochondrial ribosomal protein S7

我使用的代码

awk -F"," 'NR==FNR{a[$1]=$0;next} ($1 in a){ print a[$1]; next}1' file2 file1

我无法获得所需的输出,它打印 file2 中的所有行。

4

1 回答 1

1

尝试使用join

join -1 2 -2 1 file1 file2

输出:

Gene Locus name name Type Short_description
AT3G28270.3 chr3 protein_coding NAC domain containing protein 1
AT8G59300.5 chr8 protein_coding mitochondrial ribosomal protein S7
于 2013-10-16T07:15:15.527 回答