Skip to content

Commit

Permalink
Initial project set up based on https://github.com/nvnieuwk/nft-bam
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrtalbot committed Aug 13, 2024
1 parent 639a84b commit 521503e
Show file tree
Hide file tree
Showing 22 changed files with 447 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
indent_size = 2
indent_style = space

[**pom.xml]
charset = unset
end_of_line = unset
insert_final_newline = unset
trim_trailing_whitespace = unset
indent_style = unset
indent_size = unset
38 changes: 38 additions & 0 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: build docs
on:
push:
branches: [main]
permissions:
contents: write
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all commits/branches
- uses: actions/setup-python@v4
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Obtain version from manifest
run: |
version=$(grep "moduleVersion" src/main/resources/META-INF/nf-test-plugin | sed -e s'/[^=]*=//')
[[ $version == *"dev"* ]] && pipeline_version="dev" || pipeline_version=$version
echo "pipeline_version=$pipeline_version" >> $GITHUB_ENV
- name: Setup git user
run: |
git config --global user.name "${{github.actor}}"
git config --global user.email "${{github.actor}}@users.noreply.github.com"
- uses: actions/cache@v3
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install dependencies
run: pip install mkdocs-material pymdown-extensions pillow cairosvg mike
- name: Build docs
run: mike deploy --push --update-aliases ${{ env.pipeline_version }} latest
- name: Set default docs
run: mike set-default --push latest
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Run plugin tests
on:
push:
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
branches: [main]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
JAVA_VERSION: ["11", "17", "21"]
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4

- name: Setup Java ${{ matrix.JAVA_VERSION }}
uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4
with:
distribution: "temurin"
java-version: "${{ matrix.JAVA_VERSION }}"
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2

- name: Install nf-test
uses: nf-core/setup-nf-test@v1

- name: Build plugin
run: ./build.sh

- name: Test the plugin
env:
NFT_DIFF: "pdiff"
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2"
run: |
./test.sh
- name: Clean up
if: always()
run: |
sudo rm -rf /home/ubuntu/tests/
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Compiled class file
*.class

# Log file
*.log

# BlueJ files
*.ctxt

# Mobile Tools for Java (J2ME)
.mtj.tmp/

# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
/target/
/.classpath
/.project
/.settings/
/.nextflow/
/.nf-test/

# generated test data
tests/no_index.fasta.fai
13 changes: 13 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
repos:
- repo: https://github.com/pre-commit/mirrors-prettier
rev: "v3.1.0"
hooks:
- id: prettier
additional_dependencies:
- prettier@3.3.3

- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
rev: "2.7.3"
hooks:
- id: editorconfig-checker
alias: ec
10 changes: 10 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.DS_Store
.nextflow*
*.pyc
data/
dependency-reduced-pom.xml
pom.xml
results/
testing*
testing/
work/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 120
}
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog

## dev

### New features

The first release of nft-utils

### Fixes

Fixes are written here
5 changes: 5 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash

mvn package

echo "Built $(readlink -f target/nft-utils*.jar)"
15 changes: 15 additions & 0 deletions bump-version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version=$1
if [ -z $version ]
then
echo "Please provide a version"
exit 1
fi
sed -i -e "0,/<version>/{s/<version>.*<\\/version>/<version>$version<\\/version>/}" ./pom.xml
sed -i -e "s/moduleVersion=.*/moduleVersion=$version/" ./src/main/resources/META-INF/nf-test-plugin

if [[ $version != *dev ]]
then
sed -i -e "s/load \"nft-utils@.*\"/load \"nft-utils@$version\"/" ./docs/index.md
fi

./build.sh
46 changes: 46 additions & 0 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nf-core</groupId>
<artifactId>nft-utils</artifactId>
<name>nft-utils</name>
<version>0.4.0dev</version>
<description>nf-test plugin to support SAM/BAM/CRAM formats</description>
<url>https://github.com/nf-core/nft-utils</url>
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
</license>
</licenses>
<scm>
<connection>scm:git:https://github.com/nf-core/nft-utils</connection>
<developerConnection>scm:git:ssh://github.com:nf-core/nft-utils.git</developerConnection>
<url>https://github.com/nf-core/nft-utils/tree/master</url>
</scm>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.2</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<maven.compiler.release>${java.version}</maven.compiler.release>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<htsjdk.version>3.0.5</htsjdk.version>
<additionalparam>-Xdoclint:none</additionalparam>
</properties>
</project>
61 changes: 61 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# nft-utils

nft-utils is an nf-test plugin to provide additional functions and assertions that fall outside of the typical nf-test features. They were primarily developed by the nf-core community but should be applicable to any nf-tests.

## Start using the plugin

To start using the plugin please add it to your `nf-test.config` file:

```groovy title="nf-test.config"
config {
plugins {
load "nft-utils"
}
}
```

It's a good idea to specify a version which you can do using the `@` symbol, however currently there are no releases:

```groovy title="nf-test.config"
config {
plugins {
load "nft-utils@0.1.0"
}
}
```

Have a look at the [usage documentation](./usage.md) for more information on how to start working with the plugin.

## Use a development version

To use the development version, please do the following steps:

- Clone the [nft-utils repository](https://github.com/nf-core/nft-utils)

=== "HTTPS"

```bash
git clone git@github.com:nf-core/nft-utils.git
```

=== "SSH"

```bash
git clone https://github.com/nf-core/nft-utils.git
```

- Run the build script

```bash
./build.sh
```

- Add the jar location (visible at the end of the build script output) to the `nf-test.config` file

```groovy title="nf-test.config"
config {
plugins {
loadFromFile "full/path/to/the/plugin/jar"
}
}
```
3 changes: 3 additions & 0 deletions docs/usage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Usage

TBC!
64 changes: 64 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
site_name: nf-core/nft-utils
repo_name: nf-core/nft-utils
repo_url: https://github.com/nf-core/nft-utils
site_url: https://nf-core.github.io/nft-utils

nav:
- Home: index.md
- Usage: usage.md

theme:
name: material
icon:
logo: octicons/checklist-16
repo: fontawesome/brands/github
palette:
# Palette toggle for dark mode
- media: "(prefers-color-scheme: dark)"
scheme: slate
primary: custom
accent: custom
toggle:
icon: material/weather-sunny
name: Switch to light mode
# Palette toggle for light mode
- media: "(prefers-color-scheme: light)"
scheme: default
primary: custom
accent: custom
toggle:
icon: material/weather-night
name: Switch to dark mode
font:
text: Inter
features:
- content.code.annotate
- content.code.copy
- navigation.instant
- navigation.top
- navigation.tracking
- navigation.sections
- navigation.footer
- search.share
- toc.follow

markdown_extensions:
- attr_list
- md_in_html
- admonition
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
- pymdownx.highlight:
anchor_linenums: true
line_spans: __span
pygments_lang_class: true
- pymdownx.inlinehilite
- pymdownx.snippets
- pymdownx.superfences
- pymdownx.tabbed:
alternate_style: true

extra:
version:
provider: mike
8 changes: 8 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
config {

testsDir "tests"
workDir ".nf-test"
configFile "tests/nextflow.config"
profile ""

}
Loading

0 comments on commit 521503e

Please sign in to comment.