Repository 'count_gff_features'
hg clone https://toolshed.g2.bx.psu.edu/repos/devteam/count_gff_features

Changeset 0:fabda887a71f (2014-07-28)
Next changeset 1:188392a0d0a8 (2017-06-06)
Commit message:
Imported from capsule None
added:
count_gff_features.py
count_gff_features.xml
test-data/count_gff_features_out1.txt
test-data/count_gff_features_out2.txt
test-data/gff2bed_in2.gff
test-data/gff_filter_by_feature_count_out1.gff
tool_dependencies.xml
b
diff -r 000000000000 -r fabda887a71f count_gff_features.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/count_gff_features.py Mon Jul 28 11:56:10 2014 -0400
[
@@ -0,0 +1,18 @@
+#!/usr/bin/env python
+# This tool takes a gff file as input and counts the number of features in it.
+
+import sys, fileinput
+from galaxy import eggs
+from galaxy.datatypes.util.gff_util import GFFReaderWrapper
+from bx.intervals.io import GenomicInterval
+
+# Get args.
+input_file = sys.argv[1:]
+
+# Count features.
+count = 0
+for feature in GFFReaderWrapper( fileinput.FileInput( input_file ), fix_strand=True ):
+    if isinstance( feature, GenomicInterval ):
+        count += 1
+
+print count
\ No newline at end of file
b
diff -r 000000000000 -r fabda887a71f count_gff_features.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/count_gff_features.xml Mon Jul 28 11:56:10 2014 -0400
b
@@ -0,0 +1,29 @@
+<tool id="count_gff_features" name="Count GFF Features" version="0.1">
+    <description></description>
+    <requirements>
+        <requirement type="package" version="0.7.1">bx-python</requirement>
+    </requirements>
+    <command interpreter="python">
+        count_gff_features.py $input &gt; $output
+    </command>
+    <inputs>
+        <param format="gff" name="input" type="data" label="GFF Dataset to Filter"/>
+    </inputs>
+    <outputs>
+        <data format="txt" name="output"/>
+    </outputs>
+    <tests>
+        <test>
+            <param name="input" value="gff2bed_in2.gff"/>
+            <output name="output" file="count_gff_features_out1.txt"/>
+        </test>
+        <test>
+            <param name="input" value="gff_filter_by_feature_count_out1.gff"/>
+            <output name="output" file="count_gff_features_out2.txt"/>
+        </test>
+    </tests>
+    <help>
+        Counts the number of features in a GFF dataset. GFF features are often spread across multiple lines; this tool counts the number of 
+        features in dataset rather than the number of lines.
+    </help>
+</tool>
b
diff -r 000000000000 -r fabda887a71f test-data/count_gff_features_out1.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/count_gff_features_out1.txt Mon Jul 28 11:56:10 2014 -0400
b
@@ -0,0 +1,1 @@
+3
b
diff -r 000000000000 -r fabda887a71f test-data/count_gff_features_out2.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/count_gff_features_out2.txt Mon Jul 28 11:56:10 2014 -0400
b
@@ -0,0 +1,1 @@
+14
b
diff -r 000000000000 -r fabda887a71f test-data/gff2bed_in2.gff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/gff2bed_in2.gff Mon Jul 28 11:56:10 2014 -0400
b
@@ -0,0 +1,13 @@
+chr1 Cufflinks exon 3204563 3207049 1000 - . gene_id "Xkr4"; transcript_id "Xkr4"; exon_number "1"; FPKM "0.3924207844"; frac "1.000000"; conf_lo "0.000000"; conf_hi "0.845549"; cov "0.022289";
+chr1 Cufflinks exon 3411783 3411982 1000 - . gene_id "Xkr4"; transcript_id "Xkr4"; exon_number "2"; FPKM "0.3924207844"; frac "1.000000"; conf_lo "0.000000"; conf_hi "0.845549"; cov "0.022289";
+chr1 Cufflinks exon 3660633 3661579 1000 - . gene_id "Xkr4"; transcript_id "Xkr4"; exon_number "3"; FPKM "0.3924207844"; frac "1.000000"; conf_lo "0.000000"; conf_hi "0.845549"; cov "0.022289";
+chr1 Cufflinks exon 4481009 4482749 1000 - . gene_id "Sox17"; transcript_id "Sox17"; exon_number "1"; FPKM "1.5186976896"; frac "1.000000"; conf_lo "0.558189"; conf_hi "2.479206"; cov "0.086262";
+chr1 Cufflinks exon 4483181 4483547 1000 - . gene_id "Sox17"; transcript_id "Sox17"; exon_number "2"; FPKM "1.5186976896"; frac "1.000000"; conf_lo "0.558189"; conf_hi "2.479206"; cov "0.086262";
+chr1 Cufflinks exon 4483853 4483944 1000 - . gene_id "Sox17"; transcript_id "Sox17"; exon_number "3"; FPKM "1.5186976896"; frac "1.000000"; conf_lo "0.558189"; conf_hi "2.479206"; cov "0.086262";
+chr1 Cufflinks exon 4485217 4486023 1000 - . gene_id "Sox17"; transcript_id "Sox17"; exon_number "4"; FPKM "1.5186976896"; frac "1.000000"; conf_lo "0.558189"; conf_hi "2.479206"; cov "0.086262";
+chr1 Cufflinks exon 4486372 4486494 1000 - . gene_id "Sox17"; transcript_id "Sox17"; exon_number "5"; FPKM "1.5186976896"; frac "1.000000"; conf_lo "0.558189"; conf_hi "2.479206"; cov "0.086262";
+chr1 Cufflinks exon 4763279 4766882 1000 - . gene_id "Mrpl15"; transcript_id "Mrpl15"; exon_number "1"; FPKM "9.1596238357"; frac "1.000000"; conf_lo "7.124003"; conf_hi "11.195245"; cov "0.520266";
+chr1 Cufflinks exon 4767606 4767729 1000 - . gene_id "Mrpl15"; transcript_id "Mrpl15"; exon_number "2"; FPKM "9.1596238357"; frac "1.000000"; conf_lo "7.124003"; conf_hi "11.195245"; cov "0.520266";
+chr1 Cufflinks exon 4772649 4772814 1000 - . gene_id "Mrpl15"; transcript_id "Mrpl15"; exon_number "3"; FPKM "9.1596238357"; frac "1.000000"; conf_lo "7.124003"; conf_hi "11.195245"; cov "0.520266";
+chr1 Cufflinks exon 4774032 4774186 1000 - . gene_id "Mrpl15"; transcript_id "Mrpl15"; exon_number "4"; FPKM "9.1596238357"; frac "1.000000"; conf_lo "7.124003"; conf_hi "11.195245"; cov "0.520266";
+chr1 Cufflinks exon 4775654 4775807 1000 - . gene_id "Mrpl15"; transcript_id "Mrpl15"; exon_number "5"; FPKM "9.1596238357"; frac "1.000000"; conf_lo "7.124003"; conf_hi "11.195245"; cov "0.520266";
b
diff -r 000000000000 -r fabda887a71f test-data/gff_filter_by_feature_count_out1.gff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/gff_filter_by_feature_count_out1.gff Mon Jul 28 11:56:10 2014 -0400
b
b'@@ -0,0 +1,42 @@\n+chr13\tCufflinks\ttranscript\t3565855\t3566203\t1000\t-\t.\tgene_id "CUFF.50195"; transcript_id "CUFF.50195.1"; FPKM "29.8710998584"; frac "1.000000"; conf_lo "7.290671"; conf_hi "52.451529"; cov "1.909091";\n+chr13\tCufflinks\texon\t3565855\t3565913\t1000\t-\t.\tgene_id "CUFF.50195"; transcript_id "CUFF.50195.1"; exon_number "1"; FPKM "29.8710998584"; frac "1.000000"; conf_lo "7.290671"; conf_hi "52.451529"; cov "1.909091";\n+chr13\tCufflinks\texon\t3566164\t3566203\t1000\t-\t.\tgene_id "CUFF.50195"; transcript_id "CUFF.50195.1"; exon_number "2"; FPKM "29.8710998584"; frac "1.000000"; conf_lo "7.290671"; conf_hi "52.451529"; cov "1.909091";\n+chr13\tCufflinks\ttranscript\t3606116\t3613028\t1000\t-\t.\tgene_id "CUFF.50207"; transcript_id "CUFF.50207.1"; FPKM "19.6171377865"; frac "1.000000"; conf_lo "0.936995"; conf_hi "38.297281"; cov "1.253750";\n+chr13\tCufflinks\texon\t3606116\t3606146\t1000\t-\t.\tgene_id "CUFF.50207"; transcript_id "CUFF.50207.1"; exon_number "1"; FPKM "19.6171377865"; frac "1.000000"; conf_lo "0.936995"; conf_hi "38.297281"; cov "1.253750";\n+chr13\tCufflinks\texon\t3612965\t3613028\t1000\t-\t.\tgene_id "CUFF.50207"; transcript_id "CUFF.50207.1"; exon_number "2"; FPKM "19.6171377865"; frac "1.000000"; conf_lo "0.936995"; conf_hi "38.297281"; cov "1.253750";\n+chr13\tCufflinks\ttranscript\t4594319\t4594938\t1000\t-\t.\tgene_id "CUFF.50261"; transcript_id "CUFF.50261.1"; FPKM "29.3887094260"; frac "1.000000"; conf_lo "8.607754"; conf_hi "50.169665"; cov "1.878261";\n+chr13\tCufflinks\texon\t4594319\t4594400\t1000\t-\t.\tgene_id "CUFF.50261"; transcript_id "CUFF.50261.1"; exon_number "1"; FPKM "29.3887094260"; frac "1.000000"; conf_lo "8.607754"; conf_hi "50.169665"; cov "1.878261";\n+chr13\tCufflinks\texon\t4594906\t4594938\t1000\t-\t.\tgene_id "CUFF.50261"; transcript_id "CUFF.50261.1"; exon_number "2"; FPKM "29.3887094260"; frac "1.000000"; conf_lo "8.607754"; conf_hi "50.169665"; cov "1.878261";\n+chr13\tCufflinks\ttranscript\t4596799\t4598059\t1000\t-\t.\tgene_id "CUFF.50263"; transcript_id "CUFF.50263.1"; FPKM "22.8358215134"; frac "1.000000"; conf_lo "0.000000"; conf_hi "45.671643"; cov "1.459459";\n+chr13\tCufflinks\texon\t4596799\t4596828\t1000\t-\t.\tgene_id "CUFF.50263"; transcript_id "CUFF.50263.1"; exon_number "1"; FPKM "22.8358215134"; frac "1.000000"; conf_lo "0.000000"; conf_hi "45.671643"; cov "1.459459";\n+chr13\tCufflinks\texon\t4598016\t4598059\t1000\t-\t.\tgene_id "CUFF.50263"; transcript_id "CUFF.50263.1"; exon_number "2"; FPKM "22.8358215134"; frac "1.000000"; conf_lo "0.000000"; conf_hi "45.671643"; cov "1.459459";\n+chr13\tCufflinks\ttranscript\t5861035\t5872268\t1000\t-\t.\tgene_id "CUFF.50289"; transcript_id "CUFF.50289.1"; FPKM "7.5439767500"; frac "1.000000"; conf_lo "0.000000"; conf_hi "18.212771"; cov "0.482143";\n+chr13\tCufflinks\texon\t5861035\t5861117\t1000\t-\t.\tgene_id "CUFF.50289"; transcript_id "CUFF.50289.1"; exon_number "1"; FPKM "7.5439767500"; frac "1.000000"; conf_lo "0.000000"; conf_hi "18.212771"; cov "0.482143";\n+chr13\tCufflinks\texon\t5872240\t5872268\t1000\t-\t.\tgene_id "CUFF.50289"; transcript_id "CUFF.50289.1"; exon_number "2"; FPKM "7.5439767500"; frac "1.000000"; conf_lo "0.000000"; conf_hi "18.212771"; cov "0.482143";\n+chr13\tCufflinks\ttranscript\t5865442\t5866941\t1000\t+\t.\tgene_id "CUFF.50297"; transcript_id "CUFF.50297.1"; FPKM "13.2019593124"; frac "1.000000"; conf_lo "0.000000"; conf_hi "28.446269"; cov "0.843750";\n+chr13\tCufflinks\texon\t5865442\t5865510\t1000\t+\t.\tgene_id "CUFF.50297"; transcript_id "CUFF.50297.1"; exon_number "1"; FPKM "13.2019593124"; frac "1.000000"; conf_lo "0.000000"; conf_hi "28.446269"; cov "0.843750";\n+chr13\tCufflinks\texon\t5866915\t5866941\t1000\t+\t.\tgene_id "CUFF.50297"; transcript_id "CUFF.50297.1"; exon_number "2"; FPKM "13.2019593124"; frac "1.000000"; conf_lo "0.000000"; conf_hi "28.446269"; cov "0.843750";\n+chr13\tCufflinks\ttranscript\t6583845\t6585843\t1000\t-\t.\tgene_id "CUFF.50339"; transcript_id "CUFF.50339.1"; FPKM "163.2242242265"; frac "1.000000"; conf_lo "127.815919"; conf_hi "198.632530"; cov "10.431818";\n+chr13\tCufflinks\texon\t6583845'..b'2"; cov "5.272727";\n+chr13\tCufflinks\texon\t6587735\t6587966\t1000\t-\t.\tgene_id "CUFF.50341"; transcript_id "CUFF.50341.1"; exon_number "2"; FPKM "82.5011329424"; frac "1.000000"; conf_lo "60.835274"; conf_hi "104.166992"; cov "5.272727";\n+chr13\tCufflinks\ttranscript\t6580385\t6581757\t1000\t-\t.\tgene_id "CUFF.50365"; transcript_id "CUFF.50365.1"; FPKM "324.9135847836"; frac "1.000000"; conf_lo "293.684884"; conf_hi "356.142286"; cov "20.765542";\n+chr13\tCufflinks\texon\t6580385\t6580838\t1000\t-\t.\tgene_id "CUFF.50365"; transcript_id "CUFF.50365.1"; exon_number "1"; FPKM "324.9135847836"; frac "1.000000"; conf_lo "293.684884"; conf_hi "356.142286"; cov "20.765542";\n+chr13\tCufflinks\texon\t6581649\t6581757\t1000\t-\t.\tgene_id "CUFF.50365"; transcript_id "CUFF.50365.1"; exon_number "2"; FPKM "324.9135847836"; frac "1.000000"; conf_lo "293.684884"; conf_hi "356.142286"; cov "20.765542";\n+chr13\tCufflinks\ttranscript\t8803760\t8819743\t1000\t+\t.\tgene_id "CUFF.50481"; transcript_id "CUFF.50481.1"; FPKM "15.1783005269"; frac "1.000000"; conf_lo "2.785270"; conf_hi "27.571331"; cov "0.970060";\n+chr13\tCufflinks\texon\t8803760\t8803879\t1000\t+\t.\tgene_id "CUFF.50481"; transcript_id "CUFF.50481.1"; exon_number "1"; FPKM "15.1783005269"; frac "1.000000"; conf_lo "2.785270"; conf_hi "27.571331"; cov "0.970060";\n+chr13\tCufflinks\texon\t8819697\t8819743\t1000\t+\t.\tgene_id "CUFF.50481"; transcript_id "CUFF.50481.1"; exon_number "2"; FPKM "15.1783005269"; frac "1.000000"; conf_lo "2.785270"; conf_hi "27.571331"; cov "0.970060";\n+chr13\tCufflinks\ttranscript\t8855128\t8864773\t1000\t-\t.\tgene_id "CUFF.50497"; transcript_id "CUFF.50497.1"; FPKM "6.4009499697"; frac "1.000000"; conf_lo "0.000000"; conf_hi "19.202850"; cov "0.409091";\n+chr13\tCufflinks\texon\t8855128\t8855158\t1000\t-\t.\tgene_id "CUFF.50497"; transcript_id "CUFF.50497.1"; exon_number "1"; FPKM "6.4009499697"; frac "1.000000"; conf_lo "0.000000"; conf_hi "19.202850"; cov "0.409091";\n+chr13\tCufflinks\texon\t8864739\t8864773\t1000\t-\t.\tgene_id "CUFF.50497"; transcript_id "CUFF.50497.1"; exon_number "2"; FPKM "6.4009499697"; frac "1.000000"; conf_lo "0.000000"; conf_hi "19.202850"; cov "0.409091";\n+chr13\tCufflinks\ttranscript\t9169898\t9172437\t1000\t+\t.\tgene_id "CUFF.50509"; transcript_id "CUFF.50509.1"; FPKM "41.4918721248"; frac "1.000000"; conf_lo "16.471332"; conf_hi "66.512412"; cov "2.651786";\n+chr13\tCufflinks\texon\t9169898\t9169928\t1000\t+\t.\tgene_id "CUFF.50509"; transcript_id "CUFF.50509.1"; exon_number "1"; FPKM "41.4918721248"; frac "1.000000"; conf_lo "16.471332"; conf_hi "66.512412"; cov "2.651786";\n+chr13\tCufflinks\texon\t9172357\t9172437\t1000\t+\t.\tgene_id "CUFF.50509"; transcript_id "CUFF.50509.1"; exon_number "2"; FPKM "41.4918721248"; frac "1.000000"; conf_lo "16.471332"; conf_hi "66.512412"; cov "2.651786";\n+chr13\tCufflinks\ttranscript\t9353602\t9373527\t1000\t-\t.\tgene_id "CUFF.50527"; transcript_id "CUFF.50527.1"; FPKM "16.2485653076"; frac "1.000000"; conf_lo "0.000000"; conf_hi "35.010792"; cov "1.038462";\n+chr13\tCufflinks\texon\t9353602\t9353648\t1000\t-\t.\tgene_id "CUFF.50527"; transcript_id "CUFF.50527.1"; exon_number "1"; FPKM "16.2485653076"; frac "1.000000"; conf_lo "0.000000"; conf_hi "35.010792"; cov "1.038462";\n+chr13\tCufflinks\texon\t9373497\t9373527\t1000\t-\t.\tgene_id "CUFF.50527"; transcript_id "CUFF.50527.1"; exon_number "2"; FPKM "16.2485653076"; frac "1.000000"; conf_lo "0.000000"; conf_hi "35.010792"; cov "1.038462";\n+chr13\tCufflinks\ttranscript\t9586173\t9593034\t1000\t-\t.\tgene_id "CUFF.50563"; transcript_id "CUFF.50563.1"; FPKM "10.3039682439"; frac "1.000000"; conf_lo "0.000000"; conf_hi "24.875980"; cov "0.658537";\n+chr13\tCufflinks\texon\t9586173\t9586218\t1000\t-\t.\tgene_id "CUFF.50563"; transcript_id "CUFF.50563.1"; exon_number "1"; FPKM "10.3039682439"; frac "1.000000"; conf_lo "0.000000"; conf_hi "24.875980"; cov "0.658537";\n+chr13\tCufflinks\texon\t9592999\t9593034\t1000\t-\t.\tgene_id "CUFF.50563"; transcript_id "CUFF.50563.1"; exon_number "2"; FPKM "10.3039682439"; frac "1.000000"; conf_lo "0.000000"; conf_hi "24.875980"; cov "0.658537";\n'
b
diff -r 000000000000 -r fabda887a71f tool_dependencies.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tool_dependencies.xml Mon Jul 28 11:56:10 2014 -0400
b
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<tool_dependency>
+  <package name="bx-python" version="0.7.1">
+      <repository changeset_revision="2d0c08728bca" name="package_bx_python_0_7" owner="devteam" toolshed="http://toolshed.g2.bx.psu.edu" />
+    </package>
+</tool_dependency>