시퀀스 범위

R로 시작하는 Bioconductor

Paula Andrea Martinez, PhD.

Data scientist

숫자 인수를 사용한 IRanges

# Loading IRanges
library(IRanges)

범위는 startend로 정의됩니다.

myIRanges <- IRanges(start = 20, end = 30)
myIRanges
IRanges object with 1 range and 0 metadata columns:
   start       end     width
<integer> <integer> <integer>
[1]   20        30        11
R로 시작하는 Bioconductor
(myIRanges_width <- IRanges(start = c(1, 20), width = c(30, 11)))
 IRanges object with 2 ranges and 0 metadata columns:
         start       end     width    
      <integer> <integer> <integer>
[1]         1        30        30       
[2]        20        30        11
(myIRanges_end <- IRanges(start = c(1, 20), end = 30))
 IRanges object with 2 ranges and 0 metadata columns:
         start       end     width    
      <integer> <integer> <integer>
[1]         1        30        30       
[2]        20        30        11

공식: width = end - start + 1

R로 시작하는 Bioconductor

Rle - 런 길이 인코딩

  • Rle는 런 길이 인코딩(Run length encoding)을 의미합니다.
  • 벡터 또는 팩터의 길이을 계산하고 저장합니다.
  • Rle는 긴 반복 벡터를 효율적으로 저장하는 범용 S4 컨테이너입니다.
(some_numbers <- c(3, 2, 2, 2, 3, 3, 4, 2))
3 2 2 2 3 3 4 2
(Rle(some_numbers))
numeric-Rle of length 8 with 5 runs
Lengths: 1 3 2 1 1
Values : 3 2 3 4 2
R로 시작하는 Bioconductor

논리 벡터를 사용한 IRanges

IRanges(start = c(FALSE, FALSE, TRUE, TRUE))
 IRanges object with 1 range and 0 metadata columns:
      start       end     width
  <integer> <integer> <integer>
[1]       3         4         2
R로 시작하는 Bioconductor

논리 Rle를 사용한 IRanges

gi <- c(TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, TRUE)
myRle <- Rle(gi)
logical-Rle of length 7 with 3 runs
Lengths:     2     2     3
Values :  TRUE FALSE  TRUE
IRanges(start = myRle)
IRanges object with 2 ranges and 0 metadata columns:
         start       end     width
      <integer> <integer> <integer>
[1]         1         2         2
[2]         5         7         3
R로 시작하는 Bioconductor

요약

IRanges는 메타데이터를 포함할 수 있는 계층적 데이터 구조입니다.

IRanges 객체 생성 방법:

  • start, end, 또는 width를 숫자 벡터(또는 NULL)로 지정.
  • start 인수에 논리 벡터 또는 논리 Rle 객체 사용.
    • Rle는 런 길이 인코딩(Run length encoding)으로 저장 효율적입니다.
    • IRanges 인수는 재활용됩니다(빈 값 채움).
    • 시퀀스 범위 공식: width = end - start + 1.
R로 시작하는 Bioconductor

시퀀스 범위를 연습해 봅시다!

R로 시작하는 Bioconductor

Preparing Video For Download...