Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
ngs_tools
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
bioinfo
ngs_tools
Commits
80e7bca7
Commit
80e7bca7
authored
10 years ago
by
Holger Brandl
Browse files
Options
Downloads
Patches
Plain Diff
better table export
parent
31b38a2d
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
dge_workflow/dge_analysis.R
+37
-47
37 additions, 47 deletions
dge_workflow/dge_analysis.R
with
37 additions
and
47 deletions
dge_workflow/dge_analysis.R
+
37
−
47
View file @
80e7bca7
#!/usr/bin/env Rscript
#+ setup, cache=FALSE
suppressMessages
(
require
(
docopt
))
...
...
@@ -14,9 +13,9 @@ Options:
-S Dont do general statistics and qc analysis
'
#opts <- docopt(doc, commandArgs(TRUE)) ## does not work when spining
#opts <- docopt(doc, "--undirected ..")
# opts <- docopt(doc, paste(Sys.getenv("DGE_PARAMS"), ".."))
opts
<-
docopt
(
doc
,
paste
(
Sys.getenv
(
"DGE_PARAMS"
),
paste
(
commandArgs
(
TRUE
),
collapse
=
" "
)))
#opts
...
...
@@ -61,7 +60,10 @@ cuff <- readCufflinks(dir=tmpdir)
cuff
runInfo
(
cuff
)
replicates
(
cuff
)
%>%
mutate
(
file
=
basename
(
file
))
%>%
select
(
-
c
(
total_mass
,
norm_mass
,
internal_scale
,
external_scale
))
replicateInfo
<-
replicates
(
cuff
)
%>%
mutate
(
file
=
basename
(
file
))
%>%
select
(
-
c
(
total_mass
,
norm_mass
,
internal_scale
,
external_scale
))
write.delim
(
replicateInfo
,
file
=
"replicateInfo.txt"
)
# replicateInfo <- read.delim("replicateInfo.txt")
#' [replicateInfo](replicateInfo.txt)
#+ eval=skipQC
#hello hidden field
...
...
@@ -89,56 +91,44 @@ if(!file.exists(cacheFile)){
#colnames(gFpkmMatrix) <- ifelse(is.na(sampleDic[colnames(gFpkmMatrix)]), colnames(gFpkmMatrix), sampleDic[colnames(gFpkmMatrix)])
fpkmMatrix
(
genes
(
cuff
))
%>%
rownames2column
(
"ensembl_gene_id"
)
%>%
merge
(
geneInfo
,
by.x
=
"ensembl_gene_id"
,
all.x
=
T
)
%>%
write.delim
(
file
=
"geneFpkmWithInfo.txt"
)
# geneFpkmWithInfo <- read.delim("geneFpkmWithInfo.txt")
#' [Annotated Expresssion Table](geneFpkmWithInfo.txt)
merge
(
geneInfo
,
by
=
"ensembl_gene_id"
,
all.x
=
T
)
%>%
print_head
()
%>%
write.delim
(
file
=
"gene_fpkm.txt"
)
# gene_fpkm <- read.delim("gene_fpkm.txt")
#' [Annotated Expresssion Table](gene_fpkm.txt)
## export the same but now including replicate information
repFpkmMatrix
(
genes
(
cuff
))
%>%
rownames2column
(
"ensembl_gene_id"
)
%>%
merge
(
geneInfo
,
by.x
=
"ensembl_gene_id"
,
all.x
=
T
)
%>%
write.delim
(
file
=
"geneReplicateFpkmWithInfo.txt"
)
# geneFpkmWithInfo <- read.delim("geneReplicateFpkmWithInfo.txt")
#' [Annotated Expresssion Table](geneReplicateFpkmWithInfo.txt)
#+ eval=FALSE, echo=FALSE
## DEBUG start
if
(
F
){
read.delim
(
"geneReplicateFpkmWithInfo.txt"
)
%>%
filter
(
external_gene_name
==
"Insm1"
)
%>%
melt
()
%>%
ggplot
(
aes
(
variable
,
value
))
+
geom_bar
(
stat
=
"identity"
)
}
## DEBUG end
geneFpkm
<-
fpkm
(
genes
(
cuff
))
#ggplot(geneFpkm, aes(fpkm)) + geom_histogram() + scale_x_log10()
write.delim
(
geneFpkm
,
file
=
"geneFpkm.txt"
)
# gene.fpkm <- read.delim("gene.fpkm.txt")
write.delim
(
repGeneFPKMs
,
file
=
"repGeneFPKMs.txt"
)
# repGeneFPKMs <- read.delim("repGeneFPKMs.txt")
# repGeneFPKMs <- local(get(load("repGeneFPKMs.RData")))
#' [FPKMs by Replicate](repGeneFPKMs.txt)
geneCounts
<-
count
(
genes
(
cuff
))
#max(geneCounts$count)
write.delim
(
geneCounts
,
file
=
"geneCounts.txt"
)
geneCgene.matrix
<-
fpkmMatrix
(
genes
(
cuff
))
#' [Raw Counts](geneCounts.txt)
merge
(
geneInfo
,
by
=
"ensembl_gene_id"
,
all.x
=
T
)
%>%
print_head
()
%>%
write.delim
(
file
=
"gene_fpkm_by_replicate.txt"
)
# gene_fpkm <- read.delim("gene_fpkm_by_replicate.txt")
#' [Annotated Expresssion Table](gene_fpkm_by_replicate.txt)
fpkm
(
genes
(
cuff
))
%>%
dplyr
::
rename
(
ensembl_gene_id
=
gene_id
)
%>%
merge
(
geneInfo
,
by
=
"ensembl_gene_id"
,
all.x
=
T
)
%>%
write.delim
(
file
=
"geneFpkm.txt"
)
count
(
genes
(
cuff
))
%>%
dplyr
::
rename
(
ensembl_gene_id
=
gene_id
)
%>%
merge
(
geneInfo
,
by
=
"ensembl_gene_id"
,
all.x
=
T
)
write.delim
(
file
=
"geneCounts.txt"
)
# geneCounts <- read.delim("geneCounts.txt")
#' [Gene Fragment Counts](geneCounts.txt)
countMatrix
(
genes
(
cuff
))
%>%
dplyr
::
rename
(
ensembl_gene_id
=
gene_id
)
%>%
merge
(
geneInfo
,
by
=
"ensembl_gene_id"
,
all.x
=
T
)
write.delim
(
file
=
"replicateCounts.txt"
)
# repCounts <- read.delim("replicateCounts.txt")
#' [Raw Counts by Replicate](replicateCounts.txt)
##ggplot(geneFpkm, aes(fpkm)) + geom_histogram() + scale_x_log10()
repCounts
<-
countMatrix
(
genes
(
cuff
))
write.delim
(
repCounts
,
file
=
"repCounts.txt"
)
# repCounts <- read.delim("repCounts.txt")
#' [Raw Counts by Replicate](repCounts.txt)
## tt
#######################################################################################################################
#' ## Score Distributions
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment