dnanexus / UKB_RAP

Access share reviewed code & Jupyter Notebooks for use on the UK Biobank (UKBB) Research Application Platform. Includes resources from DNAnexus webinars, online trainings and workshops.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

List out of range for Data-Field 2090

zillurbmb51 opened this issue · comments

Hi,
I have created two cohorts using cohort browser namely "exome_natd_case" and " exome_natd_control" for the above mentioned data field. I can load them using dxdata.load_cohort

case = dxdata.load_cohort("exome_natd_case")  
cont = dxdata.load_cohort("exome_natd_control")  
case
<dxdata.dashboard.base.CohortQuery at 0x7fe64e61c0b8>

But when I try to retrieve field description I am getting the following attached error: list out of range ![list_out_of_index_dxdata](https://user-images.githubusercontent.com/12833907/154571422-1fbe0b3f-3b03-48e2-99eb-4d15cfcb4baf.png)
Any help on this matter?

Hello,

Did you specify working with Cohort when you tried to retrieve fields? Please see a code snippet below.

Load your pre-filtered cohort

cohort = dxdata.load_cohort(folder="/", name="cohort") #select your cohort name or use - id="record-xxx" - instead

Retrieve the fields from the original dataset -filter_sql- defines your participants and -names- the field names of your interest

df = participant.retrieve_fields(names=field_names, filter_sql=cohort.sql, engine=dxdata.connect())
df.show(5, truncate=False)

Hi,

Another possible cause of this failure could be that one of the other fields (in the field_ids) is probably not in scope for the application (or you have made some other typo in the number), and likely fields_for_id(f) returns an empty array for that field, hence [0] is out of range.

I hope this helps. If you have any questions or you need any assistance in then future, please send them to support@dnanexus.com and our Support Team will assist you.