Skip to content

Commit

Permalink
Merge pull request #8 from chrovis/feature/signature-db-loader
Browse files Browse the repository at this point in the history
Add signature database loader with COSMIC style
  • Loading branch information
iku000888 authored Jun 29, 2022
2 parents 5603f02 + 338c3a9 commit 2404c20
Show file tree
Hide file tree
Showing 13 changed files with 275 additions and 237 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: format

on: [push, pull_request]

jobs:
format:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'adopt'
architecture: x64
- name: Cache m2 repository
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-m2-
- name: Install dependencies
run: lein deps
- name: Run cljfmt
run: lein cljfmt check
20 changes: 20 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: lint

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name : master base sha
id : master_base_sha
if : github.ref == 'refs/heads/master'
run: echo "::set-output name=base_sha::${{ github.event.before }}"
- uses: xcoo/[email protected]
with:
linters: "[\"clj-kondo\" \"kibit\" \"eastwood\"]"
github_token: ${{ secrets.GITHUB_TOKEN }}
runner: ":leiningen"
base_sha: ${{ github.event.pull_request.base.sha||steps.master_base_sha.outputs.base_sha }}
eastwood_linters: "[:all]"
37 changes: 37 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: main

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11', '16', '17']
clojure: [ '1.9', '1.10', '1.11' ]
steps:
- uses: actions/checkout@v3
- name: Setup Java
uses: actions/setup-java@v3
with:
java-version: ${{ matrix.java }}
distribution: 'adopt'
architecture: x64
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: latest
- name: Cache m2 repository
uses: actions/cache@v3
with:
path: ~/.m2
key: ${{ runner.os }}-m2-${{ hashFiles('**/project.clj') }}
restore-keys: |
${{ runner.os }}-m2-
- name: Install dependencies
run: |
lein deps
- name: Run tests
run: |
lein with-profile +dev:+${{ matrix.clojure }} test
lein with-profile +dev,+${{ matrix.clojure }} doo node test once
24 changes: 0 additions & 24 deletions .travis.yml

This file was deleted.

21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@

# clj-deconstruct-sigs

![Mutational Signature](https://cancer.sanger.ac.uk/signatures/Signature-1.png "Mutational Signature")
![Mutational Signature](docs/img/v3.2_SBS3_PROFILE_GA_GRCh37_ygeJJyb.original.jpg "Mutational Signature")

clj-deconstruct-sigs is a Clojure port of [deconstructSigs](https://github.com/raerose01/deconstructSigs).

## What are Mutational Signatures?

A comprehensive description can be found [here](https://cancer.sanger.ac.uk/cosmic/signatures).
You can find a comprehensive description [here](https://cancer.sanger.ac.uk/cosmic/signatures).
In short, treating an individual's somatic mutation pattern as a combination of known distinct signatures could lead to insights of cancer's characteristics.

## Usage
Expand All @@ -19,15 +19,15 @@ The main function is `clj-deconstruct-sigs.core/which-signatures`, which takes a

```
:seed-idx - Index of the signature that was used as the initial seed
:weights - A map of weight indices to weight. :weights* with zero contribution entries
:weights* - A map of non-zero weight indices to weight. Note that entries that have zero contribution will be missing.
:weights - A map of weight indices to weight.
:weights-with-names - A map of weight that associated signature names as key on behalf of indices.
:product - matrix product of :weights and the provided signatures
:unknown - 1 minus the sum of weights
:diff - element wise difference of the provided sample tumor and the product
:error-sum - Square root of the sum of the element wise square of :diff. Indicates how close the :product is from the original input
```

Here is a repl session that adds more context.
Here is a REPL session that adds more context.

```clojure
(require '[clj-deconstruct-sigs.core :refer :all])
Expand All @@ -39,13 +39,14 @@ Here is a repl session that adds more context.
;; Reference set of signatures to use, represented with m rows x 96 columns.
;; This library provides cosmic.signature-data.generated/latest-cosmic-signatures which is based on parsing the latest
;; signatures at https://cancer.sanger.ac.uk/cancergenome/assets/signatures_probabilities.txt
(require '[clj-deconstruct-sigs.data.cosmic])
(require '[clj-deconstruct-sigs.db])
(def cosmic-signatures (clj-deconstruct-sigs.db/load-signature-database "dev-resources/COSMIC_v3.2_SBS_GRCh38.txt"))

(which-signatures sample-tumor clj-deconstruct-sigs.data.cosmic/cosmic-signatures)
(which-signatures sample-tumor cosmic-signatures)
=>
{:seed-idx 25,
:weights {7 0.36016636298023036,...},
:weights* {0 0.0, ...},
:weights {0 0.36016636298023036,...},
:weights-with-names {"SBS1" 0.36016636298023036,...},
:product [6.690145741717268E-4,...],
:unknown 0.09329024976612943,
:diff [6.451870662289333E-4,...],
Expand All @@ -54,6 +55,6 @@ Here is a repl session that adds more context.

## License

Copyright 2019 [Xcoo, Inc.](https://xcoo.jp/)
Copyright 2019-2022 [Xcoo, Inc.](https://xcoo.jp/)

Licensed under the [Apache License, Version 2.0](LICENSE).
Loading

0 comments on commit 2404c20

Please sign in to comment.