This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Biostrings) | |
bs <- BString("This is a normal string") # BString انشاء كائن | |
ds <- DNAString("GCAAAGT-TT-C") # DNAString انشاء كائن | |
rs <- RNAString("GCAAAGU-UU-C") # RNAString انشاء كائن | |
rs2 <- RNAString(ds) # RNAString إلى DNAString تحويل | |
aas <- AAString(ds) # AAString انشاء كائن |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ds <- DNAString("GCAAAGT-TT-C") | |
length(ds) | |
# [1] 12 | |
ds[1:3] | |
# 3-letter "DNAString" instance | |
#seq: GCA | |
ds[3:1] | |
# 3-letter "DNAString" instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DNAs <- c("ACCT-NACG", "ACGTTCGA","TCACCGAGACTTACGAC") | |
dnaSet <- DNAStringSet(DNAs) | |
dnaSet | |
# A DNAStringSet instance of length 3 | |
# width seq | |
#[1] 9 ACCT-NACG | |
#[2] 8 ACGTTCGA | |
#[3] 17 TCACCGAGACTTACGAC | |
#يمكن القيام بعمليات على مجموعة من السلاسل مع بعض |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(Biostrings) | |
library(BSgenome.Hsapiens.UCSC.hg19) | |
#نأخذ الكروموزوم 1 كمثال | |
Hsapiens$chr1 | |
# 249250621-letter "DNAString" instance | |
#seq: NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN...NNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNNN | |
# لنفرض أننا مهتمين بسلسلة الجينات ABCA4, ACADM و GBA | |
genes <- Views(Hsapiens$chr1, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# نقوم بتحميل مواقع جزر السي بي جي لكامل الجينوم | |
dataURL <-"http://bios221.stanford.edu/data/model-based-cpg-islands-hg19.txt" | |
cpglocs=read.table(dataURL ,header=T) | |
# نختار فقظ الكروموزم رقم 8 | |
cpglocs8=cpglocs[which(cpglocs[,1]=="chr8"),2:3] | |
# الجدول يحتوي على أماكن بداية ونهاية كل جزيرة | |
head(cpglocs8) | |
# start end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library(IRanges) | |
# يمكن انشاء مجموعة مجالات بتحديد نقطة البداية والنهاية | |
range1 <- IRanges(start=c(10,50,300),end =c(30,90,456)) | |
range1 | |
#IRanges of length 3 | |
# start end width | |
#[1] 10 30 21 | |
#[2] 50 90 41 | |
#[3] 300 456 157 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
range1 <- IRanges(start=c(10,50,300),end =c(60,90,456)) | |
range1 | |
#IRanges of length 3 | |
# start end width | |
#[1] 10 60 51 | |
#[2] 50 90 41 | |
#[3] 300 456 157 | |
reduce(range1) | |
#IRanges of length 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ننشئ شعاع يحتوي على أرقام من 1 إلى 10 بطول 40 | |
x<- sort(sample(1:10,40,replace=T)) | |
head(x) | |
#[1] 1 1 1 1 1 1 | |
# Rle لحفضه | |
x <- Rle(x) | |
x | |
#integer-Rle of length 40 with 10 runs | |
# Lengths: 6 2 1 3 4 5 6 9 2 2 | |
# Values : 1 2 3 4 5 6 7 8 9 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# بعدة طرق GRanges يمكن انشاء | |
# مثلا يمكننا تحديد فقط المجالات الجينومية | |
gr <- GRanges(seqnames = c("chr1","chr1","chr2","chrX"), | |
ranges = IRanges(start = c(130,30050,4509,69098), | |
width= c(250,1300,400,590)), | |
strand = c("+","+","-","*")) | |
gr | |
#GRanges object with 4 ranges and 0 metadata columns: | |
# seqnames ranges strand | |
# <Rle> <IRanges> <Rle> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gr[1:2] | |
#GRanges object with 2 ranges and 1 metadata column: | |
# seqnames ranges strand | score | |
# <Rle> <IRanges> <Rle> | <numeric> | |
# [1] chr1 [ 130, 379] + | 0.0297835641540587 | |
# [2] chr1 [30050, 31349] + | 0.42395940516144 | |
# ------- | |
# seqinfo: 3 sequences from an unspecified genome; no seqlengths | |
start(gr) |
OlderNewer