split Treefile with thousand individual trees
1
0
Entering edit mode
19 months ago
Oscar ▴ 30

Hello to all.

I have an issue with a .treefile.

The output from an IQtree analysis contains phylogenetic trees in a single locus.treefile, so, I want to split this locus.treefile into single files to obtain 2060 individual files (gene_1.tree, gene_2.tree, gene_3.tree ... gene_2060.tree).

The estructure of the locus.treefile separate each tree with an " ; ". The following contains information for two of the trees (the file contains 2058 additional trees):

(AcspLA:0.0550850024,(((((((((((Amphipsocus_japonicus:1.5771368581,(Mesopsocus_unipunctatus:0.8365383843,Ptycta_johnsoni:0.0000025621):1.4774447149):4.8541249689,Eochi:0.0000022329):0.1344174527,((Asson:0.4126609598,(PocorIL:0.1836688674,Tecon:0.2418666321):0.0704386481):0.0280942648,((Dycol:0.1961781585,(FuspCA:0.1769105247,Valenzuela_badiostigma:0.1228532870):0.0368946618):0.1181803754,Pajap:0.2365433670):0.0336218799):0.0989756183):0.0275876256,NespEL:0.3799904864):0.0269265276,((((Bertkauia_sp:0.1996835619,Heterocaecilius_solocipennis:0.2810839219):0.1223689652,KaspPE:0.4073061209):0.0435778837,(((((Hemoc:0.0037848634,Hesmi:0.0039819046):0.0632385839,(Lachesilla_contraforcepeta:0.0457735376,LaspGHN:0.0685122622):0.0097144339):0.0108621111,(((Lapic:0.0409583342,(LarufMEX:0.0174576318,Lasp7Q:0.0233519081):0.0237937365):0.0129996555,Lapun:0.0711267075):0.0071725659,Latex:0.0290190965):0.0335594774):0.0198046870,Laped:0.0812291217):0.0096622032,LaspMLY:0.0616375041):0.1644360762):0.0200978861,(Eccry:0.2533730982,Ectopsocus_briggsi:0.0972539113):0.1569484594):0.0363384695):0.0495779929,(((Anama:0.4951611270,Idori:0.1406206376):0.0578980461,Xasom:1.6911980061):0.3626265631,KispEL:0.0673328073):0.1909529197):0.0245502365,(Elipsocus_kuriliensis:0.1812454931,Prpul:0.2501024166):0.0070727122):0.1581322264,(GRA1sp1LA:0.0565059253,Grint:0.0860243458):0.0343478571):0.0719184687,AnspLA:0.1231998418):0.1158243461,((Anpal:0.0377743706,PrspLA:0.0746790203):0.0128505872,((GRA2sp1LA:0.0433712951,GRAspLA:0.0116273364):0.0416790880,Wajar:0.1327100784):0.0165778607):0.0264912004):0.0311045638,Dacal:0.0083742870):0.0077716369,Daanc:0.0084948721); (AcspLA:0.0379350549,((((((((((((Amphipsocus_japonicus:0.1642865189,PocorIL:0.1997053515):0.1722065132,(((Dycol:0.3834131188,(FuspCA:0.2114511523,Valenzuela_badiostigma:0.2770859591):0.0463773738):0.0514403967,((Tecon:0.1006012119,Matsumuraiella_radiopicta:0.0499927965):0.1550516942,Graphopsocus_cruciatus:0.2057583464):0.1171203545):0.0443764170,(Pajap:0.3604314657,Xasom:0.2461379116):0.0688824437):0.0191288451):0.0792404837,Asson:0.4319538940):0.3197999993,(KaspPE:0.3052930718,Peripsocus_phaeopterus:0.1838043688):0.2703568320):0.0474314778,(Eccry:0.2663960114,Ectopsocus_briggsi:0.2460982767):0.1337472595):0.0385258672,((((Hemoc:0.0226485683,Hesmi:0.0206254129):0.1342505608,(Lachesilla_contraforcepeta:0.2090130012,LaspGHN:0.2298257799):0.1036318426):0.0396288984,((Lapic:0.0758480974,(((LarufMEX:0.0017301144,Lachesilla_abiesicola:0.0026905720):0.0299939566,Lasp7Q:0.0402756397):0.0334689461,Latex:0.0773631299):0.0270828381):0.0304605185,Lapun:0.1516689743):0.0542199019):0.0528901382,(Laped:0.2721550187,LaspMLY:0.2152446242):0.0241130509):0.3037300351):0.0255452620,((((Elipsocus_kuriliensis:0.2183555966,((Eochi:0.2621431376,Prpul:0.1927386607):0.0395580421,Mesopsocus_unipunctatus:0.1971171911):0.0342170127):0.0282165916,NespEL:0.2688196832):0.0271236508,KispEL:0.3361114626):0.0283502279,Idori:0.2219599092):0.0292904394):0.0361875746,((Bertkauia_sp:0.3832621946,Ptycta_johnsoni:0.3643924335):0.0771794895,Heterocaecilius_solocipennis:0.3672314209):0.0630369267):0.1789144285,((Anama:0.0534345579,AnspLA:0.0551688796):0.1626658476,(GRA1sp1LA:0.0801877236,Grint:0.1161832572):0.0987008193):0.0251440606):0.0538297391,Wajar:0.1936296251):0.0843190159,(GRA2sp1LA:0.0058000833,GRAspLA:0.0056482550):0.0752862083):0.0140802391,(Anpal:0.0544385358,PrspLA:0.0971035402):0.0246760636):0.0651149887,(Daanc:0.0256311204,Dacal:0.0342578557):0.0249309009);

Thanks for the help,

Best,

Os.

phylogenomics detection outlier • 404 views
ADD COMMENT
0
Entering edit mode
19 months ago
Mensur Dlakic ★ 27k
split -l 1 -d -a 4 locus.treefile gene_

Your files will be named gene_???? where those question marks stand for numbers from 0000-2059.

There may be a better way to rename them so they all end up with .tree, but here is my suggestion:

for i in gene_???? ; do mv $i $i.tree ; done
ADD COMMENT

Login before adding your answer.

Traffic: 1825 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6