diff --git a/bin/find_stations.R b/bin/find_stations.R index 73669d8..4da883d 100644 --- a/bin/find_stations.R +++ b/bin/find_stations.R @@ -6,11 +6,11 @@ source(args[6]) library(lubridate) #library(tidyverse) -library(dplyr) library(tidyr) library(readr) library(stationaRy) library(geosphere) +library(dplyr) # args[1] = input dat#aframe # args[2] = station dataframe diff --git a/env/Dockerfile b/env/Dockerfile index ab93676..dc2697f 100644 --- a/env/Dockerfile +++ b/env/Dockerfile @@ -11,11 +11,13 @@ ARG MAMBA_DOCKERFILE_ACTIVATE=1 USER root -RUN apt-get update && apt-get install -y procps && \ +RUN apt-get update && apt-get install -y procps wget && \ apt-get clean USER $MAMBA_USER ENV PATH=/opt/conda/bin:/opt/conda/condabin:$PATH -RUN Rscript -e "install.packages('stationaRy', dependencies = TRUE, repos = 'http://cran.us.r-project.org')" +RUN Rscript -e "install.packages('lutz', dependencies = TRUE, repos = 'http://cran.us.r-project.org')" +RUN wget https://cran.r-project.org/src/contrib/Archive/stationaRy/stationaRy_0.4.1.tar.gz +RUN Rscript -e "install.packages('stationaRy_0.4.1.tar.gz', repos = NULL, type='source')" diff --git a/env/conda.yml b/env/conda.yml index 6f05d5d..b5366b0 100644 --- a/env/conda.yml +++ b/env/conda.yml @@ -16,4 +16,6 @@ dependencies: - r-downloader - r-progress - r-stringr - - r-plyr \ No newline at end of file + - r-plyr + - r-leaflet + - r-magrittr \ No newline at end of file diff --git a/main.nf b/main.nf index d0c1923..469a211 100644 --- a/main.nf +++ b/main.nf @@ -1,14 +1,15 @@ #! usr/bin/env nextflow params.samples = "${workflow.projectDir}/test_data/wild_isolates.csv" +params.isd_inventory = "${workflow.projectDir}/isd-inventory.csv" if (params.out == null){ - params.outdir = noaa_analysis_${date} + params.outdir = "noaa_analysis_${params.day}" } else { params.outdir = params.out } -if (params.help){ +if (params.help | params.debug){ params.input = "${workflow.projectDir}/test_data/noaa_test.csv" } else { params.input = params.samples @@ -19,8 +20,9 @@ if (params.help){ workflow { Channel.fromPath(params.input) | split_WI - split_WI.out.flatten() | findStations - findStations.toSortedList() | joinData + split_WI.out.flatten() + .combine(Channel.of( params.isd_inventory) ) | findStations + findStations.out.toSortedList() | joinData } process split_WI { label 'xs' @@ -79,14 +81,14 @@ process findStations { tag { wi_location } input: - path(wi_location) + tuple path(wi_location), path(isd_inventory) output: path("*.noaa.tsv") """ - Rscript --vanilla "${workflow.projectDir}/bin/find_stations.R" "${wi_location}" "${workflow.projectDir}/isd-inventory.csv" "${params.months}" "${params.events}" "${params.important_trait}" "${workflow.projectDir}/bin/get_isd_station_data_fix.R" + Rscript --vanilla "${workflow.projectDir}/bin/find_stations.R" "${wi_location}" "${isd_inventory}" "${params.months}" "${params.events}" "${params.important_trait}" "${workflow.projectDir}/bin/get_isd_station_data_fix.R" """ @@ -94,7 +96,7 @@ process findStations { process joinData { - publishDir "${params.out}/", mode: 'copy' + publishDir "${params.outdir}/", mode: 'copy' executor "local" container null diff --git a/nextflow.config b/nextflow.config index c1d7f42..a930291 100644 --- a/nextflow.config +++ b/nextflow.config @@ -21,5 +21,5 @@ profiles { process { cache = "lenient" - container = "andersenlab/noaa-nf:202410141550086c5701" + container = "andersenlab/noaa-nf:101424" }