Mercurial > repos > mvdbeek > r_goseq_1_22_0
comparison get_length_and_gc_content.r @ 12:02e88556ce1d draft
planemo upload for repository https://github.com/ARTbio/tools-artbio/tree/master/tools/goseq_1_22_0 commit fdd0811efc61c31f88ff17096fbe8ee8cfacd766-dirty
author | mvdbeek |
---|---|
date | Thu, 25 Feb 2016 06:44:44 -0500 |
parents | 7f8d888e3355 |
children | ea84562a5115 |
comparison
equal
deleted
inserted
replaced
11:1802ccf465b8 | 12:02e88556ce1d |
---|---|
3 | 3 |
4 library(GenomicRanges) | 4 library(GenomicRanges) |
5 library(rtracklayer) | 5 library(rtracklayer) |
6 library(Rsamtools) | 6 library(Rsamtools) |
7 library(optparse) | 7 library(optparse) |
8 library(data.table) | |
8 | 9 |
9 option_list <- list( | 10 option_list <- list( |
10 make_option(c("-g","--gtf"), type="character", help="Input GTF file with gene / exon information."), | 11 make_option(c("-g","--gtf"), type="character", help="Input GTF file with gene / exon information."), |
11 make_option(c("-f","--fasta"), type="character", default=FALSE, help="Fasta file that corresponds to the supplied GTF."), | 12 make_option(c("-f","--fasta"), type="character", default=FALSE, help="Fasta file that corresponds to the supplied GTF."), |
12 make_option(c("-o","--output"), type="character", default=FALSE, help="Output file with gene name, length and GC content.") | 13 make_option(c("-o","--output"), type="character", default=FALSE, help="Output file with gene name, length and GC content.") |
38 nGCs = sum(elementMetadata(x)$nGCs) | 39 nGCs = sum(elementMetadata(x)$nGCs) |
39 width = sum(elementMetadata(x)$widths) | 40 width = sum(elementMetadata(x)$widths) |
40 c(width, nGCs/width) | 41 c(width, nGCs/width) |
41 } | 42 } |
42 output <- t(sapply(split(reducedGTF, elementMetadata(reducedGTF)$gene_id), calc_GC_length)) | 43 output <- t(sapply(split(reducedGTF, elementMetadata(reducedGTF)$gene_id), calc_GC_length)) |
43 colnames(output) <- c("Length", "GC") | 44 output <- setDT(output, keep.rownames = TRUE)[] |
45 colnames(output) <- c("#gene_id", "length", "GC") | |
44 | 46 |
45 write.table(output, file=output_file, sep="\t") | 47 write.table(output, file=output_file, row.names=FALSE, quote=FALSE, sep="\t") |