This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How do I extract locus-position information from XMFA file? Start-end positions of each locus.

I have an XMFA alignment of >400 taxa, with 2,000 loci. I need to find where each locus begins and ends, as in a partition file. Next step I will extract the single-locus alignments for dN/dS from the fasta-version of this genome alignment.

Is there a quick way to find start-end positions for each gene? Like a partition file for a phylogeny reconstruction. It takes too long to go through one by one by Ctrl+F.

genome alignment xmfa sequence fasta

1 answer

Hi,

I assume that you are talking about file like this: http://darlinglab.org/mauve/user-guide/files.html (I took the example as a SAMPLE_FILE)

>seq_num:start1-end1 ± comments (sequence name, etc.)

Do you need to extract the seq_num and the start1, end1 indices? This can be done with grep and awk combo (you need terminal with grep and awk programs).

For that it would be:

grep ">" SAMPLE_FILE | awk -F'>|> |:|-| ' -v OFS=', ' '{print $2, $3, $4}'
seq_num, start1, end1
seq_num, startN, endN
seq_num, start1, end1
seq_num, startN, endN

Best regards

Log in to answer this question.