Skip to content

Instantly share code, notes, and snippets.

# rtracklayer يمكن استعمال الدوال الجاهزة في حزمة
encodePilotRegions <- import.bed("encodePilotRegion.bed")
encodePilotRegions
#GRanges object with 44 ranges and 1 metadata column:
# seqnames ranges strand | name
# <Rle> <IRanges> <Rle> | <character>
# [1] chr1 [151158061, 151658060] * | ENr231
# [2] chr2 [ 51658705, 52158704] * | ENr112
# [3] chr2 [118294574, 118794573] * | ENr121
# [4] chr2 [220277346, 220777345] * | ENr331
require(pasillaBamSubset)
require(GenomicAlignments)
# BAM نقراء الملف
bamFile <- untreated1_chr4()
gReads <- readGAlignmentsFromBam(bamFile)
#GAlignments object with 204355 alignments and 0 metadata columns:
# seqnames strand cigar qwidth start end width njunc
# <Rle> <Rle> <character> <integer> <integer> <integer> <integer> <integer>
# [1] chr4 - 75M 75 892 966 75 0
# [2] chr4 - 75M 75 919 993 75 0
require(pasillaBamSubset)
require(Rsamtools)
bamFile <- untreated1_chr4()
region <- GRanges("chr4",IRanges(100000L, 110000L))
param <- ScanBamParam(which=region, what=scanBamWhat())
mappedReads <- scanBam(bamFile, param=param)
require(RNAseqData.HNRNPC.bam.chr14)
require(pasillaBamSubset)
require(Rsamtools)
bamFile <- untreated1_chr4()
# نلاحظ أن المجموعة اس هي المتواجدة هنا مما يدل على ان السلاسل احادية النهاية
quickBamFlagSummary(bamFile, main.groups.only = TRUE)
# group | nb of | nb of | mean / max
# of | records | unique | records per
# records | in group | QNAMEs | unique QNAME
@sirusb
sirusb / gist:4761150
Last active December 12, 2015 10:39
These R code snippets are used to convert between Entrez and Ensembl IDs using biomart web-service. it just exploits the functionalities offered by the biomaRt package. The code is implemented to call the Biomart web-service each time. you can make it more general by calling the first four lines separatly and just passing the "hsp" variable to f…
#Usage example:
#EntrezID<-c("2114","9757","5886","9373","6921","4088","7006","6196","10054","10945")
#EnsemblID<-EntrezToEnsembl(EntrezID)
EntrezToEnsembl<-function(EntrezID){
require(biomaRt);
ensemble<-useMart("ensembl");
hsp<-useDataset(mart=ensemble,dataset="hsapiens_gene_ensembl");
ids<-getBM(filters= "entrezgene",
attributes= c("entrezgene","ensembl_gene_id", "external_gene_id","description"),
@sirusb
sirusb / gist:81f3f180b08a16a8ac2f
Last active December 26, 2015 02:39
This script is to read a CSV file that contain a list of genes in HGNC format in each column and will plot the GO enrichment analysis using DAVID webservice.
DoDAVIDGOAnnotation <-function(topics,pval=0.05,GOlimit=5){
clusters<-1:ncol(topics)
Groups<-c();
Annot<-c();
pvalue<-c();
counts<-c();
for(clus in clusters){
#Get the genes in that cluster