Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
GrAnnoT
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
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
DIADE
dynadiv
GrAnnoT
Commits
dc460c32
Commit
dc460c32
authored
1 week ago
by
nina.marthe_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
removed old code for transfer stat
parent
52226b7b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
GrAnnoT/compute_transfer_stat.py
+0
-80
0 additions, 80 deletions
GrAnnoT/compute_transfer_stat.py
with
0 additions
and
80 deletions
GrAnnoT/compute_transfer_stat.py
deleted
100644 → 0
+
0
−
80
View file @
52226b7b
from
.intersect
import
Features
# functions to output the stats on the transfer
# stats about missing segments and feature type, not used, will change.
def
stats_feature_missing_segment
(
feature_missing_segments
,
first_seg
,
last_seg
,
list_seg
,
feature_id
,
walk
,
segments_on_target_genome
):
# [feature_missing_first,feature_missing_middle,feature_missing_last,feature_missing_all,feature_missing_total,feature_total,feature_ok]
feature_missing_segments
[
5
].
append
(
feature_id
)
if
first_seg
==
''
:
# no segment of the feature is in the genome, the feature is missing entirely
feature_missing_segments
[
3
].
append
(
feature_id
)
elif
first_seg
!=
list_seg
[
0
]:
# the first segment is missing
feature_missing_segments
[
0
].
append
(
feature_id
)
elif
last_seg
!=
list_seg
[
-
1
]:
# the last segment is missing
feature_missing_segments
[
2
].
append
(
feature_id
)
# go through all the segments, check if some are missing in the middle of the feature
elif
(
len
(
list_seg
)
!=
1
)
and
(
feature_id
not
in
feature_missing_segments
[
3
]):
# to access the second to last element
for
segment
in
list_seg
[
1
-
(
len
(
list_seg
)
-
2
)]:
if
(
segment
not
in
segments_on_target_genome
)
or
(
not
segments_on_target_genome
[
segment
].
find_filename
(
walk
)):
feature_missing_segments
[
1
].
append
(
feature_id
)
break
# go through the segments, to see if one is missing anywhere on the feature
for
segment
in
list_seg
:
if
(
segment
not
in
segments_on_target_genome
)
or
(
not
segments_on_target_genome
[
segment
].
find_filename
(
walk
)):
if
feature_id
not
in
feature_missing_segments
[
4
]:
feature_missing_segments
[
4
].
append
(
feature_id
)
break
# if the feature doesnt have a missing segment, it is complete. ADD THE PATH CHECK FOR INSERTIONS !!
if
feature_id
not
in
feature_missing_segments
[
4
]:
feature_missing_segments
[
6
].
append
(
feature_id
)
def
get_annot_features
(
list_features
):
list_annot_features
=
[]
for
feature
in
list_features
:
list_annot_features
.
append
(
Features
[
feature
].
note
)
return
list_annot_features
def
count_hypput_total
(
list_annot_first
):
total
=
len
(
list_annot_first
)
count_hypput
=
0
for
annot
in
list_annot_first
:
if
(
"
hypothetical
"
in
annot
)
or
(
"
putative
"
in
annot
):
count_hypput
+=
1
return
[
count_hypput
,
total
]
# print stats on the transfer : number of feature that have segments in different positions missing.
def
stats_features
(
feature_missing_segments
):
# [feature_missing_first,feature_missing_middle,feature_missing_last,feature_missing_all,feature_missing_total,feature_total,feature_ok]
list_annot_first
=
get_annot_features
(
feature_missing_segments
[
0
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_first
)
print
(
"
\n
the first segment is missing for
"
,
total
,
"
features, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_middle
=
get_annot_features
(
feature_missing_segments
[
1
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_middle
)
print
(
"
a middle segment is missing for
"
,
total
,
"
features, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_last
=
get_annot_features
(
feature_missing_segments
[
2
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_last
)
print
(
"
the last segment is missing for
"
,
total
,
"
features, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_all
=
get_annot_features
(
feature_missing_segments
[
3
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_all
)
print
(
total
,
"
features are entirely missing, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_total
=
get_annot_features
(
feature_missing_segments
[
4
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_total
)
print
(
"
there is at least one segment missing for
"
,
total
,
"
features, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_ok
=
get_annot_features
(
feature_missing_segments
[
6
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_ok
)
print
(
total
,
"
features are entirely present in the new genome, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
list_annot_features
=
get_annot_features
(
feature_missing_segments
[
5
])
[
hyp_put
,
total
]
=
count_hypput_total
(
list_annot_features
)
print
(
"
there is
"
,
total
,
"
features in total, including
"
,
round
(
100
*
(
hyp_put
)
/
total
,
2
),
"
% hypothetical or putative.
"
)
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