-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
resolved issue #5 #6
base: master
Are you sure you want to change the base?
Changes from 7 commits
314e72f
a7d89f6
9836504
1f6e26e
c8810a3
0f7bba1
5d24ab9
23e489f
de93d11
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -228,6 +228,7 @@ def search(endpoint, in_filter={}, exclude_filter={}, fields=[], expand=[], | |
response = requests.post(url, data=payload) | ||
else: | ||
response = requests.get(url, params=payload) | ||
|
||
if response.status_code == 200: | ||
results = response.json()['data']['hits'] | ||
if typ.lower() == 'json': | ||
|
@@ -376,8 +377,11 @@ def get_project_info(projects=None): | |
project_df = search('projects', in_filter=in_filter, | ||
fields=['name', 'primary_site', 'project_id', | ||
'program.name']) | ||
return project_df.set_index('id') | ||
|
||
if(project_df.empty==False): | ||
return project_df.set_index('id') | ||
else: | ||
return project_df | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this function should just return There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yunhailuo so you mean to return project_df itself? I mean the other functions would get changed where we were using project_df.set_index('id') state of dataframe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @arp95 Exactly. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yunhailuo Thanks for clearing out. Working on it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @yunhailuo if the project_df returned is null, then should I remove that project from projects array in gdc2xena file or just leave it empty? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
def get_samples_clinical(projects=None): | ||
"""Get info for all samples of ``projects`` and clinical info for all | ||
|
@@ -431,7 +435,11 @@ def main(): | |
print('A simple python module providing selected GDC API functionalities.') | ||
|
||
# Simple test | ||
print(get_project_info(['TCGA-THCA']).head()) | ||
df = get_project_info() | ||
if(df.empty==False): | ||
print(df.head()) | ||
else: | ||
print("Empty dataframe!") | ||
|
||
|
||
if __name__ == '__main__': | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prefer not to have whitespace changes if not necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure. will change that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed white space.