Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • dietmar13
    Senior Member
    • Mar 2010
    • 107

    intersect (actually: filter) a gtf file with coordinates from a bed-file

    -- SOLVED -- bedtools intersect

    hello,

    does someone know a script which filters a gtf-file with coordinates from a bed file.

    i have a bed-file with regions and want filter out all features from a gtf file which overlap (completely or largely) with this regions. is there a script or program? bedtools intersect does not work?

    i know, an awk-script would not be very difficult, but why re-invent the wheel...

    thank you,

    dietmar
    Last edited by dietmar13; 04-25-2013, 09:37 PM.
  • kmcarr
    Senior Member
    • May 2008
    • 1181

    #2
    Originally posted by dietmar13 View Post
    bedtools intersect does not work?
    Why do you say this? Seems like bedtools intersect with the '-v' option is exactly what you are looking for.

    Comment

    • dietmar13
      Senior Member
      • Mar 2010
      • 107

      #3
      @kmcarr

      thank you - you are right. i was misled by all the examples where only bed and bam files were used for bedtools intersect examples...

      dietmar

      Comment

      • vishal.rossi
        Member
        • Apr 2013
        • 25

        #4
        Hi,

        I am comparing 2 different files. 1st file has 113 entries and the 2nd one has 88 entries.
        I use the following command to get the differences
        intersectBed -v -a 1.bed -b 2.bed or
        intersectBed -v -wa -wb -a 1.bed -b 2.bed

        But it shows that only 3 entries don't match in both the cases which is false.
        Does anyone has the idea why?

        Thanks

        Comment

        • syfo
          Just a member
          • Nov 2012
          • 103

          #5
          Originally posted by vishal.rossi View Post
          I am comparing 2 different files. [...] I use the following command to get the differences [...] only 3 entries don't match
          What are you looking for exactly?
          IntersectBed with the "-v" parameter will show you the intervals from "1.bed" that have nothing in common with the ones in "2.bed". Entries from "2.bed" are not supposed to be reported.
          Also, one common nucleotide is enough by default to define an overlap between two intervals. For a more stringent criteria you might want to consider "-f" and "-r".

          Comment

          • AlexReynolds
            Member
            • Feb 2013
            • 45

            #6
            Another option is BEDOPS bedops, which does set operations on BED data, and BEDOPS gtf2bed, which does a lossless conversion of GTF data into BED format, which can be used with BEDOPS tools.

            Let's assume that your regions-of-interest are in a file called myRegions.bed and your GTF-formatted annotations are in a file called myAnnotations.gtf.

            First, we sort myRegions.bed:

            $ sort-bed myRegions.bed > mySortedRegions.bed

            Next, we convert the annotations to BED format:

            $ gtf2bed < myAnnotations.gtf > myAnnotations.bed

            Finally, we apply a --not-element-of set operation to show elements of the annotations file which do not overlap mySortedRegions.bed, if there is one or more bases of overlap (i.e., any overlap at all):

            $ bedops --not-element-of -1 myAnnotations.bed mySortedRegions.bed > myAnswer.bed

            As the gtf2bed conversion step was lossless, it is easy to convert myAnswer.bed back to GTF:

            $ awk '{print $1"\t"$7"\t"$8"\t"($2+1)"\t"$3"\t"$5"\t"$6"\t"$9"\t"(substr($0, index($0,$10)))}' myAnswer.bed > myAnswer.gtf
            Last edited by AlexReynolds; 05-21-2013, 12:05 PM.

            Comment

            • eieneg
              Junior Member
              • Feb 2017
              • 5

              #7
              To intersect coordinates

              Just use GFF-Intersector

              An R program capable of intersecting .GFF files and large files containg genomic co-ordinates and visualising the genome wide data. - PriceJon/GFF_Intersector


              it can intersect GFF files with multiple other coordinates!! have you got R? if so just 2 commands and you don't have to worry about the visualisation issue

              Comment

              Latest Articles

              Collapse

              • SEQadmin2
                Advanced Sequencing Platforms Tackle Neuroscience’s Toughest Genomics Problems
                by SEQadmin2



                Genomics studies in neuroscience face a special challenge due to the brain’s complexity and scarcity of samples. Mapping changes in cell type and state using conventional next-generation sequencing methods remains challenging. Advances in technologies like single-cell sequencing, spatial transcriptomics, and long-read sequencing have opened the door to deeper studies of the brain and diseases like Alzheimer’s, amyotrophic lateral sclerosis (ALS), and schizophrenia.
                ...
                07-09-2026, 11:10 AM
              • SEQadmin2
                Cancer Drug Resistance: The Lingering Barrier to Rising Survival
                by SEQadmin2



                Cancer survival rates have significantly increased in the last few decades in the United States, reaching a combined 70% 5-year survival rate by 2021. Behind this number, there are years of research to find new therapies, drug targets, and early detection methods. But there is one core challenge that keeps slowing down these advances, and it’s about drug resistance.

                There is no single reason why many patients don’t respond to treatment as expected. Cancer is...
                07-08-2026, 05:17 AM
              • GATTACAT
                Reply to Nine Things a Sample Prep Scientist Thinks About Before Sequencing
                by GATTACAT
                Love this - good data definitely starts from good input, and poor input can only give relatively poor data. I particularly like the mention of Nanodrop/absorbance based methods for quantification. It's such a toss up if you'll get an accurate reading or what amounts to a randomly generated number, and a lot of library/sequencing related issues can be traced back to poor quant.
                07-01-2026, 11:43 AM

              ad_right_rmr

              Collapse

              News

              Collapse

              Topics Statistics Last Post
              Started by SEQadmin2, 07-13-2026, 10:26 AM
              0 responses
              15 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-09-2026, 10:04 AM
              0 responses
              29 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-08-2026, 10:08 AM
              0 responses
              16 views
              0 reactions
              Last Post SEQadmin2  
              Started by SEQadmin2, 07-07-2026, 11:05 AM
              0 responses
              33 views
              0 reactions
              Last Post SEQadmin2  
              Working...