我在文件中有以下序列文本
每个标题以“>”开头的内容行数是随机的
>XM_024446048.1 PREDICTED: Homo sapiens mannosidase alpha class 2A member 1 (MAN2A1), transcript variant X2, mRNA
CAGCCCCC
TGAGCGAC
TCCCTAATGTG
ACAGTAAAGAA
>NM_001308028.1 Homo sapiens FER tyrosine kinase (FER), transcript variant 2, mRNA
CAGCCC
CCGTGACGC
GGGGTGGTGACT
GGCTC
GGTGGT
GTGAC
>NM_0013082323028.1 H STZ mRSN1A
CAGCCC
CCGTGACGC
GGG
GTGGTGA
CTGGCTCCGGAGT
CTGAGGGGTTCGG
我想以下列格式创建一个嵌套的字典:
nested_dict = { 'sequence1': {
'header': 'XM_024446048.1 PREDICTED: Homo sapiens mannosidase alpha class 2A member 1 (MAN2A1), transcript variant X2, mRNA',
'content': 'CAGCCCCCTGAGCGACTCCCTAATGTGACAGTAAAGAA'
},
'sequence2': {
'header': 'NM_001308028.1 Homo sapiens FER tyrosine kinase (FER), transcript variant 2, mRNA',
'content': 'CAGCCCCCGTGACGCGGGGTGGTGACTGGCTCGGTGGTGTGAC'
},
'sequence3': {
'header': 'NM_0013082323028.1 H STZ mRSN1A',
'content': 'CAGCCCCCGTGACGCGGGGTGGTGACTGGCTCCGGAGTCTGAGGGGTTCGG'
}
我被正则表达式困住了,有人可以帮助我吗?
蝴蝶刀刀
相关分类