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
            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
          • seqadmin
            Addressing Off-Target Effects in CRISPR Technologies
            by seqadmin






            The first FDA-approved CRISPR-based therapy marked the transition of therapeutic gene editing from a dream to reality1. CRISPR technologies have streamlined gene editing, and CRISPR screens have become an important approach for identifying genes involved in disease processes2. This technique introduces targeted mutations across numerous genes, enabling large-scale identification of gene functions, interactions, and pathways3. Identifying the full range...
            08-27-2024, 04:44 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, Yesterday, 02:44 PM
          0 responses
          8 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-06-2024, 08:02 AM
          0 responses
          143 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 09-03-2024, 08:30 AM
          0 responses
          151 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 08-27-2024, 04:40 AM
          0 responses
          158 views
          0 likes
          Last Post seqadmin  
          Working...
          X