@Pierre does bedtools slop take genome.fa.fai file instead of just genome.fa?
Hai,
I am trying to extract 50 base pair sequence before and 50 bp after the coordinates present in my VCF files and write them to a file as fasta sequences. I have both the BAM files and the reference genome.
Can someone help me with the same?
Thanks in advance
1 answer
bcftools query -f '%CHROM\t%POS0\t%END\n' rotavirus_rf.vcf.gz |\
bedtools slop -b 50 -g rotavirus_rf.fa.fai |\
bedtools getfasta -fi rotavirus_rf.fa -bed -
the fai file. It wants a file chrom(tab)length to get the max-size of the chromosomes.
Hello,
I was trying to use the command cited in this post. It workes for me.
bcftools query -f '%CHROM\t%POS0\t%END\n' variation_sorted.vcf |\ bedtools slop -b 150 -g Equus_caballus.EquCab3.0.dna.toplevel.fa.fai |\ bedtools getfasta -fi Equus_caballus.EquCab3.0.dna.toplevel.fa -bed upflank.bed -tab -fo test.txt -name
However, I need the polymorphism. Is there any way to get the final sequence with the polymorphism with IUPAC code?
E.g: ATGGTGATGGGAGGGCACGTGGACCGACGGGTGAACAGCTCTGTGACCGTGGGGCCAACGCTCTCGGGTGAGGCCCTGCCAAGGGGGCGAAACRCTGCCCGSACWGTSCGGGCAGTGGTGGTGAGSCCYCAGGCTGAGGGCTCACCCAGC[C/T] GCAGTCAGGCCCTGGAGCTGCTAAGTAGCCTGGTGCCTGCTGAGCGTAGCCCACCTACYGGCCRGCTTCCTAGGCCCATGGCTGTTGTGCCAAGGAGTCCAGGTCTGGGTCGCTCAGTARGTGAAGCCCTGGGGCAGCTACCTGAGACAG
Help please
Log in to answer this question.
See the answers here: https://www.biostars.org/p/46331/My mistake. Will leave this here since the comment below is nested.
Is she not telling here that her coordinates are in VCF file and sequence in bam or reference genome? If so, the it can be done like this using
bedtools.It is unclear if OP wants to get the region from the fastq/alignments or from original/new consensus reference.