Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
msa-limit
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Rohmer Coralie
msa-limit
Commits
cc326edb
Commit
cc326edb
authored
3 years ago
by
Rohmer Coralie
Browse files
Options
Downloads
Patches
Plain Diff
renaming frame -> start_position
parent
6b067bc6
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
Snakefile
+13
-13
13 additions, 13 deletions
Snakefile
msa_limit.py
+7
-7
7 additions, 7 deletions
msa_limit.py
src/data_set_preparation.py
+2
-2
2 additions, 2 deletions
src/data_set_preparation.py
src/total_data_format.py
+4
-4
4 additions, 4 deletions
src/total_data_format.py
with
26 additions
and
26 deletions
Snakefile
+
13
−
13
View file @
cc326edb
...
...
@@ -3,7 +3,7 @@ import os
configfile: "config.yaml"
EXP = "experiments"
PREFIX_
FRAME="frame
_"
PREFIX_
START_POSITION="start_position
_"
#Script usage
def usage():
print("\nScript:\tsnakemake",
...
...
@@ -13,8 +13,8 @@ def usage():
"Arguments: ",
" -required: i : nanoport long reads",
" r : reference sequences. (1 or 2)",
" -optional: o : number of
frame
s to be tested",
" b :
beginning(s) position of frame
(s) (replacing
nbr
).",
" -optional: o : number of
start position
s to be tested",
" b :
start position
(s) (replacing
-o
).",
" d : depth(s).",
" s : sizes of regions",
" t : threshold for sequence consensus",
...
...
@@ -70,12 +70,12 @@ try:
beginings = config['B']
except:
try:
nb_
frame
= int(config['O'])
nb_
start_position
= int(config['O'])
except:
nb_
frame
= 1
nb_
start_position
= 1
beginings=[]
first_begining = (genome_size_min - int(REGION_SIZES[-1]))/(nb_
frame
+1)
for i in range(nb_
frame
):
first_begining = (genome_size_min - int(REGION_SIZES[-1]))/(nb_
start_position
+1)
for i in range(nb_
start_position
):
beginings.append(int((i+1)*first_begining))
DATA_SETS=[]
...
...
@@ -84,9 +84,9 @@ i=0
if type(beginings) != int: # equal : if len(beginings) > 1
for start in beginings:
i += 1
DATA_SETS.append(os.path.join(EXP,EXP_NAME,PREFIX_
FRAME
+ str(start)))
DATA_SETS.append(os.path.join(EXP,EXP_NAME,PREFIX_
START_POSITION
+ str(start)))
else:
DATA_SETS.append(os.path.join(EXP,EXP_NAME,PREFIX_
FRAME
+ str(beginings)))
DATA_SETS.append(os.path.join(EXP,EXP_NAME,PREFIX_
START_POSITION
+ str(beginings)))
beginings = [int(beginings)]
...
...
@@ -127,7 +127,7 @@ rule data_set_preparation :
output :
os.path.join(EXP,EXP_NAME,'data','reads.fasta'),
os.path.join(EXP,EXP_NAME,'data','ref.fasta'),
expand(os.path.join('{data_set}','
frame_start','frame_start
.txt') , data_set = DATA_SETS)
expand(os.path.join('{data_set}','
start_position
.txt') , data_set = DATA_SETS)
message :
"Data set preparation for "+EXP + '/'+ EXP_NAME
log:
...
...
@@ -135,7 +135,7 @@ rule data_set_preparation :
conda:
"env_conda/python3.yaml"
shell:
'ORDER="./src/data_set_preparation.py -i {input} -p '+PREFIX_
FRAME
+' -n '+ EXP + '/'+EXP_NAME + ' -b ' + ' '.join(map(str,beginings)) + '";'
'ORDER="./src/data_set_preparation.py -i {input} -p '+PREFIX_
START_POSITION
+' -n '+ EXP + '/'+EXP_NAME + ' -b ' + ' '.join(map(str,beginings)) + '";'
'echo "ORDER: $ORDER" >{log};'
'$ORDER 2>&1 >>{log}'
...
...
@@ -165,7 +165,7 @@ rule alignment_reads_on_ref :
rule reads_map_region :
input :
aln = os.path.join(EXP,EXP_NAME,'alignement','aln_reads_on_ref.sam'),
start = os.path.join('{data_set}','
frame_start','frame_start
.txt')
start = os.path.join('{data_set}','
start_position
.txt')
output :
os.path.join('{data_set}','read_map_region','reads_r{region_size}.fasta')
message:
...
...
@@ -372,7 +372,7 @@ rule abpoa_correction :
rule region_seq :
input :
ref = EXP + '/'+ EXP_NAME + '/data/ref.fasta',
start = "{data_set}/
frame_start/frame_start
.txt"
start = "{data_set}/
start_position
.txt"
output :
"{data_set}/seq_selectes_region/region_seq_r{region_size}.fasta"
message:
...
...
This diff is collapsed.
Click to expand it.
msa_limit.py
+
7
−
7
View file @
cc326edb
...
...
@@ -24,9 +24,9 @@ def usage():
"
name of the experiment
"
,
"
-o <int>
"
,
"
default: 10
"
,
"
number of
frame
s to be tested
"
,
"
number of
start position
s to be tested
"
,
"
-b <int>,<int>,...
"
,
"
beginning(s) position of frame
(s) (replacing -o)
"
,
"
start position
(s) (replacing -o)
"
,
"
-d <int>,<int>,...
"
,
"
default: 10,20,50
"
,
"
sequencing depth(s) (number of reads)
"
,
...
...
@@ -108,11 +108,11 @@ def summary():
exp_names
=
re
.
sub
(
'
\n
'
,
r
'
'
,
exp_names
)
if
os
.
path
.
exists
(
"
results_mean
"
):
result
=
subprocess
.
run
(
"
rm -r results_mean
"
,
shell
=
True
)
if
os
.
path
.
exists
(
"
results_all_
frame
s
"
):
result
=
subprocess
.
run
(
"
rm -r results_all_
frame
s
"
,
shell
=
True
)
if
os
.
path
.
exists
(
"
results_all_
start_position
s
"
):
result
=
subprocess
.
run
(
"
rm -r results_all_
start_position
s
"
,
shell
=
True
)
result
=
subprocess
.
run
(
"
./src/total_data_format.py -n
"
+
exp_names
,
shell
=
True
)
result
=
subprocess
.
run
(
"
./src/total_data_format.py -m -n
"
+
exp_names
,
shell
=
True
)
print
(
"
See folders: results_mean & results_all_
frame
s
"
)
print
(
"
See folders: results_mean & results_all_
start_position
s
"
)
else
:
print
(
"
No experiment has been launched yet
"
)
...
...
@@ -253,8 +253,8 @@ else:
lines
.
append
(
"
B: [
"
+
beginings
+
"
]
"
)
except
:
try
:
nb_
frame
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-o
"
)
+
1
]
lines
.
append
(
"
O: [
"
+
nb_
frame
+
"
]
"
)
nb_
start_position
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-o
"
)
+
1
]
lines
.
append
(
"
O: [
"
+
nb_
start_position
+
"
]
"
)
except
:
pass
cores
=
""
...
...
This diff is collapsed.
Click to expand it.
src/data_set_preparation.py
+
2
−
2
View file @
cc326edb
...
...
@@ -10,7 +10,7 @@ except:
try
:
prefix
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-p
"
)
+
1
]
except
:
sys
.
stderr
.
write
(
"
ERROR: The prefix for
frame
is missing.
\n
"
)
sys
.
stderr
.
write
(
"
ERROR: The prefix for
start position
is missing.
\n
"
)
try
:
exp_name
=
sys
.
argv
[
sys
.
argv
.
index
(
"
-n
"
)
+
1
]
...
...
@@ -47,5 +47,5 @@ os.system(order)
for
start
in
starts
:
order
=
"
echo
"
+
start
+
"
>
"
+
exp_name
+
"
/
"
+
prefix
+
start
+
"
/
frame_start/frame_start
.txt
"
order
=
"
echo
"
+
start
+
"
>
"
+
exp_name
+
"
/
"
+
prefix
+
start
+
"
/
start_position
.txt
"
os
.
system
(
order
)
This diff is collapsed.
Click to expand it.
src/total_data_format.py
+
4
−
4
View file @
cc326edb
...
...
@@ -4,7 +4,7 @@ import subprocess
EXP
=
"
experiments
"
ATTRIBUTES_TO_DISPLAY
=
[
"
percentage_Identity
"
,
"
percentage_Error
"
,
"
percentage_Match
"
]
ATTRIBUTES_TO_DISPLAY_THRESHOLD_INDEPENDANT
=
[
"
time
"
,
"
memory
"
]
PREFIX
=
"
frame
_
"
PREFIX
=
"
start_position
_
"
RESULT_FOLDER
=
"
results
"
NAME_DATA_FILE
=
"
data_align_t
"
NAME_META_CONSENSUS
=
"
meta_consensus_
"
...
...
@@ -49,7 +49,7 @@ except:
files
=
{}
i
=
0
result
=
subprocess
.
run
(
"
if [ ! -d results_mean ]; then mkdir results_mean;fi
"
,
shell
=
True
)
result
=
subprocess
.
run
(
"
if [ ! -d results_all_
frame
s ]; then mkdir results_all_
frame
s;fi
"
,
shell
=
True
)
result
=
subprocess
.
run
(
"
if [ ! -d results_all_
start_position
s ]; then mkdir results_all_
start_position
s;fi
"
,
shell
=
True
)
#-----------------------------------------------------------------------------
# Retrieved what was needed to read the files
#-----------------------------------------------------------------------------
...
...
@@ -146,10 +146,10 @@ for threshold in files :
if
attribute
in
ATTRIBUTES_TO_DISPLAY_THRESHOLD_INDEPENDANT
:
pass
output_mean
=
open
(
"
results_mean/data_
"
+
add_name_file_output
+
"
mean_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_
frame
s/data_
"
+
add_name_file_output
+
"
all_
frame
_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_
start_position
s/data_
"
+
add_name_file_output
+
"
all_
start_position
_
"
+
attribute
+
"
.csv
"
,
"
w
"
)
else
:
output_mean
=
open
(
"
results_mean/data_
"
+
add_name_file_output
+
"
mean_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_
frame
s/data_
"
+
add_name_file_output
+
"
all_
frame
_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_all
=
open
(
"
results_all_
start_position
s/data_
"
+
add_name_file_output
+
"
all_
start_position
_
"
+
attribute
+
"
_
"
+
threshold
+
"
.csv
"
,
"
w
"
)
output_mean
.
write
(
"
,,
"
)
output_all
.
write
(
"
,,
"
)
for
exp_name
in
data
[
"
order
"
]:
...
...
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