Skip to content

Commit 34ce9b6

Browse files
authored
Merge pull request #33 from brain-image-library/25-new-metric-request-get-json-file
New metric request - get json file #25
2 parents 569a9e2 + 73375a9 commit 34ce9b6

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

braininventory/get.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,13 @@ def __get_cnbtaxonomy(df):
528528
return df["cnbtaxonomy"].value_counts().to_dict()
529529

530530

531+
def __get_genotypes(df):
532+
"""
533+
Write documentation here.
534+
"""
535+
return df["genotype"].unique()
536+
537+
531538
def __get_genotype_frequency(df):
532539
"""
533540
Get a dictionary containing the count of occurrences of each unique genotype.
@@ -811,24 +818,18 @@ def __get_project_names(df):
811818

812819
def __get_list_of_projects(df):
813820
"""
814-
Get the list of names for unique projects
815-
816-
Input parameter: dataframe
817-
Output: list of projects
818-
"""
819-
820-
return df["project"].unique().to_dict()
821-
822-
823-
def __get_number_of_projects(df):
821+
Retrieve the json_file from the Brain Image Library of a dataset.
824822
"""
825-
Get the number of unique projects
826823

827-
Input parameter: dataframe
828-
Output: number of projects
829-
"""
824+
# Make sure there is data to request
825+
if df["score"].values[0] != 0:
826+
# Create working link
827+
url = df["json_file"].values[0].replace("/bil/data", link)
828+
response = requests.get(url)
830829

831-
return len(df["project"].unique())
830+
return response.json()
831+
else:
832+
return None
832833

833834

834835
def get_projects_treemap(df):

0 commit comments

Comments
 (0)