.split(".") does not work on the same case where .split("chr") or .split("_") are working #4258
-
I am trying to map a list using chromosome names inside such: [/filepath/ALL.chr1.GRCh38.phased.CHR.vcf] to [/filepath/ALL.chr1.GRCh38.phased.CHR.vcf, chr1] This process would be easy if I could just split by "." but it does not work. Anyone has any idea? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Answer from Marcel: Channel
.fromPath("data/*")
.set { my_ch }
my_ch.view()
my_ch
.map { path -> [path, path.name.split("\\.")[1]] }
.view() |
Beta Was this translation helpful? Give feedback.
-
my solution: intervals_ch = [chr1, chr2, chr3]
files
.combine(intervals_ch)
.filter{it[0].baseName.contains(it[1]+".")}
.set{new_ch} |
Beta Was this translation helpful? Give feedback.
Answer from Marcel: