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
khalid
radsex
Commits
fc96e206
Commit
fc96e206
authored
Sep 11, 2017
by
Romain Feron
Browse files
Fixed bug in heatmap R script (in case species name is not specified)
parent
f296d9bb
Changes
3
Hide whitespace changes
Inline
Side-by-side
radseq_analysis/modules/analysis.py
View file @
fc96e206
...
...
@@ -21,12 +21,15 @@ def analysis(input_dir=None,
parameters
=
Parameters
(
files_dir
=
input_dir
,
output_file_path
=
output_file_path
)
species
=
None
if
popmap_file_path
:
load_popmap
(
popmap_file_path
,
parameters
)
species
=
os
.
path
.
split
(
popmap_file_path
)[
1
]
species
=
os
.
path
.
splitext
(
species
)[
0
]
species
=
'_'
.
join
(
s
for
s
in
species
.
split
(
'_'
)[:
-
1
])
parameters
.
species
=
species
if
len
(
species
.
split
(
'_'
))
>
1
:
species
=
'_'
.
join
(
s
for
s
in
species
.
split
(
'_'
)[:
-
1
])
parameters
.
species
=
species
if
positions_file_path
:
load_positions_list
(
positions_file_path
,
parameters
)
...
...
radseq_analysis/visualization/haplotypes.py
View file @
fc96e206
...
...
@@ -6,6 +6,7 @@ def haplotypes(input_file_path, output_file_path, species_name):
scripts_d
=
''
.
join
(
os
.
path
.
split
(
os
.
path
.
realpath
(
__file__
))[:
-
1
])
cmd
=
(
'Rscript '
+
os
.
path
.
join
(
scripts_d
,
'r_scripts'
,
'heatmap.R'
)
+
' '
+
input_file_path
+
' '
+
output_file_path
+
' '
+
species_name
)
' '
+
output_file_path
)
if
species_name
:
cmd
+=
' '
+
species_name
os
.
system
(
cmd
)
radseq_analysis/visualization/r_scripts/heatmap.R
View file @
fc96e206
...
...
@@ -2,8 +2,12 @@
args
=
commandArgs
(
trailingOnly
=
TRUE
)
# test if there is at least one argument: if not, return an error
if
(
length
(
args
)
!=
3
){
stop
(
"Usage: R frequencies.R input_file.tsv output_file.png species_name"
)
if
(
length
(
args
)
>
3
|
length
(
args
)
<
2
){
stop
(
"Usage: R heatmap.R input_file.tsv output_file.png [species_name]"
)
}
else
if
(
length
(
args
==
3
))
{
species_name
=
args
[
3
]
}
else
if
(
length
(
args
==
2
))
{
species_name
=
"none"
}
suppressMessages
(
require
(
readr
))
...
...
@@ -11,7 +15,6 @@ suppressMessages(require(ggplot2))
input_file_path
=
args
[
1
]
output_file_path
=
args
[
2
]
species_name
=
args
[
3
]
g_legend
<-
function
(
a.gplot
){
tmp
<-
ggplot_gtable
(
ggplot_build
(
a.gplot
))
...
...
Write
Preview
Supports
Markdown
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