-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
2 changed files
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
process CUSTOM_BED2SAF { | ||
label 'process_single' | ||
|
||
input: | ||
tuple val(meta), path(bed) | ||
|
||
output: | ||
tuple val(meta), path("*.saf"), emit: saf | ||
path('versions.yml'), emit: versions | ||
|
||
script: | ||
def saf = "${bed.baseName}.saf" | ||
""" | ||
#!/usr/bin/env python | ||
import platform | ||
with open("${saf}", 'w') as outfile: | ||
outfile.write('\\t'.join(['GeneID', 'Chr', 'Start', 'End', 'Strand'])) | ||
with open("${bed}", 'r') as infile: | ||
for line in infile: | ||
(chr, start, end,) = line.strip().split('\\t') | ||
peak_id = f'{chr}:{start}-{end}' | ||
strand = '.' # no strand info available | ||
outfile.write('\\t'.join([peak_id, chr, start, end, strand]) + '\\n') | ||
with open("versions.yml", "w") as outfile: | ||
outfile.write('"${task.process}":\\n') | ||
outfile.write(f' Python: "{platform.python_version()}"\\n') | ||
""" | ||
|
||
stub: | ||
""" | ||
touch ${bed.baseName}.saf versions.yml | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
name: custom_bed2saf | ||
description: | | ||
The module converts a BED file to SAF (simplified annotation format) | ||
keywords: | ||
- bed | ||
- saf | ||
tools: | ||
- Python: | ||
description: | | ||
The Python Programming Language | ||
homepage: https://www.python.org/ | ||
licence: ["Python License 2.0"] | ||
input: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. [ id:'test', single_end:false ] | ||
- bam: | ||
type: file | ||
description: BED file | ||
pattern: "*.bed" | ||
output: | ||
- meta: | ||
type: map | ||
description: | | ||
Groovy Map containing sample information | ||
e.g. [ id:'test', single_end:false ] | ||
- saf: | ||
type: file | ||
description: SAF file | ||
pattern: "*.saf" | ||
- versions: | ||
type: file | ||
description: File containing software versions | ||
pattern: "versions.yml" | ||
authors: | ||
- "@kelly-sovacool" | ||
maintainers: | ||
- "@kelly-sovacool" |