Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
vidjil
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1,425
Issues
1,425
List
Boards
Labels
Milestones
Merge Requests
49
Merge Requests
49
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vidjil
vidjil
Commits
466fbeba
Commit
466fbeba
authored
Oct 17, 2014
by
Mathieu Giraud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fuse.py: ListWindows, __iter__/__getitem__/__len__ methods
parent
0ee4e4e9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
14 deletions
+26
-14
server/fuse.py
server/fuse.py
+26
-14
No files found.
server/fuse.py
View file @
466fbeba
...
...
@@ -281,13 +281,26 @@ class ListWindows:
self
.
d
[
"clusters"
]
=
[]
def
__str__
(
self
):
return
"<ListWindows :
%
s
%
d >"
%
(
self
.
d
[
"reads"
]
.
d
[
"segmented"
],
len
(
self
.
d
[
"clones"
])
)
return
"<ListWindows:
%
s
%
d>"
%
(
self
.
d
[
"reads"
]
.
d
[
"segmented"
],
len
(
self
)
)
# Iterator and access functions
def
__iter__
(
self
):
return
self
.
d
[
"clones"
]
.
__iter__
()
def
__getitem__
(
self
,
i
):
### not efficient !
for
clone
in
self
:
if
clone
.
d
[
"id"
]
==
i
:
return
clone
def
__len__
(
self
):
return
len
(
self
.
d
[
"clones"
])
### print info about each Windows stored
def
info
(
self
):
print
self
for
i
in
range
(
len
(
self
.
d
[
"clones"
]))
:
print
self
.
d
[
"clones"
][
i
]
for
clone
in
self
:
print
clone
### check vidjil_json_version
def
check_version
(
self
,
filepath
):
...
...
@@ -301,8 +314,8 @@ class ListWindows:
ranges
=
[
1000
,
100
,
10
,
1
]
result
=
[[
0
for
col
in
range
(
len
(
self
.
d
[
'reads'
]
.
d
[
"segmented"
]))]
for
row
in
range
(
len
(
ranges
))]
for
w
in
self
.
d
[
"clones"
]
:
for
i
,
s
in
enumerate
(
w
.
d
[
"reads"
]):
for
clone
in
self
:
for
i
,
s
in
enumerate
(
clone
.
d
[
"reads"
]):
for
r
in
range
(
len
(
ranges
)):
if
s
>=
ranges
[
r
]:
break
...
...
@@ -357,9 +370,9 @@ class ListWindows:
def
getTop
(
self
,
top
):
result
=
[]
for
w
in
self
.
d
[
"clones"
]
:
if
w
.
d
[
"top"
]
<=
top
:
result
.
append
(
w
.
d
[
"id"
])
for
clone
in
self
:
if
clone
.
d
[
"top"
]
<=
top
:
result
.
append
(
clone
.
d
[
"id"
])
return
result
def
filter
(
self
,
f
):
...
...
@@ -453,17 +466,16 @@ class ListWindows:
def
cut
(
self
,
limit
,
nb_points
):
'''Remove information from sequence/windows who never enter in the most represented sequences. Put this information in 'other' windows.'''
length
=
len
(
self
.
d
[
"clones"
]
)
length
=
len
(
self
)
w
=
[]
others
=
OtherWindows
(
nb_points
)
for
index
in
range
(
length
):
win
=
self
.
d
[
"clones"
][
index
]
if
(
int
(
win
.
d
[
"top"
])
<
limit
or
limit
==
0
)
:
w
.
append
(
win
)
for
clone
in
self
:
if
(
int
(
clone
.
d
[
"top"
])
<
limit
or
limit
==
0
)
:
w
.
append
(
clone
)
#else:
#others +=
win
#others +=
clone
self
.
d
[
"clones"
]
=
w
#+ list(others)
...
...
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