# HG changeset patch # User proteore # Date 1544691581 18000 # Node ID cfcc7a780991152de4c1f005fa60abc6bdca4830 # Parent 6fc8d303bcf130d58aaba5ed0bbe48a474e08041 planemo upload commit c599cfc156c77626df2b674bdfbd437b9f664ab9 diff -r 6fc8d303bcf1 -r cfcc7a780991 Build_tissue-specific_expression_dataset.R --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build_tissue-specific_expression_dataset.R Thu Dec 13 03:59:41 2018 -0500 @@ -0,0 +1,76 @@ + + +select_HPAimmunohisto<-function(hpa_ref, tissue, level, reliability) { + HPA.normal = read.table(hpa_ref,header=TRUE,sep="\t",stringsAsFactors = FALSE) + if (tissue == "tissue") { + tissue <- unique(HPA.normal$Tissue) + } + if (level == "level") { + level <- unique(HPA.normal$Level) + } + if (reliability == "reliability") { + reliability <- unique(HPA.normal$Reliability) + } + res.imm <- subset(HPA.normal, Tissue%in%tissue & Level%in%level & Reliability%in%reliability) + return(res.imm) +} + + + +select_HPARNAseq<-function(hpa_ref, sample) { + HPA.rnaTissue = read.table(hpa_ref,header=TRUE,sep="\t",stringsAsFactors = FALSE) + res.rna <- subset(HPA.rnaTissue, Sample%in%sample, select = -c(Unit)) + colnames(res.rna)[which(colnames(res.rna) == 'Value')] <- 'Value (TPM unit)' + return(res.rna) +} + +main <- function() { + args <- commandArgs(TRUE) + if(length(args)<1) { + args <- c("--help") + } + + # Help section + if("--help" %in% args) { + cat("Selection and Annotation HPA + Arguments: + --data_source: immuno/rnaseq + --hpe_ref: path to reference file normal_tissue.tsv/rna_tissue.tsv) + if immuno: + --tissue: list of tissues + --level: Not detected, Low, Medium, High + --reliability: Supported, Approved, Enhanced, Uncertain + if rnaseq: + --sample: Sample tissues + --output: output filename \n") + q(save="no") + } + + # Parse arguments + parseArgs <- function(x) strsplit(sub("^--", "", x), "=") + argsDF <- as.data.frame(do.call("rbind", parseArgs(args))) + args <- as.list(as.character(argsDF$V2)) + names(args) <- argsDF$V1 + + # Extract options + data_source = args$data_source + hpa_ref = args$hpa_ref + if (data_source == "immuno") { + tissue = strsplit(args$tissue, ",")[[1]] + level = strsplit(args$level, ",")[[1]] + reliability = strsplit(args$reliability, ",")[[1]] + # Calculation + res = select_HPAimmunohisto(hpa_ref, tissue, level, reliability) + } + else if (data_source == "rnaseq") { + sample = strsplit(args$sample, ",")[[1]] + # Calculation + res = select_HPARNAseq(hpa_ref, sample) + } + + # Write output + output = args$output + write.table(res, output, sep = "\t", quote = FALSE, row.names = FALSE) +} + +main() diff -r 6fc8d303bcf1 -r cfcc7a780991 Build_tissue-specific_expression_dataset.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Build_tissue-specific_expression_dataset.xml Thu Dec 13 03:59:41 2018 -0500 @@ -0,0 +1,210 @@ + +[Human Protein Atlas](no input required) + + R + + + + + + $__tool_directory__/Build_tissue-specific_expression_dataset.R + --data_source="$input.data_source" + #if $input.data_source == "immuno" + --hpa_ref="$__tool_directory__/normal_tissue.tsv" + --tissue="$input.normal_tissue" + --level="$input.level" + --reliability="$input.reliability" + #else if $input.data_source == "rnaseq" + --hpa_ref="$__tool_directory__/rna_tissue.tsv" + --sample="$input.sample" + #end if + --output="$output" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r 6fc8d303bcf1 -r cfcc7a780991 RetrieveFromHPA.R --- a/RetrieveFromHPA.R Mon Nov 12 11:19:38 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,76 +0,0 @@ - - -select_HPAimmunohisto<-function(hpa_ref, tissue, level, reliability) { - HPA.normal = read.table(hpa_ref,header=TRUE,sep="\t",stringsAsFactors = FALSE) - if (tissue == "tissue") { - tissue <- unique(HPA.normal$Tissue) - } - if (level == "level") { - level <- unique(HPA.normal$Level) - } - if (reliability == "reliability") { - reliability <- unique(HPA.normal$Reliability) - } - res.imm <- subset(HPA.normal, Tissue%in%tissue & Level%in%level & Reliability%in%reliability) - return(res.imm) -} - - - -select_HPARNAseq<-function(hpa_ref, sample) { - HPA.rnaTissue = read.table(hpa_ref,header=TRUE,sep="\t",stringsAsFactors = FALSE) - res.rna <- subset(HPA.rnaTissue, Sample%in%sample, select = -c(Unit)) - colnames(res.rna)[which(colnames(res.rna) == 'Value')] <- 'Value (TPM unit)' - return(res.rna) -} - -main <- function() { - args <- commandArgs(TRUE) - if(length(args)<1) { - args <- c("--help") - } - - # Help section - if("--help" %in% args) { - cat("Selection and Annotation HPA - Arguments: - --data_source: immuno/rnaseq - --hpe_ref: path to reference file normal_tissue.tsv/rna_tissue.tsv) - if immuno: - --tissue: list of tissues - --level: Not detected, Low, Medium, High - --reliability: Supported, Approved, Enhanced, Uncertain - if rnaseq: - --sample: Sample tissues - --output: output filename \n") - q(save="no") - } - - # Parse arguments - parseArgs <- function(x) strsplit(sub("^--", "", x), "=") - argsDF <- as.data.frame(do.call("rbind", parseArgs(args))) - args <- as.list(as.character(argsDF$V2)) - names(args) <- argsDF$V1 - - # Extract options - data_source = args$data_source - hpa_ref = args$hpa_ref - if (data_source == "immuno") { - tissue = strsplit(args$tissue, ",")[[1]] - level = strsplit(args$level, ",")[[1]] - reliability = strsplit(args$reliability, ",")[[1]] - # Calculation - res = select_HPAimmunohisto(hpa_ref, tissue, level, reliability) - } - else if (data_source == "rnaseq") { - sample = strsplit(args$sample, ",")[[1]] - # Calculation - res = select_HPARNAseq(hpa_ref, sample) - } - - # Write output - output = args$output - write.table(res, output, sep = "\t", quote = FALSE, row.names = FALSE) -} - -main() diff -r 6fc8d303bcf1 -r cfcc7a780991 retrieve_from_hpa.xml --- a/retrieve_from_hpa.xml Mon Nov 12 11:19:38 2018 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,210 +0,0 @@ - -(no input required) - - R - - - - - - $__tool_directory__/RetrieveFromHPA.R - --data_source="$input.data_source" - #if $input.data_source == "immuno" - --hpa_ref="$__tool_directory__/normal_tissue.tsv" - --tissue="$input.normal_tissue" - --level="$input.level" - --reliability="$input.reliability" - #else if $input.data_source == "rnaseq" - --hpa_ref="$__tool_directory__/rna_tissue.tsv" - --sample="$input.sample" - #end if - --output="$output" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -