split Treefile with thousand individual trees
1
0
Entering edit mode
6 days 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):

Thanks for the help,

Best,

Os.

phylogenomics detection outlier • 91 views
0
Entering edit mode
6 days ago
Mensur Dlakic ★ 20k
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