Trying to edit VCF file
0
0
Entering edit mode
17 months ago
peavy • 0

Hi,

I've been trying to take some samples out of a file but it appears its only taken some of the information out. When I tried to run a code I had in R that works for all the samples it gave me an error about the number of samples not matching the population map file which I also updated. When I opened the vcf in excel I noticed that there was still columns for what I removed from the file. perhaps I didn't properly remove everything? The file is smaller and a lot of snps are deleted however there's a bit of leftover data from the 3 files I thought I removed.

I used the following code

bcftools query -l filename.vcf| grep "file1\|file2\|etc\|"> Fall22C.txt #(For what I wanted to keep)
bcftools view -S Fall22C.txt Fall22beetle.vcf > Fall22C.vcf #To make a new file

Error in R:

Error in `pop<-`(`*tmp*`, value = c("AL", "AL", "VA", "VA", "VA", "GA",  : 
      Vector length does no match number of individuals"
VCF R bcftools snpsaurus • 1.6k views
ADD COMMENT
0
Entering edit mode

When I opened the vcf in excel I noticed that there was still columns for what I removed from the file.

please, explain, show the data.

ADD REPLY
0
Entering edit mode

The last 3 columns are what I thhought I deleted

ADD REPLY
1
Entering edit mode

I noticed that there was still columns for what I removed from the file.

so, what should we see in your image ??

ADD REPLY
0
Entering edit mode

Y Z and AA ideally wont be there or come up in the vcf file if I removed them proper so I'm wondering what the issue is in the initial code.

ADD REPLY
0
Entering edit mode

are they present in Fall22C.txt ?

ADD REPLY
0
Entering edit mode

yes. They should be removed I imagine?

ADD REPLY
0
Entering edit mode

option -S in bcftools view is for the samples you want to KEEP.

ADD REPLY
0
Entering edit mode

I'm aware. I manually typed each one but those 3 when I submitted. I actually made that mistake the first time around and only kept the 3 I wanted to cut.

ADD REPLY
0
Entering edit mode

Got something to work after walking back through it and deleting them from that file manually so thanks!

ADD REPLY

Login before adding your answer.

Traffic: 2288 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6