Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mmassaviol
WAWmassaviol
Commits
afbe02ba
Commit
afbe02ba
authored
Oct 11, 2021
by
khalid
Browse files
Rename params for RadSex tools
parent
22ae3904
Changes
9
Hide whitespace changes
Inline
Side-by-side
tools/deseq2/deseq2.script.R
View file @
afbe02ba
...
...
@@ -8,17 +8,20 @@ library(GenomicFeatures)
library
(
ggplot2
)
samples
=
read.table
(
snakemake
@
config
[[
"popmap_file"
]],
stringsAsFactors
=
F
)
$
V1
conditions
=
read.table
(
snakemake
@
config
[[
"popmap_file"
]],
stringsAsFactors
=
F
)
$
V2
popmapData
=
read.table
(
snakemake
@
config
[[
"popmap_file"
]],
stringsAsFactors
=
F
)
colnames
(
popmapData
)
=
c
(
"samples"
,
"condition"
)
samples
=
popmapData
$
samples
conditions
=
popmapData
$
condition
#samples = c("DRR016125","DRR016126","DRR016127","DRR016128","DRR016129","DRR016130","DRR016131","DRR016132")
#files = file.path("/home/mbb/Documents/results2/kallisto/quant",samples,"abundance.h5")
files
=
sort
(
snakemake
@
input
[[
"counts"
]])
names
(
files
)
=
samples
if
(
snakemake
@
config
[[
"quantification"
]]
==
"htseq_count"
)
if
(
"quantification"
%in%
names
(
snakemake
@
config
)
)
{
if
(
snakemake
@
config
[[
"quantification"
]]
==
"htseq_count"
)
{
print
(
"Quantification was done with htseq-count !"
)
files
=
sort
(
snakemake
@
input
[[
"counts"
]])
names
(
files
)
=
samples
sampleTable
<-
data.frame
(
sampleName
=
samples
,
fileName
=
files
,
...
...
@@ -30,28 +33,36 @@ if (snakemake@config[["quantification"]] == "htseq_count")
directory
=
""
,
design
=
~
condition
)
}
else
{
# counts where generated with one of these software "salmon", "sailfish", "alevin", "kallisto", "rsem", "stringtie"
if
(
snakemake
@
params
[[
"tx2gene"
]]
==
TRUE
){
# conversion transcrits vers gènes
TxDb
<-
makeTxDbFromGFF
(
file
=
snakemake
@
params
[[
"annotations"
]])
k
<-
keys
(
TxDb
,
keytype
=
"TXNAME"
)
tx2gene
<-
select
(
TxDb
,
k
,
"GENEID"
,
"TXNAME"
)
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
tx2gene
=
tx2gene
)
}
else
{
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
txOut
=
TRUE
)
}
groups
=
as.factor
(
conditions
)
designMat
<-
model.matrix
(
~
groups
)
colnames
(
designMat
)[
2
]
=
"condition"
sampleTable
<-
data.frame
(
condition
=
factor
(
conditions
))
rownames
(
sampleTable
)
<-
colnames
(
txi
$
counts
)
dds
<-
DESeqDataSetFromTximport
(
txi
,
sampleTable
,
designMat
)
}
else
{
# counts where generated with one of these software "salmon", "sailfish", "alevin", "kallisto", "rsem", "stringtie"
if
(
snakemake
@
params
[[
"tx2gene"
]]
==
TRUE
){
# conversion transcrits vers gènes
TxDb
<-
makeTxDbFromGFF
(
file
=
snakemake
@
params
[[
"annotations"
]])
k
<-
keys
(
TxDb
,
keytype
=
"TXNAME"
)
tx2gene
<-
select
(
TxDb
,
k
,
"GENEID"
,
"TXNAME"
)
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
tx2gene
=
tx2gene
)
}
else
{
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
txOut
=
TRUE
)
}
groups
=
as.factor
(
conditions
)
designMat
<-
model.matrix
(
~
groups
)
colnames
(
designMat
)[
2
]
=
"condition"
sampleTable
<-
data.frame
(
condition
=
factor
(
conditions
))
rownames
(
sampleTable
)
<-
colnames
(
txi
$
counts
)
dds
<-
DESeqDataSetFromTximport
(
txi
,
sampleTable
,
designMat
)
}
}
else
{
if
(
"tsv_file"
%in%
names
(
snakemake
@
config
))
#it's from a tsv file containing counts for samples
{
print
(
"Counts are given in a file !"
)
countMatrix
<-
read.table
(
snakemake
@
config
[[
"tsv_file"
]],
header
=
TRUE
,
sep
=
"\t"
)
rownames
(
countMatrix
)
=
countMatrix
[,
1
]
countMatrix
=
countMatrix
[,
-1
]
dds
=
DESeqDataSetFromMatrix
(
countData
=
countMatrix
,
colData
=
popmapData
,
design
=
~
condition
)
}
}
keep
<-
rowSums
(
counts
(
dds
))
>=
10
dds
<-
dds
[
keep
,]
...
...
@@ -128,6 +139,8 @@ dev.off()
speciesData
=
snakemake
@
params
[[
"biomaRtDataset"
]]
#what if we have tarnscript ID or not ENSEMBL ID instead of gene ID ?????????
if
(
speciesData
!=
"None"
)
{
# Add annotation with biomaRt
library
(
biomaRt
)
...
...
@@ -137,7 +150,7 @@ if (speciesData != "None") {
species_mart
<-
useMart
(
biomart
=
"ENSEMBL_MART_ENSEMBL"
,
host
=
"uswest.ensembl.org"
,
dataset
=
speciesData
)
#for the moment the top genes change to significant genes ?
#what if we have tarnscript ID instead of gene ID ?
ann
<-
getBM
(
filter
=
"ensembl_gene_id"
,
value
=
rownames
(
topGenes
),
attributes
=
c
(
"ensembl_gene_id"
,
"description"
,
"transcript_length"
),
mart
=
species_mart
)
go_ann
<-
getBM
(
filter
=
"ensembl_gene_id"
,
value
=
rownames
(
topGenes
),
attributes
=
c
(
"ensembl_gene_id"
,
"description"
,
"go_id"
,
"name_1006"
,
"namespace_1003"
),
mart
=
species_mart
)
...
...
tools/edger/edger.script.R
View file @
afbe02ba
...
...
@@ -7,23 +7,44 @@ library(rhdf5)
library
(
GenomicFeatures
)
library
(
ggplot2
)
samples
=
read.table
(
snakemake
@
config
[[
"group_file"
]],
stringsAsFactors
=
F
)
$
V1
conditions
=
read.table
(
snakemake
@
config
[[
"group_file"
]],
stringsAsFactors
=
F
)
$
V2
files
=
snakemake
@
input
[[
"counts"
]]
names
(
files
)
=
samples
if
(
snakemake
@
params
[[
"tx2gene"
]]
==
TRUE
){
TxDb
<-
makeTxDbFromGFF
(
file
=
snakemake
@
params
[[
"annotations"
]])
k
<-
keys
(
TxDb
,
keytype
=
"TXNAME"
)
tx2gene
<-
select
(
TxDb
,
k
,
"GENEID"
,
"TXNAME"
)
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
tx2gene
=
tx2gene
)
}
else
{
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
txOut
=
TRUE
)
popmapData
=
read.table
(
snakemake
@
config
[[
"popmap_file"
]],
stringsAsFactors
=
F
)
colnames
(
popmapData
)
=
c
(
"samples"
,
"condition"
)
samples
=
popmapData
$
samples
conditions
=
popmapData
$
condition
if
(
"quantification"
%in%
names
(
snakemake
@
config
)
)
{
if
(
snakemake
@
config
[[
"quantification"
]]
==
"htseq_count"
)
{
}
else
{
#one of tools handled by tximport
files
=
snakemake
@
input
[[
"counts"
]]
names
(
files
)
=
samples
if
(
snakemake
@
params
[[
"tx2gene"
]]
==
TRUE
){
TxDb
<-
makeTxDbFromGFF
(
file
=
snakemake
@
params
[[
"annotations"
]])
k
<-
keys
(
TxDb
,
keytype
=
"TXNAME"
)
tx2gene
<-
select
(
TxDb
,
k
,
"GENEID"
,
"TXNAME"
)
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
tx2gene
=
tx2gene
)
}
else
{
txi
<-
tximport
(
files
,
type
=
snakemake
@
config
[[
"quantification"
]],
txOut
=
TRUE
)
}
cts
<-
txi
$
counts
dgelist
<-
DGEList
(
cts
,
group
=
as.factor
(
conditions
))
}
}
else
{
if
(
"tsv_file"
%in%
names
(
snakemake
@
config
))
#it's from a tsv file containing counts for samples
{
print
(
"Counts are given in a file !"
)
countMatrix
<-
read.table
(
snakemake
@
config
[[
"tsv_file"
]],
header
=
TRUE
,
sep
=
"\t"
)
rownames
(
countMatrix
)
=
countMatrix
[,
1
]
countMatrix
=
countMatrix
[,
-1
]
dgelist
=
dgelist
(
counts
=
countMatrix
,
group
=
conditions
)
}
}
cts
<-
txi
$
counts
dgelist
<-
DGEList
(
cts
,
group
=
as.factor
(
conditions
))
#Filtering
countsPerMillion
<-
cpm
(
dgelist
)
countCheck
<-
countsPerMillion
>
1
...
...
tools/edger/edger.yaml
View file @
afbe02ba
...
...
@@ -18,7 +18,7 @@
inputs
:
[
{
name
:
counts
,
type
:
"
tsv"
,
expand
:
true
},
#will expand over counts for samples in SAMPLES
{
name
:
grou
p_file
,
type
:
"
popmap"
,
file
:
"
"
,
description
:
"
Path
to
tsv
file
with
samples
conditions"
},
{
name
:
popma
p_file
,
type
:
"
popmap"
,
file
:
"
"
,
description
:
"
Path
to
tsv
file
with
samples
conditions"
},
],
outputs
:
[
...
...
tools/radsex_distrib/radsex_distrib.rule.snakefile
View file @
afbe02ba
...
...
@@ -9,8 +9,8 @@ rule <step_name>__radsex_distrib:
# config["<step_name>__radsex_threads"]
params:
command = config["<step_name>__radsex_distrib_command"],
min_depth = config["<step_name>__radsex_min_depth"],
signif_threshold = config["<step_name>__radsex_signi_threshold"],
min_depth = config["<step_name>__radsex_
distrib_
min_depth"],
signif_threshold = config["<step_name>__radsex_
distrib_
signi_threshold"],
shell:
"{params.command} "+
...
...
tools/radsex_distrib/radsex_distrib.yaml
View file @
afbe02ba
...
...
@@ -26,7 +26,7 @@
options
:
[
{
name
:
"
radsex_min_depth"
,
name
:
"
radsex_
distrib_
min_depth"
,
prefix
:
"
--min-depth"
,
value
:
5
,
min
:
1
,
...
...
@@ -36,7 +36,7 @@
type
:
"
numeric"
,
},
{
name
:
"
radsex_signi_threshold"
,
name
:
"
radsex_
distrib_
signi_threshold"
,
prefix
:
"
--signif-threshold"
,
value
:
0.05
,
min
:
0
,
...
...
tools/radsex_map/radsex_map.rule.snakefile
View file @
afbe02ba
...
...
@@ -10,10 +10,10 @@ rule <step_name>__radsex_map:
# config["<step_name>__radsex_threads"]
params:
command = config["<step_name>__radsex_map_command"],
min_quality = config["<step_name>__radsex_min_quality"],
min_frequency = config["<step_name>__radsex_min_frequency"],
min_depth = config["<step_name>__radsex_min_depth"],
signif_threshold = config["<step_name>__radsex_signif_threshold"],
min_quality = config["<step_name>__radsex_
map_
min_quality"],
min_frequency = config["<step_name>__radsex_
map_
min_frequency"],
min_depth = config["<step_name>__radsex_
map_
min_depth"],
signif_threshold = config["<step_name>__radsex_
map_
signif_threshold"],
shell:
"{params.command} "+
"--markers-file {input.markers_table} "+
...
...
tools/radsex_map/radsex_map.yaml
View file @
afbe02ba
...
...
@@ -34,14 +34,14 @@
label
:
"
Path
to
the
genome
file"
,
},
{
name
:
chromosome_file
,
name
:
radsex_map_
chromosome_file
,
prefix
:
"
"
,
type
:
input_file
,
value
:
"
"
,
label
:
"
Path
to
the
chromosome
file"
,
},
{
name
:
"
radsex_min_quality"
,
name
:
"
radsex_
map_
min_quality"
,
prefix
:
"
--min-quality"
,
value
:
20
,
min
:
1
,
...
...
@@ -51,7 +51,7 @@
type
:
"
numeric"
,
},
{
name
:
"
radsex_min_frequency"
,
name
:
"
radsex_
map_
min_frequency"
,
prefix
:
"
--min-frequency"
,
value
:
0.1
,
min
:
0
,
...
...
@@ -61,7 +61,7 @@
type
:
"
numeric"
,
},
{
name
:
"
radsex_min_depth"
,
name
:
"
radsex_
map_
min_depth"
,
prefix
:
"
--min-depth"
,
value
:
5
,
min
:
1
,
...
...
@@ -71,7 +71,7 @@
type
:
"
numeric"
,
},
{
name
:
"
radsex_signif_threshold"
,
name
:
"
radsex_
map_
signif_threshold"
,
prefix
:
"
--signif-threshold"
,
value
:
0.05
,
min
:
0
,
...
...
tools/radsex_signif/radsex_signif.rule.snakefile
View file @
afbe02ba
...
...
@@ -10,7 +10,7 @@ rule <step_name>__radsex_signif:
# config["<step_name>__radsex_threads"]
params:
command = config["<step_name>__radsex_signif_command"],
min_depth = config["<step_name>__radsex_min_depth"],
min_depth = config["<step_name>__radsex_
signif_
min_depth"],
signif_threshold = config["<step_name>__radsex_signif_threshold"],
shell:
"{params.command} "+
...
...
tools/radsex_signif/radsex_signif.yaml
View file @
afbe02ba
...
...
@@ -28,7 +28,7 @@
options
:
[
{
name
:
"
radsex_min_depth"
,
name
:
"
radsex_
signif_
min_depth"
,
prefix
:
"
--min-depth"
,
value
:
5
,
min
:
1
,
...
...
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment