Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
BICF
Astrocyte
chipseq_analysis
Commits
b5c9ff2e
Commit
b5c9ff2e
authored
Aug 03, 2020
by
Spencer Barnes
Browse files
fix peak annotation r script
parent
27540804
Pipeline
#7784
passed with stages
in 1052 minutes and 56 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
workflow/scripts/annotate_peaks.R
View file @
b5c9ff2e
...
@@ -43,13 +43,14 @@ names(files) <- design$Condition
...
@@ -43,13 +43,14 @@ names(files) <- design$Condition
peaks
<-
lapply
(
files
,
readPeakFile
,
as
=
"GRanges"
,
header
=
FALSE
)
peaks
<-
lapply
(
files
,
readPeakFile
,
as
=
"GRanges"
,
header
=
FALSE
)
peakAnnoList
<-
lapply
(
peaks
,
annotatePeak
,
TxDb
=
txdb
,
tssRegion
=
c
(
-3000
,
3000
),
verbose
=
FALSE
)
peakAnnoList
<-
lapply
(
peaks
,
annotatePeak
,
TxDb
=
txdb
,
tssRegion
=
c
(
-3000
,
3000
),
verbose
=
FALSE
)
column_names
<-
c
(
"chr"
,
"start"
,
"end"
,
"width"
,
"strand_1"
,
"name"
,
"score"
,
"strand"
,
"signalValue"
,
column_names
<-
c
(
"
geneId"
,
"
chr"
,
"start"
,
"end"
,
"width"
,
"strand_1"
,
"name"
,
"score"
,
"strand"
,
"signalValue"
,
"pValue"
,
"qValue"
,
"peak"
,
"annotation"
,
"geneChr"
,
"geneStart"
,
"geneEnd"
,
"pValue"
,
"qValue"
,
"peak"
,
"annotation"
,
"geneChr"
,
"geneStart"
,
"geneEnd"
,
"geneLength"
,
"geneStrand"
,
"geneId"
,
"transcriptId"
,
"distanceToTSS"
,
"symbol"
)
"geneLength"
,
"geneStrand"
,
"transcriptId"
,
"distanceToTSS"
,
"symbol"
)
for
(
index
in
c
(
1
:
length
(
peakAnnoList
)))
{
for
(
index
in
c
(
1
:
length
(
peakAnnoList
)))
{
filename
<-
paste
(
names
(
peaks
)[
index
],
".chipseeker_annotation.tsv"
,
sep
=
""
)
filename
<-
paste
(
names
(
peaks
)[
index
],
".chipseeker_annotation.tsv"
,
sep
=
""
)
df
<-
as.data.frame
(
peakAnnoList
[[
index
]])
df
<-
as.data.frame
(
peakAnnoList
[[
index
]])
df
$
geneId
<-
sapply
(
strsplit
(
as.character
(
df
$
geneId
),
split
=
"\\."
),
"[["
,
1
)
df_final
<-
merge
(
df
,
sym
,
by.x
=
"geneId"
,
by.y
=
"ensembl"
,
all.x
=
T
)
df_final
<-
merge
(
df
,
sym
,
by.x
=
"geneId"
,
by.y
=
"ensembl"
,
all.x
=
T
)
colnames
(
df_final
)
<-
column_names
colnames
(
df_final
)
<-
column_names
write.table
(
df_final
[
,
!
(
names
(
df_final
)
%in%
c
(
'strand_1'
))],
filename
,
sep
=
"\t"
,
quote
=
F
,
row.names
=
F
)
write.table
(
df_final
[
,
!
(
names
(
df_final
)
%in%
c
(
'strand_1'
))],
filename
,
sep
=
"\t"
,
quote
=
F
,
row.names
=
F
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment