Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
pyiricdata
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
bioinfo_iric
pyiricdata
Commits
2e8bb127
Commit
2e8bb127
authored
4 years ago
by
Albert Feghaly
Browse files
Options
Downloads
Patches
Plain Diff
Allow datafile selection with filter on filename
parent
8049ef60
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!15
Resolve "Retrieve a file metadata searching by filename"
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
pyiricdata/Client.py
+13
-6
13 additions, 6 deletions
pyiricdata/Client.py
with
13 additions
and
6 deletions
pyiricdata/Client.py
+
13
−
6
View file @
2e8bb127
...
...
@@ -191,13 +191,20 @@ class Client:
# df.index.name = 'ID'
return
(
self
.
get_list_datafiles
(
dataset_id
=
dataset_id
))
"""
Get DatasetId by name
"""
def
get_dataset_id_by_name
(
self
,
name
):
return
self
.
datasets
.
loc
[
self
.
datasets
.
dataset_name
==
name
,
'
dataset_slug
'
][
0
]
"""
Get a subset of the available datasets for which there is a match
"""
def
filter_datasets
(
self
,
term
,
exact_match
=
False
):
if
exact_match
:
return
self
.
datasets
[
self
.
datasets
.
dataset_name
.
str
.
fullmatch
(
term
)]
else
:
return
self
.
datasets
[
self
.
datasets
.
dataset_name
.
str
.
contains
(
term
)]
"""
Get a subset of the available datasets for which name match a given term
"""
def
search_dataset_names
(
self
,
term
):
return
self
.
datasets
.
loc
[
self
.
datasets
.
dataset_name
.
str
.
contains
(
term
),:]
def
filter_datafiles
(
self
,
term
,
exact_match
=
False
,
**
kwargs
):
# kwargs refer to get_list_datafiles arguments
df
=
self
.
get_list_datafiles
(
**
kwargs
)
print
(
df
)
if
exact_match
:
return
df
[
df
.
filename
.
str
.
fullmatch
(
term
)]
else
:
return
df
[
df
.
filename
.
str
.
contains
(
term
)]
"""
Download file according to file_id
"""
def
dwnl_file_content
(
self
,
file_id
,
folder_out
=
''
,
filename
=
''
):
...
...
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