python代码求教 根据关键字符提取
@A01415:143:HH3KHDRXY:2:2101:1714:1204 1:N:0:CGTATCTC+CTCGAACA TGTGCAATACTTACGGGCATAATTACAAACTTATGTCCATATACCGTATTGATGTTTCCATAGCCTCAATGATGATATTTTGTTTGTATCCTGAAGTCAGGAACTTATTCCTTGATGAAACCGTGCAGCCCTCAATATACGAGCTTCATTTCAAATCTTCAATCTTGGTTGAGATTCCTACATGGCCCTGTTACTGTGTTACATTTGATCAATACCAATATCAAGTTACCGCTTGCAGGTGTGCCTCTTC + FF[]([]())FFFFFFFFFFFF:FFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,,FFFFFF:FFFFF:,F:FFFFFFFFF,F,:F,FF,FFFFF:F:FFFFF:FFF,FFFFFFFF:FFFFFFF:FFF @A01415:143:HH3KHDRXY:2:2101:10954:1204 1:N:0:CGTATCTC+CTCGAACA AGGAAAAGCGTGTCCTTTCAAATATTCAATTAATTGAGAGTCGGGGGGTTCCTCTGTGTTTCCATTCACTACAATTATCTCAAATTCCAACCAAAATTGCATATTGTTCCAAAAGCCCTAGAAAACCTATACAAAACCGACCGATCGATCACCCACATAAAATTGGGGATTAGGAATGTCGGAGGCGTACGAGAAGGTTAAAGGCGGAAGATTAATCTTCAAGGGCGGCGCACTCGCCACCCGCGACAAG + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF,FFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:F:FFFFF:FFF:FFFFFFFFFFFFFFFFFF:FFFF::FFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFF,F @A01415:143:HH3KHDRXY:2:2101:12400:1204 1:N:0:CGTATCTC+CTCGAACA TGGCTGCAACTTTCAGTGACAACTACTACAGAGTGGCCATCAAATTTATCATCCTGATTGTTAGGTGATTTATCACGGGTGTTAAGCTCAACATCTTCATTTAAAGCATCAGAACGATCCAATTCAAATATTTTGTCTTGCGCTTCAGAATAGTGTCCCTCTACACATTCCCTCGTCGTGTCCTGCAGGTTTTGCTCACTTCCTTGGGTATCATGTACGCCTGTTGTTACCTGATCAGAACTGGTATTAT + FFFFFFFF:FFFFFFFFFFFFFFFFFFFFFF,FFFFFFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF::FFF:FFF,FFFFFFF,,F,,FFFFFF:FFF::F:FFFFFFFF,FFF:FFFFFFFFFFF,F:F: @A01415:143:HH3KHDRXY:2:2101:12744:1204 1:N:0:CGTATCTC+CTCGAACA ACATGCGTTAGTGATCGACTTGTCCCCCCATGGAACTCTGAAAGACTTTCACGTGCCATTCCGGGATCTTATCTTGAAATAATCAAGAATTGTGGTCACTTACCCCAAGAAGAAAAGGCAATTGAGTTTGTGTCTATTGTTGAAAATTTTCTTCTGAGAGTATTTGGCGCTGCAGAAGAGGCACACCTGCAAGCGGTAACTTGATATTGGTATTGATCAAATGTAACACAGTAACAGGGCCATGTAGGAA + FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFF,FF,FFFFFFFFF:FF、上述是要实现的文本内容,根据第一个关键词“ACATGCGT”提取所在的行,但需包含是第一个@开始,下一个@结束内的内容,写入一个文件;随后根据第二个关键词“TGTGCAAT”,提取内容同上,再写入另一个文件,其余不包含第一二个关键词的的写入另一个文件,折腾了好久,还是没法实现,各种报错,请问大家可以指教一下吗?
你的文本有检查过吗?确定你说的条件符合吗?(好象有少)
关键词“ACATGCGT”所在位置在文本下半部分,起头 @ 但没有结尾 @(你最后是以 FFFFFFFFF:FF、结尾,哪里来的 @) 要知道你的关键词位置,键盘 F3 查找便可以马上知道 傻眼貓咪 发表于 2021-12-7 18:19
你的文本有检查过吗?确定你说的条件符合吗?(好象有少)
关键词“ACATGCGT”所在位置在文本下半部分,起 ...
@A00881:710:H7CK2DRXY:1:2101:20347:1031 1:N:0:ACCTAGAC+ATCCACGA
ANGAAAAGCGTGTCCTTTCAAATATTCAATTAATCGAGAGTCGGAGGCTTCCTCTGTGTTTCCATTCACTACAATTCTCTCGAATTCCTACCAAAGTTGTATATTGTTCCAAAACCCTAGAAAACCTATACAAAATCGACCGATCGATCACCCACATAGAATTGGGGATTAGGAATGTCGGAGGCGTACGAGAAGGTTAAAGGCGGAAGGTTAATCTTCAAGGGCGGCGCACTTGCCACCCGCGACAAGC
+
F#FFF:FFFF:FFFFFFFFFFFFFFFFFFFFF:F,FF,FFFFF:F:FFFF:FFFF:FFFFFFFFFF,FFFFFFF,FFFFF,::FFF:,F:::FFFFFF,FFFFFFFFF:FFFFF,:FFFFFFFFF:FFFF:FFFFF,,F:FFFF,FFFFFF:FFFF,FFFFF::FF,:FFFFFFFF,F,F:FF:FF,FFFFFF:,FFFFFF,FF,FF,FFFFFFF,FFFFFF,FF,FF:FFF,F,FFFFFFFF::,FFF:
@A00881:710:H7CK2DRXY:1:2101:28149:1047 1:N:0:ACCTAGAC+ATCCACGA
ACATGCGTTGTTTTACCTCCAGCAAACAACTGTTCGTACGGTACTGCTACATCCTCATCCCGAAAGCCACCAAAGATATTGGAGTAATTGAGCTTGGAGCTCCGAAAATCACCGGACCCGGCACTTTCGTCCAAACCCGAAAGATCGAGGACCGGAATGGACGACCCACGCTGAGAACCGGAGAAAATCTCAGCATAATCCTGAATTCCGAGCTTCGTGCCCACCGAACCCGGCCCTCCAACGTCGCTTGACAACAGA
+
FFFFFFF,FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF::FFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFF:FFFFF:FFFFFFFF:FFFF,FFF:FFF:,FFFFF,FFFFFF:::F:,:F:FFFFFFFF,FFF:F:FFF,FFFFFF,FFFF:F,FFFF:,F:F,FFFFFF,F
@A00881:710:H7CK2DRXY:1:2101:14543:1063 1:N:0:ACCTAGAC+ATCCACGA
GCACTATTTCTAAGCTCCCACACCTCGTTTTTCTTCCTCAACCGGTTCAAGCACACAGCACACGACGTGTCATGACTTTCGGGCAACCTACGGGTCATGTCACCGAAGGTGGTCAGGGTGAGACTGTCCTGAACCATCTTCAGGTTGGCCGAAGAAGAAGAGGAGGATTTAAATAAAGTTCGTGTTAACGCCTCTGACGAAAAAGAGAACCGGCTTATTGAATTCAAGAGAGTATGGGCAAAGGACCAGAGACATCTT
+
FFFFFFFFFFFFFFFF:FFFFFFFFFFFFFF,FFFFFFFFFFFFFFFF:FFFFFFFFFF,FFF:FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF:FFFFFFFFFFFFFFFF:FFF:FFFFF:FFF,F:FFFFFFFFF,FFF:FFFFFFFFFFFF:,FFFFFFFFFFFFFFF:FFFFF:,F,FFF,FF,FFFFFFFFFFFFFF:FFF:FFFF,FF:F,FFFFFFFFF:,
@是指以@起始的行,上面给的文本确实有问题
页:
[1]