Unconfigured Ad

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • bylemcsmith
    Junior Member
    • Jan 2014
    • 2

    Identify SNP intervals

    I was wondering what the best tool is to use if you have a set of SNPs and a list of intervals on chromosomes, how do you determine how many SNPs are in each interval? So far I have been writing my own code, which has been very inefficient. It takes days to run. I was wondering if there is a program that will do this?
  • rbagnall
    Member
    • Jun 2010
    • 34

    #2
    If you have the chromosome co-ordinates of your SNPs, you could use Bedtools.

    Save your list of SNPs in bed format as SNP.bed

    chr1 100 101 rs1
    chr1 105 106 rs2
    chr1 110 111 rs3
    chr1 5000 5001 rs_not_in_interval
    chr2 100 101 rs4
    chr2 105 106 rs5
    chr2 110 111 rs6
    chr2 120 121 rs7
    chr2 400 401 rs_not_in_interval


    Save your list of intervals in bed format as Intervals.bed

    chr1 99 120
    chr2 11 130

    Then use bedtools intersectBed:

    Code:
    intersectBed -a SNP.bed -b Intervals.bed -wb >SNPs.in.intervals.bed
    This will return all SNPs that are in the intervals, and show which interval they are in:

    chr1 100 101 rs1 chr1 99 120
    chr1 105 106 rs2 chr1 99 120
    chr1 110 111 rs3 chr1 99 120
    chr2 100 101 rs4 chr2 11 130
    chr2 105 106 rs5 chr2 11 130
    chr2 110 111 rs6 chr2 11 130
    chr2 120 121 rs7 chr2 11 130

    To go one further and count how many SNPs are in each interval:

    Code:
    intersectBed -a SNP.bed -b Interval.bed -wb | awk -F"\t" '{print$5" "$6" "$7}' | uniq -c
    3 chr1 99 120
    4 chr2 11 130

    First column gives counts of SNPs in each interval
    Last edited by rbagnall; 02-05-2014, 06:49 PM.

    Comment

    • crazyhottommy
      Senior Member
      • Apr 2012
      • 187

      #3
      that's what I usually do

      Originally posted by rbagnall View Post
      If you have the chromosome co-ordinates of your SNPs, you could use Bedtools.

      Save your list of SNPs in bed format as SNP.bed

      chr1 100 101 rs1
      chr1 105 106 rs2
      chr1 110 111 rs3
      chr1 5000 5001 rs_not_in_interval
      chr2 100 101 rs4
      chr2 105 106 rs5
      chr2 110 111 rs6
      chr2 120 121 rs7
      chr2 400 401 rs_not_in_interval


      Save your list of intervals in bed format as Intervals.bed

      chr1 99 120
      chr2 11 130

      Then use bedtools intersectBed:

      Code:
      intersectBed -a SNP.bed -b Intervals.bed -wb >SNPs.in.intervals.bed
      This will return all SNPs that are in the intervals, and show which interval they are in:

      chr1 100 101 rs1 chr1 99 120
      chr1 105 106 rs2 chr1 99 120
      chr1 110 111 rs3 chr1 99 120
      chr2 100 101 rs4 chr2 11 130
      chr2 105 106 rs5 chr2 11 130
      chr2 110 111 rs6 chr2 11 130
      chr2 120 121 rs7 chr2 11 130

      To go one further and count how many SNPs are in each interval:

      Code:
      intersectBed -a SNP.bed -b Interval.bed -wb | awk -F"\t" '{print$5" "$6" "$7}' | uniq -c
      3 chr1 99 120
      4 chr2 11 130

      First column gives counts of SNPs in each interval

      Comment

      • Jeremy
        Senior Member
        • Nov 2009
        • 190

        #4
        If you know any R then the GenomicRanges package does that using countOverlaps and or findOverlaps. You can then subset the SNPs based on the results.

        Comment

        Latest Articles

        Collapse

        • SEQadmin2
          Nine Things a Sample Prep Scientist Thinks About Before Sequencing
          by SEQadmin2


          I’m not a sequencing expert. I’m a purification scientist who uses NGS to evaluate workflows my group develops. With this perspective, we think about the sample first and the NGS workflow second. The sequencer is an exceptionally honest reporter, but it can only report on what you give it, so whether you get clean, interpretable data from an NGS workflow is largely determined before you begin.

          Here are nine questions we think about, in roughly the order they matter, before...
          06-18-2026, 07:11 AM
        • SEQadmin2
          From Collection to Sequencing: Why Sample Preparation and Preservation Define Sequencing Data
          by SEQadmin2


          Data variability is still an issue in sequencing technologies despite the advances in reproducibility and accuracy of these platforms. But the problem does not originate in the sequencing itself, but in the previous steps, before the sample reaches the sequencer.


          The first step is collection, followed by preservation and sample preparation for analysis. Most scientists overlook those steps, but not being careful might just be skewing the experiment’s results.
          ...
          06-02-2026, 10:05 AM

        ad_right_rmr

        Collapse

        News

        Collapse

        Topics Statistics Last Post
        Started by SEQadmin2, 06-26-2026, 11:10 AM
        0 responses
        12 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 06-17-2026, 06:09 AM
        0 responses
        47 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 06-09-2026, 11:58 AM
        0 responses
        106 views
        0 reactions
        Last Post SEQadmin2  
        Started by SEQadmin2, 06-05-2026, 10:09 AM
        0 responses
        125 views
        0 reactions
        Last Post SEQadmin2  
        Working...