Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Safia Saci
rosePigs
Commits
c1557a82
Commit
c1557a82
authored
Jun 16, 2021
by
Safia Saci
Browse files
Upload New File
parent
516a97e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
pval__appetite_regulatory_hormones.R
0 → 100644
View file @
c1557a82
# setwd("/home/gdevailly/work/project/rosepigs/rosepigs")
library
(
data.table
)
library
(
rtracklayer
)
library
(
tximport
)
library
(
stringr
)
library
(
ggplot2
)
library
(
readr
)
library
(
dplyr
)
library
(
visNetwork
)
library
(
purrr
)
# load a gtf file
gtf
<-
import
(
con
=
"data/Sus_scrofa.Sscrofa11.1.102.gtf.gz"
,
format
=
"GFF"
)
# load a txi table
load
(
"data/txi.RData"
)
# csv file with appetite regulating hormones
reacto
<-
read_tsv
(
"data/Participating Molecules [R-HSA-400508].tsv"
)
genes
<-
gtf
[
gtf
$
type
==
"gene"
,
]
table
(
reacto
$
Name
%in%
genes
$
gene_name
)
genes
[
genes
$
gene_id
==
"genes"
,
]
nodes
<-
left_join
(
reacto
,
as.data.frame
(
mcols
(
genes
)[,
c
(
"gene_id"
,
"gene_name"
)]),
by
=
c
(
"Name"
=
"gene_name"
))
nodes_m_fas
<-
txi
$
abundance
[
rownames
(
txi
$
abundance
)
%in%
nodes
$
gene_id
,
metadata
$
line
==
"G11-"
&
metadata
$
condition
==
"fasted"
]
nodes_m_fed
<-
txi
$
abundance
[
rownames
(
txi
$
abundance
)
%in%
nodes
$
gene_id
,
metadata
$
line
==
"G11-"
&
metadata
$
condition
==
"fed"
]
nodes_p_fas
<-
txi
$
abundance
[
rownames
(
txi
$
abundance
)
%in%
nodes
$
gene_id
,
metadata
$
line
==
"G11+"
&
metadata
$
condition
==
"fasted"
]
nodes_p_fed
<-
txi
$
abundance
[
rownames
(
txi
$
abundance
)
%in%
nodes
$
gene_id
,
metadata
$
line
==
"G11+"
&
metadata
$
condition
==
"fed"
]
# applicate student test for G11-
nodes_m
<-
cbind
(
nodes
,
map_dfr
(
nodes
$
gene_id
,
function
(
x
)
{
if
(
is.na
(
x
))
return
(
tibble
(
log2fc
=
NA
,
pval
=
NA
))
tibble
(
log2fc
=
log2
(
median
(
nodes_m_fed
[
x
,
],
na.rm
=
TRUE
)
/
median
(
nodes_m_fas
[
x
,
],
na.rm
=
TRUE
)),
pval
=
t.test
(
nodes_m_fed
[
x
,
],
nodes_m_fas
[
x
,
])
$
p.value
)
})
)
# applicate student test for G11+
nodes_p
<-
cbind
(
nodes
,
map_dfr
(
nodes
$
gene_id
,
function
(
x
)
{
if
(
is.na
(
x
))
return
(
tibble
(
log2fc
=
NA
,
pval
=
NA
))
tibble
(
log2fc
=
log2
(
median
(
nodes_p_fed
[
x
,
],
na.rm
=
TRUE
)
/
median
(
nodes_p_fas
[
x
,
],
na.rm
=
TRUE
)),
pval
=
t.test
(
nodes_p_fed
[
x
,
],
nodes_p_fas
[
x
,
])
$
p.value
)
})
)
# adjust the pvalues with with FDR method
nodes_m
$
adjpval
<-
p.adjust
(
nodes_m
$
pval
,
method
=
"fdr"
)
nodes_p
$
adjpval
<-
p.adjust
(
nodes_p
$
pval
,
method
=
"fdr"
)
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