第一列(scaffold这一列)相同,则根据第AS列(AS:i:xx)数字 xx的大小,保留数字最大的行。如果数字大小相同则都保留。
举例,
输入文件
scaffold_010679_1AL.2 16 chr1A 429400034 119 3272M * GACACAAGAGACTCTTTG * AS:i:3268 XS:i:2147 XF:i:0 XE:i:29 NM:i:1
scaffold_010679_1AL.2 16 chr1A 429400034 119 3272M * GACACAAGAGACTCTTTG * AS:i:3268 XS:i:2147 XF:i:0 XE:i:29 NM:i:1
scaffold_010679_1AL.2 16 chr1A 429400034 119 3272M * GACACAAGAGACTCTTTG * AS:i:1268 XS:i:2147 XF:i:0 XE:i:29 NM:i:1
scaffold_010679_1AL.3 16 chr1A 429397743 19 599S1730M1I279M * 0 0 TGCCGAGGTTTTTGA * AS:i:1998 XS:i:1877 XF:i:3 XE:i:20 NM:i:2 XN:i:1
scaffold_010679_1AL.3 16 chr1A 429397743 19 599S1730M1I279M * 0 0 TGCCGAGGTTTTTGA * AS:i:1098 XS:i:1877 XF:i:3 XE:i:20 NM:i:2 XN:i:1
结果文件
scaffold_010679_1AL.2 16 chr1A 429400034 119 3272M * GACACAAGAGACTCTTTG * AS:i:3268 XS:i:2147 XF:i:0 XE:i:29 NM:i:1
scaffold_010679_1AL.2 16 chr1A 429400034 119 3272M * GACACAAGAGACTCTTTG * AS:i:3268 XS:i:2147 XF:i:0 XE:i:29 NM:i:1
scaffold_010679_1AL.3 16 chr1A 429397743 19 599S1730M1I279M * 0 0 TGCCGAGGTTTTTGA * AS:i:1998 XS:i:1877 XF:i:3 XE:i:20 NM:i:2 XN:i:1
The idea file is divided into 3 columns according to the asterisk *, sorted in descending order according to the third column, take out the first row, take out the AS:i: maximum number, search it with grep, and get the result.
I didn’t read the question carefully and made a mistake~~The result is wrong