Mercurial > repos > mvdbeek > r_goseq_1_22_0
diff get_length_and_gc_content.r @ 7:15ce6435ab83 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:09:34 -0500 |
parents | d4b5942ed347 |
children | 7f8d888e3355 |
line wrap: on
line diff
--- a/get_length_and_gc_content.r Thu Feb 25 05:49:08 2016 -0500 +++ b/get_length_and_gc_content.r Thu Feb 25 06:09:34 2016 -0500 @@ -21,9 +21,9 @@ #Load the annotation and reduce it GTF <- import.gff(GTFfile, format="gtf", genome=NA, feature.type="exon") -grl <- reduce(split(GTF, elementMetadata(GTF)$gene_name)) +grl <- reduce(split(GTF, elementMetadata(GTF)$gene_id)) reducedGTF <- unlist(grl, use.names=T) -elementMetadata(reducedGTF)$gene_name <- rep(names(grl), elementLengths(grl)) +elementMetadata(reducedGTF)$gene_id <- rep(names(grl), elementLengths(grl)) #Open the fasta file FASTA <- FaFile(FASTAfile) @@ -39,7 +39,7 @@ width = sum(elementMetadata(x)$widths) c(width, nGCs/width) } -output <- t(sapply(split(reducedGTF, elementMetadata(reducedGTF)$gene_name), calc_GC_length)) +output <- t(sapply(split(reducedGTF, elementMetadata(reducedGTF)$gene_id), calc_GC_length)) colnames(output) <- c("Length", "GC") write.table(output, file="GC_lengths.tsv", sep="\t") \ No newline at end of file