|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
本帖最后由 poppy章鱼 于 2021-12-27 19:58 编辑
文件一示例数据:
block10_scaffold_1 137tbca|TbCa004441 137tbca|TbCa004441...alignment2_718____121abcd|ABCD.ctg0001.608...alignment2_718
block10_scaffold_1 137tbca|TbCa004442 137tbca|TbCa004442...alignment665_110____121abcd|add.ABCD.ctg0025.374...alignment665_110
block10_scaffold_1 137tbca|TbCa004443 137tbca|TbCa004443...alignment2_717____121abcd|ABCD.ctg0001.607...alignment2_717
block10_scaffold_1 137tbca|TbCa004444 137tbca|TbCa004444...alignment2_716____121abcd|add.ABCD.ctg0001.296...alignment2_716
block10_scaffold_1 137tbca|TbCa004447 137tbca|TbCa004447...alignment2_715____121abcd|ABCD.ctg0001.606...alignment2_715
block10_scaffold_1 137tbca|TbCa004447 137tbca|TbCa004447...alignment665_109____121abcd|ABCD.ctg0025.483...alignment665_109
block10_scaffold_1 137tbca|TbCa004448 137tbca|TbCa004448...alignment2_714____121abcd|add.ABCD.ctg0001.295...alignment2_714
block10_scaffold_1 137tbca|TbCa004450 137tbca|TbCa004450...alignment2_713____121abcd|ABCD.ctg0001.605...alignment2_713
block10_scaffold_1 137tbca|TbCa004452 137tbca|TbCa004452...alignment2_712____121abcd|ABCD.ctg0001.604...alignment2_712
block10_scaffold_1 137tbca|TbCa004452 137tbca|TbCa004452...alignment665_108____121abcd|ABCD.ctg0025.482...alignment665_108
block10_scaffold_1 137tbca|TbCa004453 137tbca|TbCa004453...alignment665_107____121abcd|ABCD.ctg0025.481...alignment665_107
block10_scaffold_1 137tbca|TbCa004454 137tbca|TbCa004454...alignment2_711____121abcd|ABCD.ctg0001.603...alignment2_711
block10_scaffold_1 137tbca|TbCa004454 137tbca|TbCa004454...alignment665_106____121abcd|add.ABCD.ctg0025.373...alignment665_106
block10_scaffold_1 137tbca|TbCa004456 137tbca|TbCa004456...alignment2_710____121abcd|ABCD.ctg0001.601...alignment2_710
block10_scaffold_1 137tbca|TbCa004456 137tbca|TbCa004456...alignment665_105____121abcd|ABCD.ctg0025.480...alignment665_105
block10_scaffold_1 137tbca|TbCa004457 137tbca|TbCa004457...alignment2_709____121abcd|ABCD.ctg0001.600...alignment2_709
block10_scaffold_1 137tbca|TbCa004457 137tbca|TbCa004457...alignment665_104____121abcd|ABCD.ctg0025.479...alignment665_104
block10_scaffold_1 137tbca|TbCa004458 137tbca|TbCa004458...alignment2_708____121abcd|ABCD.ctg0001.599...alignment2_708
block10_scaffold_1 137tbca|TbCa004458 137tbca|TbCa004458...alignment665_103____121abcd|ABCD.ctg0025.478...alignment665_103
block10_scaffold_1 137tbca|TbCa046982 137tbca|TbCa046982...alignment2_719____121abcd|ABCD.ctg0001.609...alignment2_719
block10_scaffold_1 137tbca|TbCa046982 137tbca|TbCa046982...alignment315_0____121abcd|ABCD.ctg0011.675...alignment315_0
block12_scaffold_1 137tbca|TbCa005801 137tbca|TbCa005801...alignment2_42____121abcd|ABCD.ctg0001.43...alignment2_42
block12_scaffold_1 137tbca|TbCa005803 137tbca|TbCa005803...alignment2_41____121abcd|add.ABCD.ctg0001.35...alignment2_41
block12_scaffold_1 137tbca|TbCa005803 137tbca|TbCa005803...alignment664_69____121abcd|add.ABCD.ctg0025.21...alignment664_69
block12_scaffold_1 137tbca|TbCa005806 137tbca|TbCa005806...alignment2_40____121abcd|ABCD.ctg0001.41...alignment2_40
block12_scaffold_1 137tbca|TbCa005809 137tbca|TbCa005809...alignment2_39____121abcd|ABCD.ctg0001.40...alignment2_39
block12_scaffold_1 137tbca|TbCa005810 137tbca|TbCa005810...alignment664_68____121abcd|add.ABCD.ctg0025.20...alignment664_68
block12_scaffold_1 137tbca|TbCa005813 137tbca|TbCa005813...alignment2_38____121abcd|add.ABCD.ctg0001.33...alignment2_38
block12_scaffold_1 137tbca|TbCa005813 137tbca|TbCa005813...alignment664_67____121abcd|add.ABCD.ctg0025.19...alignment664_67
block12_scaffold_1 137tbca|TbCa005815 137tbca|TbCa005815...alignment2_37____121abcd|ABCD.ctg0001.39...alignment2_37
block12_scaffold_1 137tbca|TbCa005815 137tbca|TbCa005815...alignment664_66____121abcd|ABCD.ctg0025.58...alignment664_66
block12_scaffold_1 137tbca|TbCa005816 137tbca|TbCa005816...alignment664_65____121abcd|add.ABCD.ctg0025.18...alignment664_65
block12_scaffold_1 137tbca|TbCa005817 137tbca|TbCa005817...alignment2_36____121abcd|ABCD.ctg0001.38...alignment2_36
block12_scaffold_1 137tbca|TbCa005817 137tbca|TbCa005817...alignment664_64____121abcd|ABCD.ctg0025.57...alignment664_64
block12_scaffold_1 137tbca|TbCa005818 137tbca|TbCa005818...alignment2_35____121abcd|ABCD.ctg0001.37...alignment2_35
block12_scaffold_1 137tbca|TbCa005818 137tbca|TbCa005818...alignment664_63____121abcd|ABCD.ctg0025.56...alignment664_63
block12_scaffold_1 137tbca|TbCa005819 137tbca|TbCa005819...alignment2_34____121abcd|add.ABCD.ctg0001.32...alignment2_34
block12_scaffold_1 137tbca|TbCa005819 137tbca|TbCa005819...alignment664_62____121abcd|ABCD.ctg0025.55...alignment664_62
block12_scaffold_1 137tbca|TbCa005821 137tbca|TbCa005821...alignment2_33____121abcd|ABCD.ctg0001.35...alignment2_33
block12_scaffold_1 137tbca|TbCa005825 137tbca|TbCa005825...alignment2_32____121abcd|add.ABCD.ctg0001.20...alignment2_32
block12_scaffold_1 137tbca|TbCa005835 137tbca|TbCa005835...alignment2_31____121abcd|ABCD.ctg0001.33...alignment2_31
block12_scaffold_1 137tbca|TbCa005836 137tbca|TbCa005836...alignment2_30____121abcd|ABCD.ctg0001.32...alignment2_30
block12_scaffold_1 137tbca|TbCa005836 137tbca|TbCa005836...alignment664_61____121abcd|ABCD.ctg0025.54...alignment664_61
block12_scaffold_1 137tbca|TbCa005837 137tbca|TbCa005837...alignment2_29____121abcd|ABCD.ctg0001.31...alignment2_29
block12_scaffold_1 137tbca|TbCa005837 137tbca|TbCa005837...alignment664_60____121abcd|ABCD.ctg0025.53...alignment664_60
block12_scaffold_1 137tbca|TbCa005838 137tbca|TbCa005838...alignment664_59____121abcd|ABCD.ctg0025.52...alignment664_59
block12_scaffold_1 137tbca|TbCa005839 137tbca|TbCa005839...alignment664_58____121abcd|add.ABCD.ctg0025.17...alignment664_58
文件二示例数据:
block10_scaffold_1 total: 21 alignment2 12 0.5714 alignment665 8 0.3810
block12_scaffold_1 total: 26 alignment2 14 0.5385 alignment664 12 0.4615
我有两个文件,如果文件二中的第一列(block10_scaffold_1)在文件一第一列中,同时文件二中第二列的alignmentX在文件一第三列中(...到_之前的值),则将文件二的第二列,第三列匹配到的结果(匹配文件一第三列第一个...前的值和____到第二个...之前的值)分别输出到两个文件中
想要输出两个文件:
输出文件一:
##block10_scaffold_1 total: 21 alignment2 12
137tbca|TbCa004441 121abcd|ABCD.ctg0001.608
137tbca|TbCa004443 121abcd|ABCD.ctg0001.607
137tbca|TbCa004444 121abcd|add.ABCD.ctg0001.296
137tbca|TbCa004447 121abcd|ABCD.ctg0001.606
137tbca|TbCa004448 121abcd|add.ABCD.ctg0001.295
137tbca|TbCa004450 121abcd|ABCD.ctg0001.605
137tbca|TbCa004452 121abcd|ABCD.ctg0001.604
137tbca|TbCa004454 121abcd|ABCD.ctg0001.603
137tbca|TbCa004456 121abcd|ABCD.ctg0001.601
137tbca|TbCa004457 121abcd|ABCD.ctg0001.600
137tbca|TbCa004458 121abcd|ABCD.ctg0001.599
137tbca|TbCa046982 121abcd|ABCD.ctg0001.609
##block12_scaffold_1 total: 26 alignment2 14
137tbca|TbCa005801 121abcd|ABCD.ctg0001.43
137tbca|TbCa005803 121abcd|add.ABCD.ctg0001.35
137tbca|TbCa005806 121abcd|ABCD.ctg0001.41
137tbca|TbCa005809 121abcd|ABCD.ctg0001.40
137tbca|TbCa005813 121abcd|add.ABCD.ctg0001.33
137tbca|TbCa005815 121abcd|ABCD.ctg0001.39
137tbca|TbCa005817 121abcd|ABCD.ctg0001.38
137tbca|TbCa005818 121abcd|ABCD.ctg0001.37
137tbca|TbCa005819 121abcd|add.ABCD.ctg0001.32
137tbca|TbCa005821 121abcd|ABCD.ctg0001.35
137tbca|TbCa005825 121abcd|add.ABCD.ctg0001.20
137tbca|TbCa005835 121abcd|ABCD.ctg0001.33
137tbca|TbCa005836 121abcd|ABCD.ctg0001.32
137tbca|TbCa005837 121abcd|ABCD.ctg0001.31
输出文件二:
##block10_scaffold_1 total: 21 lignment665 8
137tbca|TbCa004442 121abcd|add.ABCD.ctg0025.374
137tbca|TbCa004447 121abcd|ABCD.ctg0025.483
137tbca|TbCa004452 121abcd|ABCD.ctg0025.482
137tbca|TbCa004453 121abcd|ABCD.ctg0025.481
137tbca|TbCa004454 121abcd|add.ABCD.ctg0025.373
137tbca|TbCa004456 121abcd|ABCD.ctg0025.480
137tbca|TbCa004457 121abcd|ABCD.ctg0025.479
137tbca|TbCa004458 121abcd|ABCD.ctg0025.478
##block12_scaffold_1 total: 26 alignment664 12
137tbca|TbCa005803 121abcd|add.ABCD.ctg0025.21
137tbca|TbCa005810 121abcd|add.ABCD.ctg0025.20
137tbca|TbCa005813 121abcd|add.ABCD.ctg0025.19
137tbca|TbCa005815 121abcd|ABCD.ctg0025.58
137tbca|TbCa005816 121abcd|add.ABCD.ctg0025.18
137tbca|TbCa005817 121abcd|ABCD.ctg0025.57
137tbca|TbCa005818 121abcd|ABCD.ctg0025.56
137tbca|TbCa005819 121abcd|ABCD.ctg0025.55
137tbca|TbCa005836 121abcd|ABCD.ctg0025.54
137tbca|TbCa005837 121abcd|ABCD.ctg0025.53
137tbca|TbCa005838 121abcd|ABCD.ctg0025.52
137tbca|TbCa005839 121abcd|add.ABCD.ctg0025.17
求天使帮助,我实在太菜了,写了半天没搞定,着急,感谢!
|
|