Synchronize a copied app with its parent app

This call synchronizes a copied app with the source app from which it has been copied. For example, when FASTQC is copied from public apps to a project and updates are made to FASTQC in the public apps gallery (there are new revisions), this action fetches all revisions and revision notes from the updated parent app and applies them to your copied app. Once this has been done, the copied app is updated to the latest revision and includes the complete revision history of its parent app, following the logic of the git pull command.

https://api.sbgenomics.com/v2/apps/{app_id}/actions/sync
https://eu-api.sbgenomics.com/v2/apps/{app_id}/actions/sync

👍

app_ids

Recall from the apps section in the API overview that the app_id has the form {project_owner}/{project}/{app_short_name}/{revision_number}.

Request

Example request

POST v2/apps/rfranklin/test-project/bamtools-index-2-4-0/actions/sync HTTP/1.1
Host: api.sbgenomics.com
X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74
curl --data '{"username": "rfranklin", "permissions": { "read": true, "write": true, "execute": false}}' -s -H "X-SBG-Auth-Token: 3259c50e1ac5426ea8f1273259740f74" -H "content-type: application/json" -X POST "https://api.sbgenomics.com/v2/apps/rfranklin/test-project/bamtools-index-2-4-0/actions/sync"
from sevenbridges import Api

api = Api(url='https://api.sbgenomics.com/v2',
          token='3259c50e1ac5426ea8f1273259740f74')

app = api.apps.get(id='rfranklin/test-project/bamtools-index-2-4-0')

# send POST request to SB API
app.sync()

print(app.revision)

Header Fields

Name

Description

X-SBG-Auth-Token
required

Your Seven Bridges Platform authentication token.

Path parameters

Name

Description

app_id

The ID of the app you want to update. It should reference the project owner, the project that your app is copied to, and the app's short name (containing no non-alphanumeric characters or spaces).

Query parameters

Name

Data type

Description

fields

string

Selector specifying a subset of fields to include in the response.

Response

See a list of Seven Bridges Platform-specific response codes that may be contained in the body of the response.

Example response body

