Skip to content
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

Deploy recent bug fixes to production #824

Merged
merged 9 commits into from
Nov 28, 2024
2 changes: 1 addition & 1 deletion app/FieldName.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
}
}
9 changes: 8 additions & 1 deletion app/Http/Controllers/SampleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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) {
Expand All @@ -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;
Expand Down
5 changes: 0 additions & 5 deletions app/RestService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
42 changes: 27 additions & 15 deletions app/Sample.php
Original file line number Diff line number Diff line change
Expand Up @@ -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') {
Expand Down
3 changes: 2 additions & 1 deletion resources/views/footer_detailed.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<p>
The iReceptor Gateway integrates large, distributed, AIRR-seq data repositories, following standards for sharing and interoperability developed by the
<a href="http://airr-community.org/">Adaptive Immune Receptor Repertoire (AIRR) Community</a>.
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.
</p>
<p>Present functionalities include:</p>
<ul>
Expand All @@ -28,6 +28,7 @@
<li><strong>Download Sequences, Clones, Cells</strong> and their related Repertoire metadata in AIRR compliant file formats, easily importable to other AIRR-seq analysis tools</li>
<li><strong>Analyze Sequences, Clones, Cells</strong> and their related Repertoire metadata using <strong>community built analysis tools</strong>.</li>
</ul>
<p>iReceptor is a collaborator in the <a href="https://airr-knowledge.org/">AIRR Knowledge Commons</a>, funded by a U24 (U24AI177622) from the <a href="http://www.niaid.nih.gov/">National Institute of Allergy and Infectious Diseases</a>, a component of the US <a href="https://www.nih.gov/">National Institutes of Health.</a></p>
<p>iReceptor was a leading member of the CIHR/EU Horizon 2020 funded <a href="http://www.ireceptor-plus.com/">iReceptor Plus Consortium</a>.</p>

<p>For more information, see the <a href="http://www.ireceptor.org/">iReceptor public website</a> or refer to the paper <a href="http://doi.org/10.1111/imr.12666">iReceptor: a platform for querying and analyzing antibody/B-cell and T-cell receptor repertoire data across federated repositories</a>. If you are interested in hosting a data repository or if you want to provide feedback on this developing community resource, email <a href="mailto:[email protected]">[email protected]</a>.</p>
Expand Down
6 changes: 6 additions & 0 deletions resources/views/sample.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,12 @@
</div>
</div>

<div class="form-group">
{{ Form::label('age_unit_id', __('short.age_unit_id')) }}
@include('help', ['id' => 'age_unit_id'])
{{ Form::select('age_unit_id[]', $subject_age_unit_ontology_list, '', array('class' => 'form-control multiselect-ui', 'multiple' => 'multiple')) }}
</div>

<div class="form-group">
{{ Form::label('disease_diagnosis', __('short.disease_diagnosis')) }}
@include('help', ['id' => 'disease_diagnosis'])
Expand Down
Loading