Seqanswers Leaderboard Ad

Collapse

Announcement

Collapse
No announcement yet.
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Converter for vcf to bed format

    Hi all,

    Is there any converter that can convert vcf format files obtained by samtools vcfutils.pl to bed format?

    Because i want predict the variant effect using varian_effect_predictor of ensemble.

    ##fileformat=VCFv4.0
    #CHROM POS ID REF ALT QUAL FILTER INFO FORMAT GKUNU9Q04_chr1_sort.bam
    chr1 46707 . A G 7.59 . DP=2;AF1=1;CI95=0.5,1;DP4=0,0,0,2;MQ=60 PL:GT:GQ 38,6,0:1/1:49
    chr1 168576 . C T 4.61 . DP=2;AF1=1;CI95=0.5,1;DP4=0,0,0,2;MQ=60 PL:GT:GQ 34,6,0:1/1:49
    chr1 168635 . G A 17.1 . DP=3;AF1=1;CI95=0.5,1;DP4=0,0,0,3;MQ=60 PL:GT:GQ 49,9,0:1/1:63

    To

    1 46707 46707 A/G +
    1 168576 168576 C/T +
    1 168635 168635 G/A +

  • #2
    The awesome power of awk and sed.

    Code:
    sed -e 's/chr//' file.vcf | awk '{OFS="\t"; if (!/^#/){print $1,$2-1,$2,$4"/"$5,"+"}}'
    where you replace "file.vcf" with your file. Note this uses 0-based start coordinates, which are the proper BED format. If you want to use 1-based, change "$2-1" to just "$2".

    Comment


    • #3
      Originally posted by quinlana View Post
      The awesome power of awk and sed.

      Code:
      sed -e 's/chr//' file.vcf | awk '{OFS="\t"; if (!/^#/){print $1,$2-1,$2,$4"/"$5,"+"}}'
      where you replace "file.vcf" with your file. Note this uses 0-based start coordinates, which are the proper BED format. If you want to use 1-based, change "$2-1" to just "$2".
      Thanks for reply,

      if suppose i want to put "-" reverse strand instead of "+", how can i put that using vcf file?

      1 46707 46707 A/G +
      1 168576 168576 C/T +
      1 168635 168635 G/A +
      1 195648 195648 T/G -

      Comment


      • #4
        GFF to BED

        How to convert a GFF file intO BED format file?.

        Comment


        • #5
          Maybe this will be useful?

          Comment

          Latest Articles

          Collapse

          • seqadmin
            Recent Developments in Metagenomics
            by seqadmin





            Metagenomics has improved the way researchers study microorganisms across diverse environments. Historically, studying microorganisms relied on culturing them in the lab, a method that limits the investigation of many species since most are unculturable1. Metagenomics overcomes these issues by allowing the study of microorganisms regardless of their ability to be cultured or the environments they inhabit. Over time, the field has evolved, especially with the advent...
            09-23-2024, 06:35 AM
          • seqadmin
            Understanding Genetic Influence on Infectious Disease
            by seqadmin




            During the COVID-19 pandemic, scientists observed that while some individuals experienced severe illness when infected with SARS-CoV-2, others were barely affected. These disparities left researchers and clinicians wondering what causes the wide variations in response to viral infections and what role genetics plays.

            Jean-Laurent Casanova, M.D., Ph.D., Professor at Rockefeller University, is a leading expert in this crossover between genetics and infectious...
            09-09-2024, 10:59 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 10-02-2024, 04:51 AM
          0 responses
          10 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 10-01-2024, 07:10 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-30-2024, 08:33 AM
          0 responses
          20 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-26-2024, 12:57 PM
          0 responses
          17 views
          0 likes
          Last Post seqadmin  
          Working...
          X