{
  "href": "https://api.sbgenomics.com/v2/apps/rfranklin/test-project/bamtools-index-2-4-0/1",
  "id": "rfranklin/test-project/bamtools-index-2-4-0/1",
  "project": "rfranklin/test-project",
  "name": "BamTools Index",
  "revision": 1,
  "raw": {
    "sbg:sbgMaintained": false,
    "requirements": [
      {
        "class": "ExpressionEngineRequirement",
        "id": "#cwl-js-engine",
        "requirements": [
          {
            "class": "DockerRequirement",
            "dockerPull": "rabix/js-engine"
          }
        ]
      }
    ],
    "sbg:modifiedOn": 1494849814,
    "outputs": [
      {
        "label": "Output BAM file",
        "sbg:fileTypes": "BAM",
        "description": "Output BAM file with index (BAI or BTI) file as a secondary file (not visible in the output list of the task).",
        "id": "#output_bam_file",
        "type": [
          "null",
          "File"
        ],
        "outputBinding": {
          "glob": {
            "class": "Expression",
            "engine": "#cwl-js-engine",
            "script": "{\n  if ($job.inputs.indexed_data === true){\n\treturn ''\n  } else {\n    return $job.inputs.input_bam_file.path.split(\"/\").pop()\n  }\n}\n\n\n"
          },
          "secondaryFiles": [
            ".bai",
            ".bti"
          ],
          "sbg:inheritMetadataFrom": "#input_bam_file"
        }
      },
      {
        "label": "Generated Index File",
        "sbg:fileTypes": "BAI,BTI",
        "description": "Generated index file (without the indexed data).",
        "id": "#generated_index",
        "type": [
          "null",
          "File"
        ],
        "outputBinding": {
          "glob": "{*.bai,*.bti}",
          "sbg:inheritMetadataFrom": "#input_bam_file"
        }
      }
    ],
    "sbg:toolAuthor": "Derek Barnett, Erik Garrison, Gabor Marth, and Michael Stromberg",
    "sbg:revisionsInfo": [
      {
        "sbg:modifiedOn": 1494849680,
        "sbg:modifiedBy": "rfranklin",
        "sbg:revision": 0,
        "sbg:revisionNotes": "Copy of rfranklin/bam-test/bamtools-index-2-4-0/0"
      },
      {
        "sbg:modifiedOn": 1494849814,
        "sbg:modifiedBy": "rfranklin",
        "sbg:revision": 1,
        "sbg:revisionNotes": "Modified output description."
      }
    ],
    "sbg:categories": [
      "SAM/BAM-Processing",
      "Indexing"
    ],
    "sbg:modifiedBy": "rfranklin",
    "sbg:image_url": null,
    "sbg:appVersion": [
      "sbg:draft-2"
    ],
    "sbg:createdBy": "rfranklin",
    "sbg:copyOf": "rfranklin/bam-test/bamtools-index-2-4-0/1",
    "stdout": "",
    "sbg:latestRevision": 1,
    "temporaryFailCodes": [],
    "sbg:job": {
      "inputs": {
        "bti_format": false,
        "input_bam_file": {
          "class": "File",
          "size": 0,
          "secondaryFiles": [],
          "path": "input/input_bam.bam"
        },
        "indexed_data": false
      },
      "allocatedResources": {
        "cpu": 1,
        "mem": 1000
      }
    },
    "successCodes": [],
    "sbg:links": [
      {
        "label": "Homepage",
        "id": "https://github.com/pezmaster31/bamtools"
      },
      {
        "label": "Wiki",
        "id": "https://github.com/pezmaster31/bamtools/wiki"
      }
    ],
    "sbg:revisionNotes": "Modified output description.",
    "label": "BamTools Index",
    "cwlVersion": "sbg:draft-2",
    "sbg:homepage": "https://github.com/pezmaster31/bamtools/wiki",
    "sbg:cmdPreview": "/opt/bamtools/bin/bamtools index  -in input_bam.bam",
    "stdin": "",
    "sbg:id": "rfranklin/test-project/bamtools-index-2-4-0/1",
    "hints": [
      {
        "class": "DockerRequirement",
        "dockerPull": "images.sbgenomics.com/markop/bamtools:2.4.0",
        "dockerImageId": "f808163d4cd3"
      },
      {
        "class": "sbg:CPURequirement",
        "value": 1
      },
      {
        "class": "sbg:MemRequirement",
        "value": 1000
      }
    ],
    "sbg:toolkitVersion": "2.4.0",
    "sbg:license": "The MIT License",
    "sbg:toolkit": "BamTools",
    "sbg:validationErrors": [],
    "class": "CommandLineTool",
    "inputs": [
      {
        "sbg:category": "Input & Output",
        "label": "Input BAM file",
        "sbg:fileTypes": "BAM",
        "id": "#input_bam_file",
        "description": "The input BAM file.",
        "type": [
          "File"
        ],
        "sbg:stageInput": "link"
      },
      {
        "sbg:category": "Input & Output",
        "description": "Create (non-standard) BamTools index file (*.BTI). Default behavior is to create standard BAM index (*.BAI).",
        "type": [
          "null",
          "boolean"
        ],
        "label": "BTI format",
        "id": "#bti_format"
      },
      {
        "sbg:category": "File input",
        "label": "Input BAI(BAM index) file",
        "sbg:fileTypes": "BAI",
        "id": "#input_bai_file",
        "description": "Input BAI(BAM index) file.",
        "type": [
          "null",
          "File"
        ],
        "sbg:stageInput": "link"
      },
      {
        "sbg:category": "Input & Output",
        "description": "Don't output indexed data file. The default value is [FALSE].",
        "type": [
          "null",
          "boolean"
        ],
        "label": "Don't output indexed data file",
        "id": "#indexed_data"
      }
    ],
    "sbg:createdOn": 1494849680,
    "arguments": [
      {
        "valueFrom": {
          "class": "Expression",
          "engine": "#cwl-js-engine",
          "script": "{\n  if (!(typeof $job.inputs.input_bai_file !== \"undefined\")){\n    return \"-in \" + $job.inputs.input_bam_file.path.split('/').pop() \n  }\n}"
        },
        "position": 0,
        "separate": true
      },
      {
        "valueFrom": {
          "class": "Expression",
          "engine": "#cwl-js-engine",
          "script": "{\n  if (!(typeof $job.inputs.input_bai_file !== \"undefined\"))\n    if ((typeof $job.inputs.bti_format !== \"undefined\") && ($job.inputs.bti_format))\n    \treturn \"-bti\"  \n}"
        },
        "position": 1,
        "separate": true
      }
    ],
    "description": "BamTools Index creates an index file (BAI or BTI) for a BAM file. If BAI file is present on the input the tool will skip indexing step and output BAM with provided BAI file.\n\n**Common issues:** Providing a BAI file on input will result in a pass-through without execution, even if a different index format is requested on the output (BTI instead of BAI).",
    "sbg:contributors": [
      "rfranklin"
    ],
    "id": "https://api.sbgenomics.com/v2/apps/rfranklin/test-project/bamtools-index-2-4-0/1/raw/",
    "baseCommand": [
      {
        "class": "Expression",
        "engine": "#cwl-js-engine",
        "script": "{\n  if ($job.inputs.input_bai_file){\n \treturn\"echo Skipping index step because BAI file is provided on the input.\"\n  }\n  else{\n    return \"/opt/bamtools/bin/bamtools index\"\n  }\n}"
      }
    ],
    "sbg:projectName": "Test Project",
    "sbg:project": "rfranklin/test-project",
    "sbg:revision": 1
  }
}