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
e67232a2
Commit
e67232a2
authored
Dec 06, 2017
by
Romain Feron
Browse files
fixed bugs in loading data from catalog
parent
562d4880
Changes
2
Hide whitespace changes
Inline
Side-by-side
radseq_analysis/file_handler/catalog.py
View file @
e67232a2
...
...
@@ -88,19 +88,16 @@ def get_haplotypes(parameters, sequence=False, correspondance=False, numbers=Tru
locus_id
=
tabs
[
2
]
indiv_ids
=
tabs
[
8
].
split
(
','
)
haplotypes_data
[
locus_id
]
=
{
'n_males'
:
0
,
'n_females'
:
0
}
for
individual
in
indiv_ids
:
temp
=
individual
.
split
(
'_'
)[
0
]
if
correspondance
:
haplotypes_data
[
locus_id
][
'individuals'
][
individual
.
split
(
'_'
)[
0
]]
=
individual
.
split
(
'_'
)[
1
]
else
:
haplotypes_data
[
locus_id
][
'individuals'
]
=
[
individual
.
split
(
'_'
)[
0
]
for
individual
in
indiv_ids
]
if
numbers
:
if
parameters
.
popmap
[
parameters
.
order
[
temp
[
0
]]]
is
'M'
:
haplotypes_data
[
locus_id
][
'n_males'
]
+=
1
elif
parameters
.
popmap
[
parameters
.
order
[
temp
[
0
]]]
is
'F'
:
haplotypes_data
[
locus_id
][
'n_females'
]
+=
1
if
sequence
:
haplotypes_data
[
locus_id
][
'sequence'
]
=
tabs
[
9
]
temp
=
[[
individual
.
split
(
'_'
)[
0
],
individual
.
split
(
'_'
)[
1
]]
for
individual
in
indiv_ids
]
if
correspondance
:
haplotypes_data
[
locus_id
][
'individuals'
]
=
{
t
[
0
]:
t
[
1
]
for
t
in
temp
}
else
:
haplotypes_data
[
locus_id
][
'individuals'
]
=
[
t
[
0
]
for
t
in
temp
]
if
numbers
:
haplotypes_data
[
locus_id
][
'n_males'
]
=
[
parameters
.
popmap
[
parameters
.
order
[
i
[
0
]]]
for
i
in
temp
].
count
(
'M'
)
haplotypes_data
[
locus_id
][
'n_females'
]
=
[
parameters
.
popmap
[
parameters
.
order
[
i
[
0
]]]
for
i
in
temp
].
count
(
'F'
)
if
sequence
:
haplotypes_data
[
locus_id
][
'sequence'
]
=
tabs
[
9
]
catalog
.
close
()
...
...
radseq_analysis/modules/sex_linked_haplotypes.py
View file @
e67232a2
...
...
@@ -5,7 +5,7 @@ from radseq_analysis import output
def
analysis
(
parameters
):
print
(
' - Loading haplotypes file ...'
)
haplotypes
=
file_handler
.
get_haplotypes
(
parameters
)
haplotypes
=
file_handler
.
get_haplotypes
(
parameters
,
sequence
=
True
)
print
(
' - Filtering loci ...'
)
output
.
sex_linked_haplotypes
(
parameters
,
haplotypes
)
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