# Create new analyses

Creates new analyses from uploaded sample files.

This endpoint supports creating:
- Single sample analyses
- Family analyses (with pedigree relationships)

Files must be uploaded to the specified S3 location before calling this endpoint.

Endpoint: POST /v1/analyses/create
Version: 96
Security: bearerAuth

## Security:

  - `bearerAuth` (unknown)
    http bearer JWT

## Request fields (application/json):

  - `upload_specs` (object, required)
    Specifications for file upload location

  - `upload_specs.source` (string, required)
    Source type (typically "AWS", "S3")
    Example: AWS

  - `upload_specs.details` (object, required)
    Details of upload location

  - `upload_specs.details.bucket` (string, required)
    S3 bucket name
    Example: my-org-uploads

  - `upload_specs.details.root_folder` (string, required)
    Root folder path in the bucket
    Example: uploads/2024

  - `family_analyses_creation_specs` (object)
    Options for family analysis creation

  - `family_analyses_creation_specs.create_family_single_analyses` (boolean)
    Whether to create individual single analyses for family members

  - `analyses` (array, required)
    Single sample analyses to create

  - `analyses.assay_id` (string)
    Assay UUID to use for this analysis
    Example: assay-uuid-123

  - `analyses.sample_data` (object, required)
    Sample data for analysis creation

  - `analyses.sample_data.sample_name` (string, required)
    Name for the sample
    Example: Sample_001

  - `analyses.sample_data.name_in_vcf` (string)
    Sample name as it appears in the VCF file
    Example: SAMPLE001

  - `analyses.sample_data.aws_files` (array, required)
    List of files to include

  - `analyses.sample_data.aws_files.key` (string, required)
    S3 key (path) to the file
    Example: uploads/2024/sample_001/sample_001.vcf.gz

  - `analyses.sample_data.aws_files.type` (string, required)
    File type
    Enum: "VCF_SHORT", "VCF_SV", "VCF_LOH", "VCF_RNA", "VCF_REPEATS", "FASTQ", "FASTQ_RNA", "BAM", "BAI", "CSV", "TSV", "BW", "BIGWIG", "ORA", "GFF3", "BED", "JSON", "OTHER"

  - `analyses.sample_data.patient_details` (object)
    Patient/subject details

  - `analyses.sample_data.patient_details.name` (string)
    Patient name
    Example: John Doe

  - `analyses.sample_data.patient_details.dob` (string)
    Date of birth (formats are dd-MM-yyyy, yyyy-MM-dd, dd/MM/yyyy)
    Example: 1990-05-15

  - `analyses.sample_data.patient_details.ethnicity` (string)
    Primary ethnicity (deprecated - use ethnicities)
    Example: European

  - `analyses.sample_data.patient_details.sex` (string)
    Biological sex
    Enum: "male", "female", "unknown"

  - `analyses.sample_data.patient_details.phenotypes` (array)
    HPO terms or phenotype descriptions
    Example: ["HP:0001250","Seizures"]

  - `analyses.sample_data.patient_details.major_phenotypes` (array)
    Subset of phenotypes considered major/primary. Must be a subset of phenotypes.
    Example: ["HP:0001250"]

  - `analyses.sample_data.patient_details.patient_id` (string)
    External patient identifier (e.g., MRN)
    Example: PAT-001

  - `analyses.sample_data.patient_details.ethnicities` (array)
    List of ethnic backgrounds
    Example: ["European","Ashkenazi Jewish"]

  - `analyses.sample_data.patient_details.description` (string)
    Clinical description
    Example: History of epilepsy

  - `analyses.sample_data.patient_details.cancer_type` (string)
    Cancer type (for oncology)
    Example: Breast Cancer

  - `analyses.sample_data.bio_markers` (object)
    Biomarker data (for oncology samples)

  - `analyses.sample_data.bio_markers.tmb` (object)
    Biomarker value and level

  - `analyses.sample_data.bio_markers.tmb.value` (number)
    Numeric value
    Example: 10.5

  - `analyses.sample_data.bio_markers.tmb.level` (string)
    Classification level (e.g., High, Low, Stable)
    Example: High

  - `analyses.sample_data.bio_markers.exon_skipping` (array)

  - `analyses.sample_data.bio_markers.exon_skipping.gene` (string)
    Gene name
    Example: MET

  - `analyses.sample_data.bio_markers.exon_skipping.exon_inclusion_level` (number)
    Exon inclusion level
    Example: 0.15

  - `analyses.sample_data.cancer_type` (string)
    Cancer type (for oncology samples)
    Example: Lung Adenocarcinoma

  - `analyses.sample_data.tissue_type` (string)
    Tissue type
    Example: Tumor

  - `analyses.sample_data.physician` (string)
    Ordering physician
    Example: Dr. Smith

  - `analyses.sample_data.ordering_institution` (string)
    Ordering institution
    Example: Main Hospital

  - `analyses.sample_data.received_at` (string)
    Date sample was received (format is yyyy-MM-dd)
    Example: 2024-01-15

  - `analyses.sample_data.collected_at` (string)
    Date sample was collected (format is yyyy-MM-dd)
    Example: 2024-01-10

  - `analyses.sample_data.order_number` (string)
    Order number
    Example: ORD-2024-001

  - `analyses.sample_data.include_secondary_findings` (boolean)
    Whether to include secondary findings analysis
    Example: true

  - `analyses.sample_data.date_run` (string)
    Date sequencing was run (format is yyyy-MM-dd)
    Example: 2024-01-12

  - `family_analyses` (array)
    Family analyses to create from the uploaded samples

  - `family_analyses.case_name` (string, required)
    Name for the family case
    Example: Family_Smith_Trio

  - `family_analyses.family_samples` (array, required)
    Family members to include

  - `family_analyses.family_samples.sample_name` (string, required)
    Sample name (must match a sample in the analyses array)
    Example: Sample_001

  - `family_analyses.family_samples.family_relation` (string, required)
    Relationship to proband
    Enum: "proband", "father", "mother", "sibling"

  - `family_analyses.family_samples.is_affected` (boolean)
    Whether this family member is affected
    Example: true

  - `family_analyses.phenotypes` (array, required)
    Phenotypes for the proband
    Example: ["HP:0001250"]

  - `family_analyses.major_phenotypes` (array)
    Subset of phenotypes considered major/primary for the proband. Must be a subset of phenotypes.
    Example: ["HP:0001250"]

  - `family_analyses.include_secondary_findings` (boolean)
    Whether to include secondary findings
    Example: true

  - `family_analyses.protocols` (array)
    Analysis protocols to apply
    Example: []

  - `assigned_to` (string)
    Email of user to assign the analyses to
    Example: analyst@example.com

  - `case_order_name` (string)
    Name of case group to associate with these analyses
    Example: Order_2024_001

  - `case_group_name` (string)
    Name of case group to associate with these analyses
    Example: Group_2024_001

## Response 200:

  - `200` (unknown)
    Analyses created successfully

## Response 400:

  - `400` (unknown)
    Bad request - invalid request parameters

## Response 400 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 401:

  - `401` (unknown)
    Authentication failed - invalid or missing token

## Response 401 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 429:

  - `429` (unknown)
    Rate limit exceeded

## Response 429 fields (application/json):

  - `error` (string, required)
    Error type
    Example: Not Found

  - `message` (string, required)
    Human-readable error description
    Example: Analysis with ID 12345 was not found

## Response 429 headers (application/json):

  - `Retry-After` (integer)
    Number of seconds to wait before retrying

