uploding VCF file to CADD and Ensemb
1
0
Entering edit mode
22 months ago
Eliza ▴ 40

Hi, I have a CSV file that contains the columns: CHROM, POS,REF, and ALT enter image description here

I want to convert this CSV file to a VCF file to upload to CADD:https://cadd.gs.washington.edu/score and,Ensembl https://www.ensembl.org/Tools/VEP to get SNP annotations. this is my code in python spyder to convert :

import csv
import gzip
# Open the CSV file
with open('C:/Users/agns1/Downloads/genetics/data/df_vcf.csv', 'r') as csvfile:
    reader = csv.reader(csvfile)
    # Skip the header row
    next(reader)
    # Open the VCF file for writing
    with open('data.vcf', 'w') as vcffile:
        # Write the VCF file header
        vcffile.write('##fileformat=VCFv4.2\n')
        vcffile.write('#CHROM\tPOS\tREF\tALT\n')
        # Iterate through the CSV rows
        for row in reader:
            # Write the VCF data
            vcffile.write(row[0] + '\t' + row[1] + '\t'  + row[2] + '\t' + row[3]  + '\n')

the file that i get looks like this and has name data.vcf : enter image description here

BUT Ensembl and CADD "say" the the format of the file is not correct, and i dont understand why since it is a VCF file (or how to fix this problem ) thank you:)

CADD vcf Ensembl SNP • 1.2k views
ADD COMMENT
0
Entering edit mode
22 months ago

You have

#CHROM POS REF ALT

while a vcf MUST HAVE

#CHROM  POS ID  REF ALT QUAL    FILTER  INFO

you can use '.' for the missing fields.

ADD COMMENT
0
Entering edit mode

can i add this column and they would be just empty? in the CADD websote it says :"It is sufficient to provide the first 5 columns of a VCF file without header, as all other information than CHROM, POS, REF, ALT will be ignored anyway. "

ADD REPLY
0
Entering edit mode

It is sufficient to provide the first 5

so ID is missing....

ADD REPLY
0
Entering edit mode

got this error from ensmble when I loaded the corrected file:"exiting the program. The input file appears to be unsorted. Please sort by chromosome and by location and re-submit." should I order the data by ascending Chrom and inside the chrom by acs POS

ADD REPLY
0
Entering edit mode

Hi Eliza - yes, that is correct.

ADD REPLY

Login before adding your answer.

Traffic: 2045 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