nextflow icon indicating copy to clipboard operation
nextflow copied to clipboard

Preserve attributes of published files

Open jjfarrell opened this issue 1 year ago • 2 comments

When PublishDir copies pairs of files such as (cram and cram.crai) and (vcf.gz and vcf.gz.tbi). the atributes of the files are not copied which includes the file creation time. Downstream software expects the index files (crai and tbi) to have a later time than the corresponding cram and vcf.gz files). To preserve the creation time of the files, the PublishDir code was modified to copy the files attributes which preserves the original file creation time. #1489 described the issue.

jjfarrell avatar Nov 18 '23 02:11 jjfarrell

Deploy Preview for nextflow-docs-staging ready!

Name Link
Latest commit 2670f135ad5674dd43556ecf7dfc0df95dab2256
Latest deploy log https://app.netlify.com/sites/nextflow-docs-staging/deploys/65c6878beab759000820acce
Deploy Preview https://deploy-preview-4522--nextflow-docs-staging.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

netlify[bot] avatar Nov 18 '23 02:11 netlify[bot]

To test the changes, I modified tests/publish-dir.nf to add a sleep 1m between the creation of the bam and bai.

#!/usr/bin/env nextflow

process align {
    publishDir 'data', mode: 'copy'

    input:
    val(x)

    output:
    path("*.bam")
    path("${x}.bai")

    """
    echo ${x} > ${x}.bam
    sleep 1m
    echo ${x} | rev > ${x}.bai
    """
}

When running the test script without the PR, the published bam and bai files did not have the original file attributes and reflected the date of the asynchronous copy file creation. There is no 1m file difference between the bam and bai files. ls -lth data/

-rw-r--r-- 1 farrell cadre    6 Nov 19 10:20 delta.bam
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:20 delta.bai
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:20 alpha.bam
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:20 alpha.bai
-rw-r--r-- 1 farrell cadre    5 Nov 19 10:20 beta.bai
-rw-r--r-- 1 farrell cadre    5 Nov 19 10:20 beta.bam

With the PR, the attributes were preserved with the 1m difference of the published bam and bai files. ls -lth data/

rw-r--r-- 1 farrell cadre    5 Nov 19 10:38 beta.bai
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:38 delta.bai
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:38 alpha.bai
-rw-r--r-- 1 farrell cadre    5 Nov 19 10:37 beta.bam
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:37 delta.bam
-rw-r--r-- 1 farrell cadre    6 Nov 19 10:37 alpha.bam

jjfarrell avatar Nov 19 '23 16:11 jjfarrell