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
genotoul-bioinfo
ng6
Commits
8f94341b
Commit
8f94341b
authored
Jan 14, 2020
by
Romain Therville
🐭
Browse files
Merge branch 'master' into 'issue#151'
# Conflicts: # ui/nG6/pi6/administration_view.tpl
parents
d6928bee
6c16a1fa
Changes
10
Show whitespace changes
Inline
Side-by-side
src/ng6/analysis.py
View file @
8f94341b
...
...
@@ -743,7 +743,7 @@ class Analysis (Component):
raise
Exception
(
"Error while trying to rsync "
+
old_path
+
" to "
+
new_absolute_path
+
"
\n
"
+
"Command : "
+
str_cmd
+
"
\n
"
+
"Error code : "
+
str
(
retcode
)
+
"
\n
"
)
else
:
print
(
"rsync could not be launched because the s
ource and destination are the same
, from
"
+
old_path
+
"
to "
+
new_absolute_path
+
"
\n
"
)
str_cmd
=
"S
ource and destination
directories
are the same
:
"
+
old_path
+
"
, ignored.
\n
"
new_retention
=
ng6conf
.
get_retention_date
(
space_id
,
self
.
date
)
...
...
src/ng6/ng6workflow.py
View file @
8f94341b
...
...
@@ -446,6 +446,7 @@ class CasavaNG6Workflow(NG6Workflow):
if
self
.
is_casava
:
self
.
group_prefix
=
list
((
Utils
.
get_group_basenames
(
self
.
get_all_reads
(),
"read"
)).
keys
())
logging
.
getLogger
(
"ng6"
).
debug
(
"CasavaNG6Workflow._preprocess enter"
+
str
(
self
.
group_prefix
))
def
_process_casava_18
(
self
,
casava_directory
,
project_name
,
lane_number
,
input_files
):
logging
.
getLogger
(
"ng6"
).
debug
(
"CasavaNG6Workflow._process_casava_18 enter"
)
...
...
@@ -643,10 +644,14 @@ class CasavaNG6Workflow(NG6Workflow):
concatenatefastq
=
None
filtered_read1_files
=
[]
filtered_read2_files
=
[]
filtered_index_files
=
[]
analysis_files
=
[]
saved_files
=
[]
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process entering"
)
if
self
.
is_casava
:
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process self.is_casava"
)
analysis_files
=
self
.
get_all_reads
(
"read1"
)
+
self
.
get_all_reads
(
"read2"
)
if
len
(
self
.
log_files
)
>
0
:
add_log
=
self
.
add_component
(
"BasicAnalysis"
,
[
self
.
log_files
,
"Log Files"
,
"Log files generated during primary analysis"
,
"-"
,
"-"
,
"-"
,
"gz"
,
""
,
"log.gz"
])
...
...
@@ -658,38 +663,47 @@ class CasavaNG6Workflow(NG6Workflow):
else
:
demultiplex_stats
=
self
.
add_component
(
"DemultiplexStats"
,
[
self
.
get_all_reads
(
"read1"
),
self
.
undetermined_reads1
])
#analysis files for fastq illumina and fastqc analysis
if
self
.
keep_reads
!=
"all"
:
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process self.keep_reads != all"
)
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process BEFORE FASTQILLUMINAFILTER self.get_all_reads() = "
+
","
.
join
(
self
.
get_all_reads
()))
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process self.group_prefix = "
+
","
.
join
(
self
.
group_prefix
))
# fastq illumina filter
fastqilluminafilter
=
self
.
add_component
(
"FastqIlluminaFilter"
,
[
self
.
runobj
,
self
.
get_all_reads
(),
self
.
keep_reads
,
self
.
group_prefix
])
fastqilluminafilter
=
self
.
add_component
(
"FastqIlluminaFilter"
,
[
self
.
runobj
,
self
.
get_all_reads
(),
self
.
keep_reads
,
self
.
group_prefix
])
logging
.
getLogger
(
"ng6"
).
debug
(
"illumina_process fastqilluminafilter = "
+
","
.
join
(
filtered_read1_files
))
# list filtered files
if
self
.
is_paired_end
()
:
# split read 1 and read 2 from filtered files list
if
self
.
is_10Xcasava
:
[
filtered_read1_files
,
filtered_read2_files
,
filtered_index_files
]
=
Utils
.
split_pair_and_index
(
fastqilluminafilter
.
fastq_files_filtered
,
(
self
.
group_prefix
is
not
None
))
else
:
[
filtered_read1_files
,
filtered_read2_files
]
=
Utils
.
split_pair
(
fastqilluminafilter
.
fastq_files_filtered
,
(
self
.
group_prefix
is
not
None
))
else
:
filtered_read1_files
=
fastqilluminafilter
.
fastq_files_filtered
filtered_read2_files
=
[]
filtered_index_files
=
[]
filtered_read1_files
=
sorted
(
filtered_read1_files
)
filtered_read2_files
=
sorted
(
filtered_read2_files
)
filtered_index_files
=
sorted
(
filtered_index_files
)
else
:
fastqilluminafilter
=
None
filtered_read1_files
=
self
.
get_all_reads
(
"read1"
)
filtered_read2_files
=
self
.
get_all_reads
(
"read2"
)
filtered_index_files
=
self
.
get_all_reads
(
"index"
)
# archive the files
#TODO : if self.group_prefix == None, the create the output of fastqilluminafilter in the run.get_work_directory()
saved_files
=
filtered_read1_files
+
filtered_read2_files
+
self
.
get_all_reads
(
"index"
)
saved_files
=
filtered_read1_files
+
filtered_read2_files
+
filtered_index_files
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process saved_files = "
+
","
.
join
(
saved_files
))
reads_prefixes
=
None
if
self
.
group_prefix
!=
None
:
# concatenate fastq
reads_prefixes
=
list
((
Utils
.
get_group_basenames
(
saved_files
,
"read"
)).
keys
())
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process read_predixes = "
+
","
.
join
(
reads_prefixes
))
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process saved_files = "
+
","
.
join
(
saved_files
))
concatenatefastq
=
self
.
add_component
(
"ConcatenateFilesGroups"
,
[
self
.
runobj
,
saved_files
,
reads_prefixes
])
saved_files
=
concatenatefastq
.
concat_files
...
...
@@ -700,8 +714,11 @@ class CasavaNG6Workflow(NG6Workflow):
fastqilluminafilter
=
None
filtered_read1_files
=
self
.
get_all_reads
(
"read1"
)
filtered_read2_files
=
self
.
get_all_reads
(
"read2"
)
filtered_index_files
=
self
.
get_all_reads
(
"index"
)
saved_files
=
self
.
get_all_reads
()
# reads prefixes
reads_prefixes
=
list
((
Utils
.
get_group_basenames
(
analysis_files
,
"read"
)).
keys
())
# add raw
addrawfiles
=
self
.
add_component
(
"AddRawFiles"
,
[
self
.
runobj
,
saved_files
,
self
.
compression
])
contam
=
[]
...
...
@@ -711,6 +728,9 @@ class CasavaNG6Workflow(NG6Workflow):
contam
.
append
(
self
.
get_resource
(
"yeast_bwa"
))
except
:
pass
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process files_analysis = "
+
","
.
join
(
filtered_read1_files
))
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process files_analysis = "
+
","
.
join
(
filtered_read2_files
))
logging
.
getLogger
(
"CasavaNG6Workflow"
).
debug
(
"illumina_process files_analysis = "
+
","
.
join
(
filtered_index_files
))
# contamination_search
if
contam
:
if
self
.
contamination_databank
:
contam
.
extend
(
self
.
contamination_databank
)
...
...
src/ng6/run.py
View file @
8f94341b
...
...
@@ -494,7 +494,7 @@ class Run(object):
raise
Exception
(
"Error while trying to rsync "
+
old_path
+
" to "
+
new_absolute_path
+
"
\n
"
+
"Command : "
+
str_cmd
+
"
\n
"
+
"Error code : "
+
str
(
retcode
)
+
"
\n
"
)
else
:
print
(
"rsync could not be launched because the s
ource and destination are the same
, from
"
+
old_path
+
"
to "
+
new_absolute_path
+
"
\n
"
)
str_cmd
=
"S
ource and destination
directories
are the same
:
"
+
old_path
+
"
, ignored.
\n
"
new_retention
=
ng6conf
.
get_retention_date
(
space_id
,
self
.
date
)
...
...
src/ng6/t3MySQLdb.py
View file @
8f94341b
...
...
@@ -202,7 +202,7 @@ class t3MySQLdb(object):
right_level_id
=
qresult
.
rows
[
0
][
0
]
sql
=
"INSERT INTO tx_nG6_project (pid, tstamp, crdate, cruser_id, description, name, hidden, space_id)
\
VALUES ('%s','%s','%s','%s','%s','%s','%s','%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
admin_id
,
self
.
esc_q
(
pdescription
),
self
.
esc_q
(
name
),
hidden
,
space_id
)
self
.
esc_q
(
pdescription
),
self
.
esc_q
(
name
),
int
(
hidden
)
,
space_id
)
qresult
=
self
.
execute
(
sql
,
commit
=
True
)
project_id
=
qresult
.
lastrowid
self
.
execute
(
"INSERT INTO fe_rights (fe_user_id, project_id, right_id) VALUES ('%s','%s','%s')"
%
(
admin_id
,
project_id
,
right_level_id
),
...
...
@@ -320,7 +320,7 @@ class t3MySQLdb(object):
'%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
cruser_id
,
self
.
esc_q
(
name
),
calendar
.
timegm
(
date
.
timetuple
()),
directory
,
self
.
esc_q
(
species
),
self
.
esc_q
(
data_nature
),
self
.
esc_q
(
type
),
nb_sequences
,
full_seq_size
,
self
.
esc_q
(
description
),
hidden
,
self
.
esc_q
(
sequencer
),
retention_date
,
"stored"
,
"0"
,
"0"
,
"0"
)
full_seq_size
,
self
.
esc_q
(
description
),
int
(
hidden
)
,
self
.
esc_q
(
sequencer
),
retention_date
,
"stored"
,
"0"
,
"0"
,
"0"
)
qresult
=
self
.
execute
(
sql
,
commit
=
True
)
run_id
=
qresult
.
lastrowid
...
...
@@ -471,7 +471,7 @@ class t3MySQLdb(object):
if
description
:
set_values
.
append
(
"description='%s'"
%
self
.
esc_q
(
description
))
if
hidden
:
set_values
.
append
(
"hidden=%s"
%
hidden
)
set_values
.
append
(
"hidden=%s"
%
int
(
hidden
)
)
if
sequencer
:
set_values
.
append
(
"sequencer='%s'"
%
self
.
esc_q
(
sequencer
))
if
storage_size
:
...
...
@@ -673,7 +673,8 @@ class t3MySQLdb(object):
#--------------------------------------------------------------------
# Analyze functions
def
add_analysis
(
self
,
aclass
,
name
,
description
,
cruser_login
,
date
,
directory
,
software
,
version
,
params
,
is_editable
,
retention_date
,
hidden
=
1
,
parent_uid
=
0
):
def
add_analysis
(
self
,
aclass
,
name
,
description
,
cruser_login
,
date
,
\
directory
,
software
,
version
,
params
,
is_editable
,
retention_date
,
hidden
=
1
,
parent_uid
=
0
):
"""
Update an Analyze
@param aclass : the class of the analysis
...
...
@@ -703,7 +704,7 @@ class t3MySQLdb(object):
'%s', '%s', '%s', '%s', '%s', '%s' ,'%s', '%s', '%s', '%s', '%s', '%s', '%s')"
%
(
self
.
cfg_reader
.
get_pid
(),
crdate
,
crdate
,
cruser_id
,
aclass
,
self
.
esc_q
(
name
),
self
.
esc_q
(
description
),
crdate
,
directory
,
self
.
esc_q
(
software
),
self
.
esc_q
(
version
),
hidden
,
self
.
esc_q
(
params
),
analysis_is_editable
,
parent_uid
,
retention_date
,
"stored"
,
"0"
,
"0"
,
"0"
)
int
(
hidden
)
,
self
.
esc_q
(
params
),
analysis_is_editable
,
parent_uid
,
retention_date
,
"stored"
,
"0"
,
"0"
,
"0"
)
qresult
=
self
.
execute
(
sql
,
commit
=
True
)
analysis_id
=
qresult
.
lastrowid
...
...
src/ng6/utils.py
View file @
8f94341b
...
...
@@ -290,6 +290,43 @@ class Utils(object):
return
[
read_1_list
,
read_2_list
]
@
staticmethod
def
split_pair_and_index
(
file_list
,
is_casava
=
False
):
"""
Return the list of read 1, the list of read 2 and the list of index read from a list
@param file_list : the list
@param is_casava : files names in file_list are in CASVAVA format
"""
read_1_list
=
[]
read_2_list
=
[]
read_index_list
=
[]
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. Entering"
)
if
is_casava
:
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. is_casava"
)
for
file
in
file_list
:
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. file = "
+
file
)
basename_without_ext
=
os
.
path
.
basename
(
file
).
split
(
"."
)[
0
]
file_name_fields
=
basename_without_ext
.
split
(
Utils
.
CASAVA_FILENAME_SEPARATOR
)
read_tag
=
file_name_fields
[
Utils
.
CASAVA_FILENAME
[
'read'
]
-
1
]
if
read_tag
==
"R1"
:
read_1_list
.
append
(
file
)
elif
read_tag
==
"R2"
:
read_2_list
.
append
(
file
)
else
:
read_index_list
.
append
(
file
)
else
:
sorted_list
=
sorted
(
file_list
)
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. file_list = "
+
", "
.
join
(
file_list
))
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. sorted_list = "
+
", "
.
join
(
sorted_list
))
for
i
in
range
(
0
,
len
(
sorted_list
),
3
):
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. sorted_list[i] = "
+
sorted_list
[
i
])
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. sorted_list[i+1] = "
+
sorted_list
[
i
+
1
])
logging
.
getLogger
(
"Utils"
).
debug
(
"split_pair_and_index. sorted_list[i+1] = "
+
sorted_list
[
i
+
2
])
read_1_list
.
append
(
sorted_list
[
i
])
read_2_list
.
append
(
sorted_list
[
i
+
1
])
read_index_list
.
append
(
sorted_list
[
i
+
2
])
return
[
read_1_list
,
read_2_list
,
read_index_list
]
@
staticmethod
def
get_group_basenames
(
file_list
,
group_by
):
...
...
@@ -361,6 +398,17 @@ class Utils(object):
return "".join(dec)
"""
@
staticmethod
def
get_project_dirname
(
project_id
,
project_name
):
return
"Project_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
project_name
),
project_id
)
@
staticmethod
def
get_run_dirname
(
run_id
,
run_name
):
return
"Run_%s.%s"
%
(
re
.
sub
(
r
"[^A-Za-z0-9]"
,
"_"
,
run_name
),
run_id
)
@
staticmethod
def
get_analyse_dirname
(
analyse_id
,
analyse_name
):
return
"Analyse_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse_name
),
analyse_id
)
@
staticmethod
def
get_directories_structure_and_content
(
ng6_username
,
data_folder
,
output_folder
,
prefixed_ids
):
from
ng6.t3MySQLdb
import
t3MySQLdb
...
...
@@ -372,20 +420,21 @@ class Utils(object):
try
:
user_id
=
t3mysql
.
get_user_id
(
ng6_username
)
except
:
pass
for
prefixed_id
in
prefixed_ids
.
split
(
';'
)
:
vals
=
prefixed_id
.
split
(
'_'
)
prefix
=
vals
[
0
]
id
=
vals
[
1
]
if
prefix
==
"data"
or
prefix
==
"run"
:
run
=
t3mysql
.
select_run_informations
(
id
)
source_dir
=
data_folder
+
'/'
+
run
[
'directory'
]
project_name
=
"Project_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
run
[
'project_
name'
]),
run
[
'project_
id
'
]
)
project_name
=
Utils
.
get_project_dirname
(
run
[
'project_
id'
],
run
[
'project_
name
'
])
#run_name = "Run_%s.%s" %( run['name'].replace(' ', '_').replace('/', '_'), id )
run_name
=
"Run_%s.%s"
%
(
re
.
sub
(
r
"[^A-Za-z0-9]"
,
"_"
,
run
[
'name'
])
,
id
)
run_name
=
Utils
.
get_run_dirname
(
id
,
run
[
'name'
])
raw_data_dir
=
os
.
path
.
join
(
output_folder
,
project_name
,
run_name
,
"RawData"
)
print
(
run
,
source_dir
,
project_name
,
run_name
)
if
source_dir
not
in
src_directories
:
src_directories
.
append
(
source_dir
)
if
raw_data_dir
not
in
dest_directories
:
...
...
@@ -394,7 +443,7 @@ class Utils(object):
if
prefix
==
"run"
:
for
analyse_id
,
analyse_values
in
t3mysql
.
get_user_run_analysis
(
user_id
,
id
,
'tx_nG6_analyze.name'
).
items
()
:
analysis_dir
=
data_folder
+
'/'
+
analyse_values
[
"directory"
]
analysis_name
=
"Analyse_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse_values
[
'name'
]
),
analyse_id
)
analysis_name
=
Utils
.
get_analyse_dirname
(
analyse_id
,
analyse_values
[
'name'
]
)
dest_analysis_dir
=
os
.
path
.
join
(
output_folder
,
project_name
,
run_name
,
analysis_name
)
if
analysis_dir
not
in
src_directories
:
...
...
@@ -409,19 +458,19 @@ class Utils(object):
if
source_dir
not
in
src_directories
:
src_directories
.
append
(
source_dir
)
project_name
=
"Project_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse
[
"project_name"
]),
analyse
[
"project_id"
])
project_name
=
Utils
.
get_project_dirname
(
analyse
[
'project_id'
],
analyse
[
'project_name'
])
# it's a run analysis
if
analyse
[
"run_id"
]:
run_name
=
"Run_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse
[
"run_
name
"
]
)
,
analyse
[
"run_
id
"
])
run_name
=
Utils
.
get_run_dirname
(
analyse
[
"run_
id
"
],
analyse
[
"run_
name
"
])
analysis_name
=
"Analyse_%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse
[
"
name
"
]),
id
)
analysis_name
=
Utils
.
get_analyse_dirname
(
id
,
analyse
[
'
name
'
]
)
dest_analysis_dir
=
os
.
path
.
join
(
output_folder
,
project_name
,
run_name
,
analysis_name
)
if
dest_analysis_dir
not
in
dest_directories
:
dest_directories
.
append
(
dest_analysis_dir
)
# it's a project analysis
else
:
analysis_name
=
"Project_
analyses/%s.%s"
%
(
re
.
sub
(
r
"[\s\/]"
,
"_"
,
analyse
[
"
name
"
]),
id
)
analysis_name
=
"Project_
"
+
Utils
.
get_analyse_dirname
(
id
,
analyse
[
'
name
'
]
)
dest_analysis_dir
=
os
.
path
.
join
(
output_folder
,
project_name
,
analysis_name
)
if
dest_analysis_dir
not
in
dest_directories
:
dest_directories
.
append
(
dest_analysis_dir
)
...
...
@@ -439,6 +488,9 @@ class Utils(object):
@
staticmethod
def
rsync_getcmd
(
source
,
destination
):
if
source
==
""
or
not
os
.
path
.
isdir
(
source
)
:
return
[
0
,
"Source directory '"
+
source
+
"' doesn't exist, ignored."
]
if
not
source
.
endswith
(
"/"
):
source
+=
"/"
cmd
=
[
"rsync"
,
"-avh"
,
"--perms"
,
"--times"
,
"--remove-sent-files"
,
source
,
destination
]
...
...
ui/nG6/felogin.html
View file @
8f94341b
...
...
@@ -50,8 +50,6 @@
<div
class=
"sub-content sc-top-bottom"
>
<div
class=
"ng6-content-header-left"
>
<h2>
###STATUS_HEADER###
</h2>
<p>
###STATUS_MESSAGE###
</p>
<!-- ###LOGIN_FORM### -->
<form
action=
"###ACTION_URI###"
target=
"_top"
method=
"post"
onsubmit=
"###ON_SUBMIT###"
class=
"form-horizontal"
>
<fieldset>
...
...
@@ -130,8 +128,6 @@
<div
class=
"sub-content sc-top-bottom"
>
<div
class=
"ng6-content-header-left"
>
<h2>
###STATUS_HEADER###
</h2>
<p>
###STATUS_MESSAGE###
</p>
<!-- ###LOGIN_FORM### -->
<form
action=
"###ACTION_URI###"
target=
"_top"
method=
"post"
onsubmit=
"###ON_SUBMIT###"
class=
"form-horizontal"
>
<fieldset>
...
...
ui/nG6/res/smarty/libs/plugins/modifier.get_description.php
View file @
8f94341b
...
...
@@ -109,6 +109,8 @@ function get_casava_1_8_desc($string, $desc) {
$best_description
=
$description
.
" (R1)"
;
}
elseif
(
preg_match
(
"/_R2/i"
,
$string
))
{
$best_description
=
$description
.
" (R2)"
;
}
elseif
(
preg_match
(
"/_I1/i"
,
$string
))
{
$best_description
=
$description
.
" (I1)"
;
}
}
}
...
...
ui/nG6/template/css/style.css
View file @
8f94341b
...
...
@@ -70,8 +70,10 @@ a img { border: 0; }
.ng6-content-header-left
{
box-shadow
:
-4px
0
5px
-5px
grey
,
5px
0
5px
-6px
grey
;
margin
:
0
;
margin-left
:
10px
;
margin-right
:
20px
;
padding
:
10px
;
width
:
375
px
;
width
:
400
px
;
height
:
275px
;
text-align
:
justify
;
float
:
left
;
...
...
@@ -81,7 +83,7 @@ a img { border: 0; }
box-shadow
:
-4px
0
5px
-5px
grey
,
5px
0
5px
-6px
grey
;
margin
:
0
;
padding
:
10px
;
width
:
625
px
;
width
:
710
px
;
text-align
:
justify
;
float
:
left
;
background-color
:
#FaFaFa
;
...
...
@@ -143,7 +145,7 @@ a img { border: 0; }
padding
:
0
;
margin-left
:
auto
;
margin-right
:
auto
;
width
:
1
3
00px
;
width
:
1
0
00px
;
color
:
#BBBABA
;
display
:
block
;
line-height
:
1.5em
;
...
...
workflows/illumina_10X/__init__.py
View file @
8f94341b
...
...
@@ -37,4 +37,4 @@ class Illumina10XQualityCheck (CasavaNG6Workflow):
def
process
(
self
):
fastqilluminafilter
,
filtered_read1_files
,
filtered_read2_files
,
concat_files
=
self
.
illumina_process
()
\ No newline at end of file
fastqilluminafilter
,
filtered_read1_files
,
filtered_read2_files
,
concat_files
,
concatenatefastq
=
self
.
illumina_process
()
\ No newline at end of file
workflows/switch_space_id/components/move_project.py
View file @
8f94341b
...
...
@@ -30,51 +30,52 @@ def migrate_project (project_id, new_space_id, output):
from
ng6.project
import
Project
from
ng6.run
import
Run
with
open
(
output
,
'w'
)
as
fh
:
def
log_to_output_files
(
log_text
,
log_file
):
fh
=
open
(
log_file
,
"a"
)
fh
.
write
(
log_text
)
fh
.
close
()
logging
.
getLogger
(
"move_project.py"
).
debug
(
log_text
)
print
(
"os.path.exists("
+
log_file
+
")="
+
str
(
os
.
path
.
exists
(
log_file
)))
ng6conf
=
NG6ConfigReader
()
base_path
=
ng6conf
.
get_save_directory
()
project
=
Project
.
get_from_id
(
project_id
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating project '"
+
str
(
project
.
name
)
+
"' ("
+
str
(
project
.
id
)
+
") to "
+
str
(
new_space_id
)
+
"
\n
"
)
fh
.
write
(
"Migrating project '"
+
str
(
project
.
name
)
+
"' ("
+
str
(
project
.
id
)
+
") to "
+
str
(
new_space_id
)
+
"
\n
"
)
old_space_id
=
project
.
space_id
logging
.
getLogger
(
"migrate_project"
).
debug
(
"old_space_id = "
+
old_space_id
+
", new_space_id = "
+
new_space_id
+
"
\n
"
)
fh
.
write
(
"old_space_id = "
+
old_space_id
+
", new_space_id = "
+
new_space_id
+
"
\n
"
)
str_cmds
=
[]
str_log
=
"MIGRATE PROJECT: '"
+
str
(
project
.
name
)
+
"' ("
+
str
(
project
.
id
)
+
") from "
+
old_space_id
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
runs
=
project
.
get_runs
()
for
run
in
runs
:
fh
.
write
(
"Migrating run '"
+
run
.
name
+
"' ("
+
str
(
run
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating run '"
+
run
.
name
+
"' ("
+
str
(
run
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
str_cmds
.
append
(
run
.
change_space
(
new_space_id
)
)
fh
.
write
(
"Migrating successful!
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating successful!
\n
"
)
str_log
=
"
\t
- ##RUN '"
+
run
.
name
+
"' ("
+
str
(
run
.
id
)
+
") - "
+
run
.
directory
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
(
ret_code
,
ret_command
)
=
run
.
change_space
(
new_space_id
)
str_log
=
"
\t
RET CODE: "
+
str
(
ret_code
)
+
" CMD : "
+
ret_command
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
run_analyzes
=
run
.
get_analysis
()
for
analysis
in
run_analyzes
:
fh
.
write
(
"Migrating analysis '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating analysis '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
str_cmds
.
append
(
analysis
.
change_space
(
new_space_id
)
)
fh
.
write
(
"Migrating successful!
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating successful!
\n
"
)
str_log
=
"
\t\t
- ###ANALYSE "
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
") - "
+
analysis
.
directory
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
(
ret_code
,
ret_command
)
=
analysis
.
change_space
(
new_space_id
)
str_log
=
"
\t\t
RET CODE: "
+
str
(
ret_code
)
+
" CMD : "
+
ret_command
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
analyzes
=
project
.
get_analysis
()
for
analysis
in
analyzes
:
fh
.
write
(
"Migrating analysis '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating analysis '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
")"
+
" to "
+
str
(
new_space_id
)
+
"
\n
"
)
str_cmds
.
append
(
analysis
.
change_space
(
new_space_id
)
)
fh
.
write
(
"Migrating successful!
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Migrating successful!
\n
"
)
for
command
in
str_cmds
:
fh
.
write
(
"Command launched : "
+
str
(
command
[
1
])
+
"
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Command launched : "
+
str
(
command
[
1
])
+
"
\n
"
)
fh
.
write
(
"Returned code : "
+
str
(
command
[
0
])
+
"
\n
"
)
logging
.
getLogger
(
"migrate_project"
).
debug
(
"Returned code : "
+
str
(
command
[
0
])
+
"
\n
"
)
str_log
=
"
\t
- ##ANALYSE PROJECT '"
+
analysis
.
name
+
"' ("
+
str
(
analysis
.
id
)
+
") - "
+
analysis
.
directory
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
(
ret_code
,
ret_command
)
=
analysis
.
change_space
(
new_space_id
)
str_log
=
"
\t
RET CODE: "
+
str
(
ret_code
)
+
" CMD : "
+
ret_command
+
"
\n
"
log_to_output_files
(
str_log
,
output
)
project
.
update_space_id
(
new_space_id
)
str_log
=
"project.update_space_id DONE
\n
"
log_to_output_files
(
str_log
,
output
)
class
MoveProject
(
Component
):
...
...
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