|
9 | 9 | from django.db.models import prefetch_related_objects |
10 | 10 |
|
11 | 11 | from reference_data.models import HumanPhenotypeOntology |
12 | | -from seqr.models import Individual, Family, RnaSample, CAN_VIEW |
| 12 | +from seqr.models import Individual, Family, CAN_VIEW |
13 | 13 | from seqr.utils.file_utils import file_iter |
14 | 14 | from seqr.utils.gene_utils import get_genes, get_gene_ids_for_gene_symbols |
15 | | -from seqr.utils.logging_utils import SeqrLogger |
16 | 15 |
|
17 | 16 | from seqr.views.utils.anvil_metadata_utils import PARTICIPANT_TABLE, PHENOTYPE_TABLE, EXPERIMENT_TABLE, \ |
18 | 17 | EXPERIMENT_LOOKUP_TABLE, FINDINGS_TABLE, FINDING_METADATA_COLUMNS, TRANSCRIPT_FIELDS, GENE_COLUMN, parse_population |
19 | | -from seqr.views.utils.dataset_utils import post_process_rna_data, RNA_DATA_TYPE_CONFIGS |
20 | | -from seqr.views.utils.file_utils import save_uploaded_file, load_uploaded_file, parse_file, get_temp_file_path |
21 | | -from seqr.views.utils.json_to_orm_utils import update_individual_from_json, update_model_from_json |
| 18 | +from seqr.views.utils.file_utils import save_uploaded_file, load_uploaded_file, parse_file |
| 19 | +from seqr.views.utils.json_to_orm_utils import update_individual_from_json |
22 | 20 | from seqr.views.utils.json_utils import create_json_response, _to_snake_case, _to_camel_case |
23 | 21 | from seqr.views.utils.orm_to_json_utils import _get_json_for_model, _get_json_for_individuals, add_individual_hpo_details, \ |
24 | 22 | _get_json_for_families, get_json_for_rna_seq_outliers, get_project_collaborators_by_username, INDIVIDUAL_DISPLAY_NAME_EXPR, \ |
|
32 | 30 | from seqr.views.utils.individual_utils import delete_individuals, add_or_update_individuals_and_families |
33 | 31 | from seqr.views.utils.variant_utils import bulk_create_tagged_variants |
34 | 32 |
|
35 | | -logger = SeqrLogger(__name__) |
36 | 33 |
|
37 | 34 | @login_and_policies_required |
38 | 35 | def update_individual_handler(request, individual_guid): |
@@ -948,30 +945,3 @@ def get_hpo_terms(request, hpo_parent_id): |
948 | 945 | for hpo in HumanPhenotypeOntology.objects.filter(parent_id=hpo_parent_id) |
949 | 946 | } |
950 | 947 | }) |
951 | | - |
952 | | - |
953 | | -@pm_or_data_manager_required |
954 | | -def load_rna_seq_sample_data(request, sample_guid): |
955 | | - sample = RnaSample.objects.get(guid=sample_guid) |
956 | | - logger.info(f'Loading outlier data for {sample.individual.individual_id}', request.user) |
957 | | - |
958 | | - request_json = json.loads(request.body) |
959 | | - file_name = request_json['fileName'] |
960 | | - data_type = request_json['dataType'] |
961 | | - config = RNA_DATA_TYPE_CONFIGS[data_type] |
962 | | - |
963 | | - file_path = get_temp_file_path(f'{file_name}/{sample_guid}.json.gz') |
964 | | - try: |
965 | | - data_rows = [json.loads(line) for line in file_iter(file_path, user=request.user)] |
966 | | - data_rows, error = post_process_rna_data(sample_guid, data_rows, **config.get('post_process_kwargs', {})) |
967 | | - except FileNotFoundError: |
968 | | - logger.error(f'No saved temp data found for {sample_guid} with file prefix {file_name}', request.user) |
969 | | - error = 'Data for this sample was not properly parsed. Please re-upload the data' |
970 | | - if error: |
971 | | - return create_json_response({'error': error}, status=400) |
972 | | - |
973 | | - model_cls = config['model_class'] |
974 | | - model_cls.bulk_create(request.user, [model_cls(sample=sample, **data) for data in data_rows], batch_size=1000) |
975 | | - update_model_from_json(sample, {'is_active': True}, user=request.user) |
976 | | - |
977 | | - return create_json_response({'success': True}) |
0 commit comments