[Biopython] Combine nexus files but not concatenating them

Denzel Li denzel.dz.li at gmail.com
Mon Oct 5 13:38:38 EDT 2009


Hi all:
I notice there is a solution for combining nexus files as appeared in the
cookbook
(http://biopython.org/wiki/Concatenate_nexus ).  However, in the example the
alignments are concatenated. What if I want is, for example, the following
two files are combined into one file as shown in "combinedFile.nex".

# file1.nex
b1 GGG
b2 GGT

# file2.nex
b1 AAA
b2 AAT


# combinedFile.nex
begin data;
  dimensions ntax=2 nchar=6
[alignment from file1.nex]
b1 GGG
b2 GGT
[alignment from file2.nex]
b1 AAA
b2 AAT
;end;

begin sets;
charset a1=1-3;
charset a2=4-6;
end;

Any suggestion is highly appreciated. Thank you.

Best,
Denzel


More information about the Biopython mailing list