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
            Current Approaches to Protein Sequencing
            by seqadmin


            Proteins are often described as the workhorses of the cell, and identifying their sequences is key to understanding their role in biological processes and disease. Currently, the most common technique used to determine protein sequences is mass spectrometry. While still a valuable tool, mass spectrometry faces several limitations and requires a highly experienced scientist familiar with the equipment to operate it. Additionally, other proteomic methods, like affinity assays, are constrained...
            04-04-2024, 04:25 PM
          • seqadmin
            Strategies for Sequencing Challenging Samples
            by seqadmin


            Despite advancements in sequencing platforms and related sample preparation technologies, certain sample types continue to present significant challenges that can compromise sequencing results. Pedro Echave, Senior Manager of the Global Business Segment at Revvity, explained that the success of a sequencing experiment ultimately depends on the amount and integrity of the nucleic acid template (RNA or DNA) obtained from a sample. “The better the quality of the nucleic acid isolated...
            03-22-2024, 06:39 AM

          ad_right_rmr

          Collapse

          News

          Collapse

          Topics Statistics Last Post
          Started by seqadmin, 04-11-2024, 12:08 PM
          0 responses
          18 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 10:19 PM
          0 responses
          22 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-10-2024, 09:21 AM
          0 responses
          16 views
          0 likes
          Last Post seqadmin  
          Started by seqadmin, 04-04-2024, 09:00 AM
          0 responses
          46 views
          0 likes
          Last Post seqadmin  
          Working...
          X