Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sirplus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
BioCellGen-public
sirplus
Commits
61e9f119
Commit
61e9f119
authored
5 years ago
by
Christina Azodi
Browse files
Options
Downloads
Patches
Plain Diff
added random seed
parent
7378a1aa
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
R/eqtl-simulate.R
+11
-6
11 additions, 6 deletions
R/eqtl-simulate.R
with
11 additions
and
6 deletions
R/eqtl-simulate.R
+
11
−
6
View file @
61e9f119
...
...
@@ -58,6 +58,10 @@ eQTLSimulate <- function(params = newSplatParams(),
vcf
=
ex_snps
,
eqtl.save
=
TRUE
,
...
)
{
# Set random seed
seed
<-
getParam
(
params
,
"seed"
)
set.seed
(
seed
)
# Load and format gene (GFF/GTF) and SNP (genotype) data.
genes
<-
eQTLgenes
(
gff
)
snps
<-
eQTLsnps
(
vcf
,
eQTLparams
)
...
...
@@ -152,7 +156,7 @@ eQTLsnps <- function(vcf, eQTLparams){
snps
<-
subset
(
vcf
,
MAF
>
eqtl.maf
-
eqtl.mafd
&
MAF
<
eqtl.maf
+
eqtl.mafd
)
if
(
dim
(
snps
)[
1
]
<
getParam
(
eQTLparams
,
"eqtl.n"
)){
warning
(
"Not enough SNPs within desired MAF range.
Either i
ncrease the
stop
(
"Not enough SNPs within desired MAF range.
I
ncrease the
eqtl.mafd allowed, include more SNPs, or reduce eqtl.n."
)
}
...
...
@@ -192,8 +196,13 @@ eQTLpairs <- function(genes, snps, eQTLparams){
for
(
i
in
1
:
eqtl.n
){
again
<-
TRUE
while
(
again
==
TRUE
){
if
(
length
(
snps_list
)
==
0
)
{
stop
(
"Not enough SNPs within desired MAF range. Increase the
eqtl.mafd allowed, include more SNPs, or reduce eqtl.n."
)
}
s
<-
sample
(
snps_list
,
1
)
snps_list
<-
snps_list
[
!
snps_list
==
s
]
l
<-
snps
[
snps
$
eSNP
==
s
,
]
$
loc
matches
<-
subset
(
genes2
,
TSS
>
l
-
eqtl.dist
&
TSS
<
l
+
eqtl.dist
)
if
(
dim
(
matches
)[
1
]
>
0
){
...
...
@@ -208,11 +217,7 @@ eQTLpairs <- function(genes, snps, eQTLparams){
pairs
[
pairs
$
geneID
==
match
,
]
$
eSNP
<-
s
pairs
[
pairs
$
geneID
==
match
,
]
$
EffectSize
<-
ES
if
(
length
(
snps_list
)
==
0
)
{
warning
(
"Could not find n eSNPs within eqtl.dist of genes provided
in the GFF file. Either increase the eqtl.dist window or
include more SNPs."
)
}
}
return
(
pairs
)
...
...
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