Entering edit mode
7.2 years ago
lessismore
★
1.4k
Hey all,
i have 2 files: 1 is an MSA
>tr|B4GH81|B4GH81_MAIZE
MCGILAVLGC----------SDCS--QARR-AR----ILACSRR------------------------------------LKHRGPDWSGLYQH------------------------------------------------------------------EGNFLAQQRLAIVSPLSGDQPLFNEDRTVVV-------VANGEIYNHKNVR--KQFT-GAH--
>tr|A0A1BAAANT6|A0A1BAAANT6_SORBI
MCGILAVLGC----------SDWS--QARR-AR----VLACARR------------------------------------LKHRGPDWSGLYQH------------------------------------------------------------------EGNFLAQQRLAIVSPLSGDQPLFNEDRTVVV-------VANGEIYNHKNIR--KQFT-GTH--NFTTGSDCEVIIPLYEKYGENFVDMLDGVFAFVLYDTRDRT------YVAARDAIGVNPLYIGWFVVG--------------------LE-GSPDLKAAREVADYLGTIHHEFHFTV-----
>tr|K3TTT2J1|K3TTT2J1_SETIT
--------------------------------------------------------------------------------LRHRGPDWSGLHCH------------------------------------------------------------------QDCYLAHQRLAIVDPTSGDQLLYNEDKSVVV-------TVNGEIYNHEELK--AKL--TTH--KFQTVSDCEVIAHLYEEYGEEFVDMLDGMFAFVLLDTRDKS------FIAARDAIGICPLYMGWGLDGSVWFSSEMKALSDDCERFITFPPGHLRWYLHIKKG-SGLRRWFNLPWFL-----E--SI-PST-PYNPLLLQGMFEK----------------
It goes like that for some hundred sequences. The second file is a list of IDs which i would like to replace these one i previously showed in the MSA in this case:
B4GH81_Zea mays
A0A1BAAANT6_Sor bicolor
K3TTT2J1_Set italica
So basically i want to write something that for each line in the list file splits the correct IDs by the underscore and then search the first string in the file. If it finds a match then replace that header with the one in the list.
Hope it is clear, thanks in advance
It gives me this
i solved adding
to your code. thanks