<jupyter_start><jupyter_text>NIAID DATA HUB: CHARLIE (MACS/WIHS) Data Analysis  Data Exploration using GraphQL queries (Python library) GraphQL queries can be used as a baseline to create high-level libraries and explore the metadata in BHC. The Python library created for this data analysis can be accessed from:https://github.com/uc-cdis/ndh-demo/blob/master/demo/ndh_analysis_functions.py<jupyter_code>%matplotlib inline
!pip install matplotlib==2.2.4
!pip install lifelines
import nde_aids_function as nde
nde.add_keys("/home/jovyan/pd/credentials.json")
project_id = "HIV-CHARLIE"<jupyter_output><empty_output><jupyter_text>Get summary counts for one specific variable: Visualize the counts we get for the HIV status variable:<jupyter_code>summary = nde.query_summary_field(project_id, "subject", "hiv_status")<jupyter_output><empty_output><jupyter_text>CHARLIE SCIENTIFIC USER CASES The following part of the demo is focused on answering some specific scientific questions based on the data currently available at the **NIAID Data Hub**  **Scientific User Case 1:** Is the number of CD4 positive cells significantly different immediately after seropositive conversion? Compare the values for the **number of CD4 positive cells** between the last seronegative visit and the first seropositive visit. A **Wilcoxon rank-sum test** is applied to determine statistically significant differences.<jupyter_code>values = nde.compare_lab_results(project_id, "leu3n", "# of CD4 positive cells")<jupyter_output><empty_output><jupyter_text>**Scientific User Case 2:** Is the viral load significantly different immediately after seropositive conversion? Compare the values for the **viral load** between the last seronegative visit and the first seropositive visit. A **Wilcoxon rank-sum test** is applied to determine statistically significant differences.<jupyter_code>values = nde.compare_lab_results(project_id, "viral_load", "Viral load (copies/ml)")<jupyter_output><empty_output><jupyter_text>Scientific User Case 3: Are viral load and CD4+ cells controlled when subject are HAART treated? Compare the values for the **viral load** and **CD4 positive cells** across the time in different visits to visualize the effect of HAART treatment. We compare values before/after first HAART treatment as well as 1, 2 and 3 years after that. A **Wilcoxon rank-sum test** is applied to determine statistically significant differences.<jupyter_code>values = nde.compare_after_haart(project_id, "viral_load", "Viral load (copies/ml)")
values = nde.compare_after_haart(project_id, "leu3n", "# of CD4 positive cells")<jupyter_output><empty_output><jupyter_text>Scientific User Case 4: How survival change when using HAART treatment? Determine the **Kaplan-Meier survival curves** under the condition of **ever had HAART treatment**. Survival time is calculated as the different (in years) between first year seen seropositive and year of death (if vital status is not *Alive*).<jupyter_code>values = nde.compare_survival(project_id, "MACS", "ehaart", "Survival curves based on HAART treatment")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07850707850707851, 'fraction_numerical': 0.005791505791505791, 'mean_word_length': 6.831234256926952, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '97207', 'license': 'Apache-2.0', 'n_tokens_mistral': 915, 'n_tokens_neox': 867, 'n_words': 340, 'path': 'demo/DAIDS_notebook/nde_aids_pynb.ipynb', 'repo_name': 'uc-cdis/ndh-demo', 'size': '3108'}