diff --git a/app/FieldName.php b/app/FieldName.php index 9784c9cb..7f6e2d81 100644 --- a/app/FieldName.php +++ b/app/FieldName.php @@ -265,6 +265,6 @@ public static function getAPIVersions() public static function getOntologyFields() { - return ['tissue_id', 'organism_id', 'study_type_id', 'disease_diagnosis_id', 'cell_subset_id', 'collection_time_point_relative_unit_id', 'template_amount_unit_id']; + return ['tissue_id', 'organism_id', 'study_type_id', 'age_unit_id', 'disease_diagnosis_id', 'cell_subset_id', 'collection_time_point_relative_unit_id', 'template_amount_unit_id']; } } diff --git a/app/Http/Controllers/SampleController.php b/app/Http/Controllers/SampleController.php index 82df22b2..a4f3e94c 100644 --- a/app/Http/Controllers/SampleController.php +++ b/app/Http/Controllers/SampleController.php @@ -14,7 +14,7 @@ class SampleController extends Controller { - protected const DEFAULT_FIELDS = ['full_text_search', 'study_id', 'study_title', 'study_type_id', 'study_group_description', 'lab_name', 'subject_id', 'organism_id', 'sex', 'ethnicity', 'ir_subject_age_min', 'ir_subject_age_max', 'disease_diagnosis_id', 'sample_id', 'pcr_target_locus', 'cell_subset_id', 'tissue_id', 'template_class', 'cell_phenotype', 'sequencing_platform']; + protected const DEFAULT_FIELDS = ['full_text_search', 'study_id', 'study_title', 'study_type_id', 'study_group_description', 'lab_name', 'subject_id', 'organism_id', 'sex', 'ethnicity', 'ir_subject_age_min', 'ir_subject_age_max', 'age_unit_id', 'disease_diagnosis_id', 'sample_id', 'pcr_target_locus', 'cell_subset_id', 'tissue_id', 'template_class', 'cell_phenotype', 'sequencing_platform']; protected $extra_fields = []; public function __construct() @@ -191,6 +191,12 @@ public function index(Request $request, $type = '') $dna_type_list[$v] = $v; } + // age_unit ontology info + $subject_age_unit_ontology_list = []; + foreach ($metadata['age_unit_id'] as $v) { + $subject_age_unit_ontology_list[$v['id']] = $v['label'] . ' (' . $v['id'] . ')'; + } + // disease_diagnosis ontology info $subject_disease_diagnosis_ontology_list = []; foreach ($metadata['disease_diagnosis_id'] as $v) { @@ -206,6 +212,7 @@ public function index(Request $request, $type = '') $data['subject_gender_list'] = $subject_gender_list; $data['subject_ethnicity_list'] = $subject_ethnicity_list; $data['subject_organism_ontology_list'] = $subject_organism_ontology_list; + $data['subject_age_unit_ontology_list'] = $subject_age_unit_ontology_list; $data['subject_disease_diagnosis_ontology_list'] = $subject_disease_diagnosis_ontology_list; $data['pcr_target_locus_list'] = $pcr_target_locus_list; $data['cell_type_ontology_list'] = $cell_type_ontology_list; diff --git a/app/RestService.php b/app/RestService.php index bb609263..85e0edd5 100644 --- a/app/RestService.php +++ b/app/RestService.php @@ -269,11 +269,6 @@ public static function generate_json_query($filters, $query_parameters = [], $ap // clean filters $filters = self::clean_filters($filters); - // add "age_unit" filter if "age_min" or "age_max" is set - if (isset($filters['ir_subject_age_min']) || isset($filters['ir_subject_age_max'])) { - $filters['age_unit'] = 'year'; - } - // if API version is 1.0 if ($api_version == '1.0') { $ontology_fields = FieldName::getOntologyFields(); diff --git a/app/Sample.php b/app/Sample.php index 53b6bfd4..96a58bd6 100644 --- a/app/Sample.php +++ b/app/Sample.php @@ -811,23 +811,35 @@ public static function sort_sample_list($sample_list, $sort_column, $sort_order) } } - $val1 = $a->{$sort_column}; - $val2 = $b->{$sort_column}; - - if (is_array($val1) || is_object($val1) || is_array($val2) || is_object($val2)) { - $val1 = json_encode($val1); - $val2 = json_encode($val2); - $comparison_result = strcasecmp($val1, $val2); - } elseif ($field_type == 'integer' || $field_type == 'number') { - if ($val1 == $val2) { - $comparison_result = 0; - } elseif ($val1 < $val2) { - $comparison_result = -1; + if (! isset($a->{$sort_column}) && (! isset($b->{$sort_column}))) { + // If they are both not set they are equal + $comparison_result = 0; + } elseif (! isset($a->{$sort_column})) { + // If a is not set and b is, then a < b + $comparison_result = -1; + } elseif (! isset($b->{$sort_column})) { + // If b is not set then a > b + $comparison_result = 1; + } else { + // If we get here, both are set. + $val1 = $a->{$sort_column}; + $val2 = $b->{$sort_column}; + + if (is_array($val1) || is_object($val1) || is_array($val2) || is_object($val2)) { + $val1 = json_encode($val1); + $val2 = json_encode($val2); + $comparison_result = strcasecmp($val1, $val2); + } elseif ($field_type == 'integer' || $field_type == 'number') { + if ($val1 == $val2) { + $comparison_result = 0; + } elseif ($val1 < $val2) { + $comparison_result = -1; + } else { + $comparison_result = 1; + } } else { - $comparison_result = 1; + $comparison_result = strcasecmp($val1, $val2); } - } else { - $comparison_result = strcasecmp($val1, $val2); } if ($sort_order == 'desc') { diff --git a/resources/views/footer_detailed.blade.php b/resources/views/footer_detailed.blade.php index 8bf16833..f3a0ebfe 100644 --- a/resources/views/footer_detailed.blade.php +++ b/resources/views/footer_detailed.blade.php @@ -16,7 +16,7 @@
The iReceptor Gateway integrates large, distributed, AIRR-seq data repositories, following standards for sharing and interoperability developed by the Adaptive Immune Receptor Repertoire (AIRR) Community. - The main goal of iReceptor is to connect this distributed network of AIRR-seq repositories into an AIRR Data Commons, allowing for the query, analysis, and visualization of AIRR-seq data across multiple projects, labs, and institutions. + The main goal of iReceptor is to connect the distributed network of AIRR-seq repositories in the AIRR Data Commons, allowing for the query, analysis, and visualization of AIRR-seq data across multiple projects, labs, and institutions.
Present functionalities include:
iReceptor is a collaborator in the AIRR Knowledge Commons, funded by a U24 (U24AI177622) from the National Institute of Allergy and Infectious Diseases, a component of the US National Institutes of Health.
iReceptor was a leading member of the CIHR/EU Horizon 2020 funded iReceptor Plus Consortium.
For more information, see the iReceptor public website or refer to the paper iReceptor: a platform for querying and analyzing antibody/B-cell and T-cell receptor repertoire data across federated repositories. If you are interested in hosting a data repository or if you want to provide feedback on this developing community resource, email support@ireceptor.org.
diff --git a/resources/views/sample.blade.php b/resources/views/sample.blade.php index 6623c08d..08f2d2e8 100644 --- a/resources/views/sample.blade.php +++ b/resources/views/sample.blade.php @@ -127,6 +127,12 @@ +