Coder Social home page Coder Social logo

checkoverlap's Introduction

CheckOverlap

INSTALL

library(devtools)
install_github("Yiguan/CheckOverlap")

================================================

1. CheckPoint(pos, start, end)

Check if points in segments

Description:

 To check if a number in a range.  Return a vector of 0,1 if the
 the number in a range(1) or not (0).

Usage:

 CheckPoint(pos, start, end)

Arguments:

 pos: a vector of numbers of points
 start: a vector of numbers of starting position
 end: a vector of numbers of ending position

Examples:

 aa <- c(2,4,6)
 bb1 <- c(1,5,7)
 bb2 <- c(3,8,10)
 #too see if 2,4,6 in range 1-3,5-8,7-10
 CheckPoint(aa,bb1,bb2)

===================================================

2. CheckRange(pos, start, end)

Check if segments contain point

Description:

 To check if a range contains points.  Return a vector of 0,1 with
 1 = contain points, 0 = not contain points.

Usage:

 CheckRange(pos, start, end)

Arguments:

 pos: a vector of numbers of points
 start: a vector of numbers of starting position
 end: a vector of numbers of ending position

Examples:

 aa <- c(2,4,6)
 bb1 <- c(1,5,7)
 bb2 <- c(3,8,10)
 # to see if range 1-3,5-8, 7-8 contain 2,4,6
 CheckRange(aa,bb1,bb2)

=====================================================

3. CheckMatch(pos, start, end, matchALL='T')

Check if segments contain point

Description:

 To map points into segmentation and return a dataframe with "point_position" and "seg_row" indicating the points fall into which segmentation.

Usage:

 CheckPoint(pos, start, end)

Arguments:

 pos: a vector of numbers of points
 start: a vector of numbers of starting position
 end: a vector of numbers of ending positioni
 matchAll: logical "T" or "F", default = "T"

Examples:

 aa <- c(3,9,21,11)
 bb1 <- c(1,8,16)
 bb2 <- c(10,15,18)
 # find all possible match
 CheckMatch(aa,bb1,bb2)
 ##   point_position seg_row
 # 1              1       1
 # 2              2       1
 # 3              2       2
 # 4              4       2
 ## 1st point within 1st segment; 2nd points within 1st and 2nd segment;
 ## 4th point in 2nd segment.

 # find the first match line and break
 CheckMatch(aa,bb1,bb2,matchAll='F')
 ##   point_position seg_row
 # 1              1       1
 # 2              2       1
 # 3              4       2
 ## 1st point FIRST match in 1st segment; 2nd point FIRST match 1st segment
 ## 4th point FIRST match in 2nd segment.

======================================================

4. CheckRange2Range(aa_start,aa_end,bb_start,bb_end)

check segments overlap with other segments

Description:

To check if a segments overlap with other segments.

Usage:

CheckRange2Range(aa_start,aa_end,bb_start,bb_end)

Arguments:

aa_start: a vector of numbers of starting positions of checked segments
aa_end: a vector of numbers of ending position of checked segments
bb_start: a vector of numbers of starting position of other segments
bb_end: a vector of numbers of ending position of other segments

Examples:

aa_start <- c(2,6,11)
aa_end <- c(4,9,15)
bb_start <- c(1,5,7)
bb_end <- c(3,8,10)
# to see if segments 2-4,6-9,11-15 overlap with 1-3,5-8,7-10
CheckRange2Range(aa_start,aa_end,bb_start,bb_end)

checkoverlap's People

Contributors

yiguan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.