Thanks!
I get some errors though. Does the nexus parsers assume interleaved format?
Traceback (most recent call last):
File "nexus.py", line 19, in <module>
for record in SeqIO.parse ("est.holozoa.nex", "nexus"):
File "//anaconda/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 586, in parse
for r in i:
File "//anaconda/lib/python2.7/site-packages/Bio/SeqIO/__init__.py", line 580, in <genexpr>
I = (r for alignment in AlignIO.parse(fp, format,
File "//anaconda/lib/python2.7/site-packages/Bio/AlignIO/__init__.py", line 370, in parse
for a in i:
File "//anaconda/lib/python2.7/site-packages/Bio/AlignIO/NexusIO.py", line 40, in NexusIterator
n = Nexus.Nexus(handle)
File "//anaconda/lib/python2.7/site-packages/Bio/Nexus/Nexus.py", line 587, in __init__
self.read(input)
File "//anaconda/lib/python2.7/site-packages/Bio/Nexus/Nexus.py", line 638, in read
self._parse_nexus_block(title, contents)
File "//anaconda/lib/python2.7/site-packages/Bio/Nexus/Nexus.py", line 679, in _parse_nexus_block
getattr(self, '_' + line.command)(line.options)
File "//anaconda/lib/python2.7/site-packages/Bio/Nexus/Nexus.py", line 899, in _matrix
"(check dimensions/interleaving)" % (id, c, iupac_seq))
Do you have an interleaved nexus file or does each sample just have one long line with the sample name and then sequence?
Non-interleaved, each taxon on a long line. It seems that the file is written by Mesquite. I tried to open it in Mesquite, but it didn't recognize the partitions. The partitions are described after the alignment like this (not sure what the DEFTYPE line means though...):
An individual nexus file for each phylogeny? and also how many genes in that ASSUMPTIONS block?
The format of the individual files is not that important. I will run RAxML so phylip is the best. But nexus or fasta is also fine.
There are 406 genes in ASSUMPTIONS.
Hmm, no I don't have any scripts on hand to deal with that situation sorry. Was going to try and write a little python script that pulls out the matrix block, then subsets into new nexus files based on the gene positions, but because of the number of genes I would also have to parse the assumption block. Thought it may have been a very fast script to write, but I should really study for these finals. Sorry I couldn't be any help, hopefully someone else finds a solution for you.
The only suggestion I can give is to play around with the Nexus parser in biopython, and try and twist it to solve this problem.
Ok, but thanks a lot anyway,