How to convert FASTA to NEXUS in Python
I have a FASTA file which has different sequences of different lengths. I would like to convert this file to NEXUS format. I tried with SeqIO.convert but it didn't work properly.
Thanks for any answer.
fasta
biopython
nexus
• 4,307 views
•
link
updated
by
Ram
•
written
by
adrian18_07 •
0 answers
No answers yet.
Log in to answer this question.
More posts like this
-
Gblocks file not opened error
written by sa.youssef •I am trying to extract the conserved regions from the MSA file but when I open the file, it is stated file not opened even …
-
Tdf to bed
written by jt •Hi! I would like to convert tdf file to bed format. I have tried igvtools tdftobedgraph commad but it does not work. Have you any …
-
Adding in a specific place to a file in python
written by adrian18_07 •I have a NEXUS file and want to add a block to it. The file looks like this: #NEXUS begin data; dimensions ntax=2 nchar=633; format …
-
Indel coding in python
written by adrian18_07 •I have 2 sequences with gaps: 15888 CATG----ACAGAGCGACCCGCG--CACGTTACAAACACTACGCGGGGTGGCCCCGG 42690 CATGCCCGACAGAGCGACCCGCGAACACGTTACAAACACTACG---GGTGGCCCCGG I would like to encode indels in binary form. Gap is marked with 0 and …
-
How to make consensus sequences for a list?
written by adrian18_07 •I have a sequence list, it looks like this: [['CATGCCCGACAGAGCGACCCGCGAACACGTTACAAACACTACGCGGGGTGGCCCCGGCTGCCTCGCGCGGAGGTGCTGCGGCTGAGTGCGCAAACTAGCTGCGCGCACGCTGTCCGTGCCACCTCCACTAACAGAACCCCGGCGCGGACTGCGCCAAGGAATAAAAAACGAATGAGAGCGAGCGCGCCCCCCTCGCCCCGGAGACGGTGCGCGATGGTGTGTGCCTCGCTGTCCATTGATAAACTAAACGACTCTCGGCAACGGATATCTCGGCTCTCGCATCGATGAARAACGTAGCGAAATGCGATACTTGGTGTGAATTGCARAATCCCGTGAATCATCGAGTCTTTGAACGCAAGTTGCGCCCGAAGCCTTCTGGCCGAGGGCACGTCTGCCTGGGTGTCACGCAACGTCGCCGCCAACCCCACCCCTAGGGGCGGGAAGTTGGGGGCGGACTCTGGCCTCCCGTGCGCCTCGGCGCGCGGATGGCCTAAATTTCAGCTCCTGGCGAGGATCGCCACGACAAGCGGTGGTTTTTTGAACTAAGGACCTCGGGTGTTGTCGTGCGGCCTCCCGGAGGGAACGGACCCTGTGCGCTCGCGCACCATCCTATCGAGACCCCAGGTCAGTCGG', 'CATGCCCGACAGAGCGACCCGCGAACACGTTACAAACACTACGCGGGGTGGCCCCGGCTGCCTCGCGCGGAGGTGCTGCGGCTGAGTGCGCAAACTAGCTGCGCGCACGCTGTCCGTGCCACCTCCACTAACAGAACCCCGGCGCGGACTGCGCCAAGGAATAAAAAACGAATGAGAGCGAGCGCGCCCCCCTCGCCCCGGAGACGGTGCGCGATGGTGTGTGCCTCGCTGTCCATTGATAAACTAAACGACTCTCGGCAACGGATATCTCGGCTCTCGCATCGATGAAGAACGTAGCGAAATGCGATACTTGGTGTGAATTGCAGAATCCCGTGAATCATCGAGTCTTTGAACGCAAGTTGCGCCCGAAGCCTTCTGGCCGAGGGCACGTCTGCCTGGGTGTCACGCAACGTCGCCGCCAACCCCACCCCTAGGGGCGGGAAGTTGGGGGCGGACTCTGGCCTCCCGTGCGCCTCGGCGCGCGGATGGCCTAAATTTCAGCTCCTGGCGAGGATCGCCACGACAAGCGGTGGTTTTTTGAACTAAGGACCTCGGGTGTTGTCGTGCGGCCTCCCGGAGGGAACGGACCCTGTGCGCTCGCGCACCATCCTATCGAGACCCCAGGTCAGTYAG'], ['CATGCCCGACAGAGCGACCCGCGAACACGTTACAAACACTACGCGGGGTGGCCCCGGCTGCCTCGCGCGGAGGTGCTGCGGCTGAGTGCGCAAACTAGCTGCGCGCACGCTGTCCGTGCCACCTCCACTAACAGAACCCCGGCGCGGACTGCGCCAAGGAATAAAAAACGAATGAGAGCGAGCGCGCCCCCCTCGCCCCGGAGACGGTGCGCGATGGTGTGTGCCTCGCTGTCCATTGATAAACTAAACGACTCTCGGCAACGGATATCTCGGCTCTCGCATCGATGAARAACGTAGCGAAATGCGATACTTGGTGTGAATTGCARAATCCCGTGAATCATCGAGTCTTTGAACGCAAGTTGCGCCCGAAGCCTTCTGGCCGAGGGCACGTCTGCCTGGGTGTCACGCAACGTCGCCGCCAACCCCACCCCTAGGGGCGGGAAGTTGGGGGCGGACTCTGGCCTCCCGTGCGCCTCGGCGCGCGRATGGCCTAAWTTTCAGCTCCTGGCGAGGATCGCCACGACAAGCGGTGGTTTTTTGAACTAAGGACCTCGGGTGTTGTCGTGCGGCCTCCCGGAGGGAACGGACCCTGTGCGCTCGCGCACCATCCTATCGAGACCCCA', 'CATGCCCGACAGAGCGACCCGCGAACACGTTACAAACACTACGCGGGGTGGCCCCGGCTGCCTCGCGCGGAGGTGCTGCGGCTGAGTGCGCAAACTAGCTGCGCGCACGCTGTCCGTGCCACCTCCACTAACAGAACCCCGGCGCGGAYTGCGCCAAGGAATAAAAAACGAATGAGAGCGAGCGCGCCCCCCTCGCCCCGGAGACGGTGCGCGATGGTGTGTGCCTCGCTGTCCATTGATAAACTAAACGACTCTCGGCAACGGATATCTCGGCTCTCGCATCGATGAAGAACGTAGCGAAATGCGATACTTGGTGTGAATTGCAGAATCCCGTGAATCATCGAGTCTTTGAACGCAAGTTGCGCCCGAAGCCTTCTGGCCGAGGGCACGTCTGCCTGGGTGTCACGCAACGTCGCCGCCAACCCCACCCCTAGGGGCGGGAAGTTGGGGGCGGACTCTGGCCTCCCGTGCGCCTCGGCGCGCGGATGGCCTAAATTTCAGCTCCTGGCGAGGATCGCCACGACAAGCGGTGGTTTTTTGAACTAAGGACCTCGGGTGTTGTCGTGCGGCCTCCCGGAGGGAACGGACCCTGTGCGCTCGCGCACCATCCTATCGAGACCCCA']] I would like to receive consensus sequences in turn for each sub-list. …
-
Plink tped and tfam files to vcf conversion
written by ShubTheFlash •Hi, I have plink format .tped and .tfam files, in the format of A,B alleles. Could someone please advise how to convert these back to …
-
Outgroup in DNA Alignment File (Nexus) (Network 5.0)
written by matthew.m.hernandez •Hi everyone, I'm essentially trying to avoid having to pay for additional software to work with the Network 5 phylogenetic [software][1] by converting my fasta …
-
Biopython script to change file formats and headers
written by skbrimerHi group, I'm trying to make a script in python that will change formats from fastq to fasta, which I have: from Bio import SeqIO …
-
how XFMA file can be converted to nexus or phylip for further phylogenetic analysis
written by jeccy.JHello all can anyone suggest me how to convert XFMA file to converted to nexus or phylip for further phylogenetic analysis? I have tried like …
-
How To Convert A Fasta Or Alignment File To Nexus (.Nex) File That Is To Be Used In The Beast Prog…
written by triinlakspere •<p>Dear fellow scientists!</p> <p>I'm new in the field and need some help with a small problem.</p> <p>I have an .aln and .fas files of aligned …
Past relevant thread: How To Convert A Fasta Or Alignment File To Nexus (.Nex) File That Is To Be Used In The Beast Program
This link also lists the python code to use, if you did not write your's properly.
You should explain how it failed: how is your data, what you expected, and what you got.
The nexus format is tightly to phylogenetics, and sequences are only useful in phylogenetics when they are aligned. When sequences are aligned, they typically end up with the same length, either by trimming the extremities of the sequences such as all have the same length, or by filling with gaps the shorter sequences. Are your sequences aligned?