Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
popsim
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
Container Registry
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
A compter du 1er avril, attention à vos pipelines :
Nouvelles limitations de Docker Hub
Show more breadcrumbs
SVdetection
popsim
Commits
6427b4bd
Commit
6427b4bd
authored
7 years ago
by
Floreal Cabanettes
Browse files
Options
Downloads
Patches
Plain Diff
Add init function to call build_pop as a module
parent
dade90a4
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
build_pop.py
+32
-16
32 additions, 16 deletions
build_pop.py
with
32 additions
and
16 deletions
build_pop.py
+
32
−
16
View file @
6427b4bd
...
...
@@ -317,17 +317,10 @@ def confirm(deletions: dict, variants: dict):
return
input
(
"
Continue [Y/n]?
"
)
in
[
"
y
"
,
"
Y
"
,
""
]
def
main
():
args
=
parse_args
()
reference
=
args
.
reference
sv_list
=
args
.
sv_list
output_dir
=
args
.
output_directory
tmp_dir
=
tempfile
.
mkdtemp
()
haploid
=
args
.
haploid
nb_inds
=
args
.
nb_inds
def
init
(
output_dir
,
erase_output
,
sv_list
,
nb_inds
,
reference
,
proba_del
,
haploid
,
force_polymorphism
,
coverage
,
read_len
,
insert_len_mean
,
insert_len_sd
,
threads
,
quiet
=
True
):
if
os
.
path
.
isdir
(
output_dir
):
if
args
.
erase_output
:
if
erase_output
:
shutil
.
rmtree
(
output_dir
)
else
:
eprint
(
"
Error: output directory {0} already exists.
"
.
format
(
output_dir
))
...
...
@@ -342,6 +335,8 @@ def main():
if
not
os
.
path
.
isfile
(
reference
+
"
.fai
"
):
os
.
system
(
"
samtools faidx
"
+
reference
)
tmp_dir
=
tempfile
.
mkdtemp
()
prg_path
=
os
.
path
.
dirname
(
os
.
path
.
realpath
(
__file__
))
os
.
mkdir
(
output_dir
)
...
...
@@ -357,21 +352,42 @@ def main():
print
(
"
GENERATE RANDOM DELETIONS VARIANTS...
\n
"
)
try
:
sv_sim
=
VariantsSimulator
(
sv_list
,
args
.
threads
)
deletions
=
sv_sim
.
get_random_deletions
(
args
.
proba_del
,
args
.
reference
)
sv_sim
=
VariantsSimulator
(
sv_list
,
threads
)
deletions
=
sv_sim
.
get_random_deletions
(
proba_del
,
reference
)
print
(
""
)
except
InputException
as
e
:
print
(
e
)
return
False
if
args
.
quiet
or
confirm
(
deletions
,
sv_sim
.
variants
):
genotypes_for_inds
=
build_genotypes_vcf_list
(
deletions
,
output_vcf
,
haploid
,
args
.
force_polymorphism
,
nb_inds
,
if
quiet
or
confirm
(
deletions
,
sv_sim
.
variants
):
genotypes_for_inds
=
build_genotypes_vcf_list
(
deletions
,
output_vcf
,
haploid
,
force_polymorphism
,
nb_inds
,
tmp_dir
,
prg_path
)
build_fastas_chromosomes
(
reference
,
genotypes_for_inds
,
haploid
,
output_dir
)
generate_samples_fastq
(
haploid
,
nb_inds
,
output_dir
,
args
.
coverage
,
args
.
read_len
,
args
.
insert_len_mean
,
args
.
insert_len_sd
,
prg_path
,
args
.
threads
)
generate_samples_fastq
(
haploid
,
nb_inds
,
output_dir
,
coverage
,
read_len
,
insert_len_mean
,
insert_len_sd
,
prg_path
,
threads
)
print
(
"
DONE!
\n
"
)
else
:
print
(
"
Aborted!
\n
"
)
def
main
():
args
=
parse_args
()
reference
=
args
.
reference
sv_list
=
args
.
sv_list
output_dir
=
args
.
output_directory
haploid
=
args
.
haploid
nb_inds
=
args
.
nb_inds
erase_output
=
args
.
erase_output
proba_del
=
args
.
proba_del
threads
=
args
.
threads
force_polymorphism
=
args
.
force_polymorphism
coverage
=
args
.
coverage
read_len
=
args
.
read_len
insert_len_mean
=
args
.
insert_len_mean
insert_len_sd
=
args
.
insert_len_sd
quiet
=
args
.
quiet
init
(
output_dir
,
erase_output
,
sv_list
,
nb_inds
,
reference
,
proba_del
,
haploid
,
force_polymorphism
,
coverage
,
read_len
,
insert_len_mean
,
insert_len_sd
,
threads
,
quiet
)
if
__name__
==
'
__main__
'
:
sys
.
exit
(
main
())
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