Mercurial > repos > iuc > length_and_gc_content
annotate get_length_and_gc_content.r @ 2:e3ba567abdf5 draft default tip
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
author | iuc |
---|---|
date | Fri, 11 Mar 2022 14:08:11 +0000 |
parents | f088370d2a3c |
children |
rev | line source |
---|---|
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
1 # originally by Devon Ryan, https://www.biostars.org/p/84467/ |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
2 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
3 options(show.error.messages = F, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
4 error = function() { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
5 cat(geterrmessage(), file = stderr()) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
6 q("no", 1, F) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
7 }) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
8 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
9 # we need that to not crash galaxy with an UTF8 error on German LC settings. |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
10 loc <- Sys.setlocale("LC_MESSAGES", "en_US.UTF-8") |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
11 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
12 suppressPackageStartupMessages({ |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
13 library("GenomicRanges") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
14 library("rtracklayer") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
15 library("Rsamtools") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
16 library("optparse") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
17 library("data.table") |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
18 }) |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
19 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
20 option_list <- list( |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
21 make_option(c("-g", "--gtf"), type = "character", |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
22 help = "Input gtf file with gene / exon information."), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
23 make_option(c("-f", "--fasta"), type = "character", default = NULL, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
24 help = "fasta file that corresponds to the supplied gtf."), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
25 make_option(c("-l", "--length"), type = "character", default = NULL, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
26 help = "Output file with Gene ID and length."), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
27 make_option(c("-c", "--gc_content"), type = "character", default = NULL, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
28 help = "Output file with Gene ID and GC content.") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
29 ) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
30 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
31 parser <- OptionParser(usage = "%prog [options] file", |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
32 option_list = option_list) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
33 args <- parse_args(parser) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
34 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
35 gtf_file <- args$gtf |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
36 fasta_file <- args$fasta |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
37 length <- args$length |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
38 gc_content <- args$gc_content |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
39 |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
40 # Check args: |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
41 if (is.null(fasta_file) & !is.null(gc_content)) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
42 stop("gc_content output requires fasta input") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
43 } |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
44 if (is.null(length) & is.null(gc_content)) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
45 stop("neither gc_content nor length was set nothing to do.") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
46 } |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
47 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
48 #Load the annotation and reduce it |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
49 gtf <- import.gff(gtf_file, format = "gtf", genome = NA, feature.type = "exon") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
50 grl <- reduce(split(gtf, elementMetadata(gtf)$gene_id)) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
51 reduced_gtf <- unlist(grl, use.names = T) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
52 elementMetadata(reduced_gtf)$gene_id <- rep(names(grl), elementNROWS(grl)) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
53 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
54 if (! is.null(gc_content)) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
55 #Open the fasta file |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
56 fasta <- FaFile(fasta_file) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
57 open(fasta) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
58 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
59 #Add the GC numbers |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
60 elementMetadata(reduced_gtf)$n_gcs <- |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
61 letterFrequency(getSeq(fasta, reduced_gtf), "GC")[, 1] |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
62 } |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
63 elementMetadata(reduced_gtf)$widths <- width(reduced_gtf) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
64 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
65 #Create a list of the ensembl_id/GC/length |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
66 if (! is.null(gc_content)) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
67 calc_gc_length <- function(x) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
68 n_gcs <- sum(elementMetadata(x)$n_gcs) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
69 width <- sum(elementMetadata(x)$widths) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
70 c(width, n_gcs / width) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
71 } |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
72 output <- t(sapply(split(reduced_gtf, elementMetadata(reduced_gtf)$gene_id), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
73 calc_gc_length)) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
74 output <- data.frame(setDT(data.frame(output), keep.rownames = TRUE)[]) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
75 write.table(output[, c(1, 3)], file = gc_content, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
76 col.names = FALSE, row.names = FALSE, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
77 quote = FALSE, sep = "\t") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
78 } else { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
79 all_widths <- sapply(split(reduced_gtf, elementMetadata(reduced_gtf)$gene_id), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
80 function(x) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
81 sum(elementMetadata(x)$widths) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
82 }) |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
83 output <- data.frame(gene_id = names(all_widths), |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
84 length = all_widths) |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
85 } |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
86 |
2
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
87 if (! is.null(length)) { |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
88 write.table(output[, c(1, 2)], file = length, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
89 col.names = FALSE, row.names = FALSE, |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
90 quote = FALSE, sep = "\t") |
e3ba567abdf5
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit 7b6b07d22f3e6fed77b2c237de2b0d96fa939711"
iuc
parents:
1
diff
changeset
|
91 } |
0
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
92 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
93 |
2ca1baabdae0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/length_and_gc_content commit b7dcd020c6a15fa55f392cc09cbc37580d6e75c4
iuc
parents:
diff
changeset
|
94 sessionInfo() |