This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Concatenate SNPs for phylogenetic

Dear All,

I have a list of SNPs from different samples, which present common and different SNPs in respect to a common ancestor. I'm interest to create concatenate files of the SNPs for phylogenetic studies. The problem is that I have samples that don't present a SNPs in a particular position and I need to fill this gap with the reference nucleotide so I obtain perfect concatenate files. This is because if not phylogenetic programs ignore complete this position. I have done it through lockup in excel but when you have more than 30,000 is quite time consuming. Some one knows a better way to do it?

snp alignment
Can you show us what your snp list looks like? Sounds like you need to write a simple script, but users will need details to provide a helpful answer

When I extract my snps from vcf files into excel they look like this

1849      SNV     C     A
2532      SNV     C     T
9143      SNV     C     T
11820     SNV     C     G

for one isolate, and for following isolates the positions of the snps can differ

2532      SNV     C     T
2586      SNV     G     T
9143      SNV     C     T
11370     SNV     C     T

If I do a multi-alignment in Mega it looks like below, were there is not snp it will be a gap. This reduce my analysis as mega ignore columns with gaps. I need to fill the gap with the ref nucleotide in a better way that lock up in excel. Any ideas?

ACACAGGGGCCCGCGAACCCAGCGCGGCCAA
ACACAGGG-CTCGCGAAGCCAGCGCTGCCAA
ACAGAGGGTCCCGCGAAGCCAGCGCTGCCAA
ACACAGGGTCTCGCGAACCCAG-GCTGCCAA

Thanks David. The link have a variety of solutions that by sure will help me.

I try the solutions in the link, and they are good, but it finishing giving me the whole genome. If I try to do multi alignment and run in beast it will take forever. Thus, I was using only a list of positions from my reference and then find it them in the vcf files from my samples, which imply that I still don't have a better way to do it than in excel. Any other suggestions. Thanks.

You have a few options that I can see:

Take your massive alignment and drop non-variables sites (some MSA viewers do this, it wouldn't be hard to script it if you're dealing with very large genomes)

Use a "combine variants" tools from bcftools/gatk/picard to make a single VCF for all your variants, extract the sites from the vcf

Use bedtools intersect to create a set of polymorphic sites, use the resulting bed file to extract only the variable sites from the reference genome

Which is best will depend on what you've already done and what tools you are confident with, but it should be possible

1 answer

If samples are really related (e.g. strains from the same organism), why not try a multi-sequence alignment on the concatenated snp sequences, without filling the gaps with reference nucleotides?

I agree with the response from Cytosine. I would add that it might be useful to add a length of reference sequence to each end of the concatenated SNPs in order to guide the alignment and have no overhangs or unaligned portions.

Thanks for your answers. The problem that I see if I do a multip-sequence alignment of the concatenated snp sequences is that if I have three isolates were only two have a snps in position 10 and the third isolate does not, in the multi-aligment a dash will appear. In phylogenetic programs the dash is count as lack of information and this snp will be lost in the resolution of the three. If this happen to often as I increase the number of isolates my number of snps, and resolution of tree, will decrease. Because of that I though that if I can do the alignment and run some program that fill the gaps it will work better. But as I'm very new in this I have no idea how to do it myself. Any suggestions?Thanks

Sites like biostars work best if the answer section is reserved for posts answering the question at the top. You should add messages like this as comments to specific answers, or, in this case an edit to your original question. If you make an edited question we can delete this answer

Log in to answer this question.