nf-core / methylseq

Methylation (Bisulfite-Sequencing) analysis pipeline using Bismark or bwa-meth + MethylDackel
https://nf-co.re/methylseq
MIT License
137 stars 136 forks source link

samplesheet input is not detecting entire values in sample column #378

Open wvictor14 opened 7 months ago

wvictor14 commented 7 months ago

Description of the bug

when (a certain number of?) underscores are used in sample column, sometimes only a substring of the entire value is read in, rather than the whole value.

E.g. BATCH_DATE_SAMPLE is read in as BATCH_DATE in the following example. The impact is that when the read-in partial value is not unique , the pipeline will erroneously treat multiple (unique) rows as replicates.

See screenshots of an example samplesheet and running pipeline for example

image (1) image

Command used and terminal output

No response

Relevant files

No response

System information

version methylseq 2.6.0 No response

ewels commented 7 months ago

I suspect that this is the offending code:

https://github.com/nf-core/methylseq/blob/54f823e102ef3d04077cc091a5ae435519f9923a/workflows/methylseq.nf#L101-L103

I'm not 100% if this is a bug or a feature. If a feature then it should have better docs.

ewels commented 7 months ago

I think that this issue is essentially the inverse of https://github.com/nf-core/methylseq/issues/351 (here it's happening by accident, there it was the desired behaviour).

flerpan01 commented 5 months ago

I'm so happy I found this issue, was pulling my hair the whole day thinking my code was wrong. Quickfix: changed the underscore to a dot in my samplesheet.csv (F0_1 -> F0.1)

CathyXD commented 4 months ago

I've encountered the same issue that the sample name inputs were uncompleted causing later errors. My sequencing was paired-end with 4 lane per sample, so may also have the problem mentioned in #381 . Could anyone provide an updated workable samplesheet.csv example? Really confused now.

AdrijaK commented 3 months ago

Could anyone provide an updated workable samplesheet.csv example? Really confused now.

@CathyXD If you add a random number after the last underscore (i.e., a suffix for each sample name: _x, _x, _x, _x) to each sample name, they will not be concatenated. Similar thing works for nf-core/chipseq pipeline where everything before the last underscore is used to infer group names.

The pipeline decides to pool the samples in this bit of code:

        .map {
            meta, fastq ->
            def meta_clone = meta.clone()
            parts = meta_clone.id.split('_')
            meta_clone.id = parts.length > 1 ? parts[0..-2].join('_') : meta_clone.id
            [ meta_clone, fastq ]
        }

in meta_clone.id = parts.length > 1 ? parts[0..-2].join('_') : meta_clone.id it splits the sample name by underscores, then checks if the number of parts is larger than 1.

Here are some examples: example1: no underscores will make sure no samples are pooled:

input: sample1 sample2

output: sample1 sample2

example2: one underscore will pool the samples based on everything before the last underscore

input: sample_1 sample_2

output: sample

imdanique commented 1 month ago

Thank you!! I've spent a week trying to figure out why the pipeline is strangely concatenating my input fastqs. Could you please add this info regarding naming conventions to README or fix the code?