-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
revert changes that do not belong to template update
- Loading branch information
Showing
42 changed files
with
2,993 additions
and
34 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,43 @@ | ||
#!/usr/bin/env Rscript | ||
'VCF to count matrix converter | ||
Usage: | ||
vcf2counts.R --help | ||
vcf2counts.R --output=<ofile> VCF | ||
Options: | ||
-h, --help help screen | ||
-o, --output=<ofile> output file name [default: mat.csv] | ||
Arguments: | ||
VCF input vcf file | ||
'->doc | ||
|
||
suppressMessages(library(VariantAnnotation, warn.conflicts = FALSE, quietly=TRUE)) | ||
suppressMessages(library(docopt, warn.conflicts = FALSE, quietly=TRUE)) | ||
suppressMessages(library(Matrix, warn.conflicts = FALSE, quietly=TRUE)) | ||
|
||
generateMatrixfromVCF <- function(VCF, ofile) { | ||
# Read in VCF file | ||
vcfobj <- readVcf(VCF) | ||
# Convert genotype to SNP matrix | ||
genomat <- geno(vcfobj)$GT | ||
|
||
variantmat <- apply(genomat, c(1, 2), function(x) { | ||
xstrip <- gsub("[[:punct:]]", "", x) | ||
if (xstrip == "11") { | ||
return (2) | ||
} else if (xstrip %in% c("01", "10")) { | ||
return (1) | ||
} else if (xstrip %in% c("00", "")) { | ||
return (0) | ||
} else { | ||
return (NA) | ||
} | ||
}) | ||
write.csv(variantmat, file = ofile) | ||
} | ||
|
||
opt <- docopt(doc) | ||
|
||
generateMatrixfromVCF(opt$VCF, opt[["--output"]]) |
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
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
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
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
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
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
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,7 @@ | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- bioconda::bioconductor-variantannotation | ||
- conda-forge::r-docopt | ||
- conda-forge::r-matrix |
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,45 @@ | ||
process VCF2MAT { | ||
tag "$meta.id" | ||
label 'process_single' | ||
|
||
conda "${moduleDir}/environment.yml" | ||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://community-cr-prod.seqera.io/docker/registry/v2/blobs/sha256/6c/6c2dd8fc4240adf343ad71f9c56158d87f28b2577f2a6e114b7ab8406f0c4672/data' : | ||
'community.wave.seqera.io/library/bioconductor-variantannotation_r-docopt_r-matrix:3cf2f20fdc477746' }" | ||
|
||
input: | ||
tuple val(meta), path(vcf) | ||
|
||
output: | ||
tuple val(meta), path("*.csv") , emit: csv | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def VERSION = '1.0.0' | ||
""" | ||
vcf2counts.R \\ | ||
--output ${prefix}.csv \\ | ||
$vcf | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
vcf2counts.R: $VERSION | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def VERSION = '1.0.0' | ||
""" | ||
touch ${prefix}.csv | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
vcf2counts.R: $VERSION | ||
END_VERSIONS | ||
""" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.