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.
MIT License
106 stars 45 forks source link

List out of range for Data-Field 2090 #5

Closed zillurbmb51 closed 1 year ago

zillurbmb51 commented 2 years ago

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?

oklempir-cf commented 2 years ago

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.loadcohort(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, filtersql=cohort.sql, engine=dxdata.connect()) df.show(5, truncate=False)

oklempir-cf commented 2 years ago

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.