Repository 'check_snpeff_candidates'
hg clone https://toolshed.g2.bx.psu.edu/repos/gregory-minevich/check_snpeff_candidates

Changeset 0:a3873bb68495 (2012-03-20)
Next changeset 1:bc7cc93ef659 (2012-03-26)
Commit message:
Uploaded
added:
._checkSnpEffCandidates.py
._checkSnpEffCandidates.xml
checkSnpEffCandidates.py
checkSnpEffCandidates.xml
b
diff -r 000000000000 -r a3873bb68495 ._checkSnpEffCandidates.py
b
Binary file ._checkSnpEffCandidates.py has changed
b
diff -r 000000000000 -r a3873bb68495 ._checkSnpEffCandidates.xml
b
Binary file ._checkSnpEffCandidates.xml has changed
b
diff -r 000000000000 -r a3873bb68495 checkSnpEffCandidates.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/checkSnpEffCandidates.py Tue Mar 20 11:02:34 2012 -0400
[
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+
+import sys
+import optparse
+import csv
+import re
+
+def main():
+ parser = optparse.OptionParser()
+ parser.add_option('-s', '--snpeff_file', dest = 'snpeff_file', action = 'store', type = 'string', default = None, help = "Path to the snpEff file")
+ parser.add_option('-c', '--candidate_list', dest = 'candidate_list', action = 'store', type = 'string', default = None, help = "Two column tabular list of candidate Gene ID, Type")
+ parser.add_option('-o', '--output', dest = 'output', action = 'store', type = 'string', default = None, help = "Output file name")
+ (options, args) = parser.parse_args()
+
+ snpeff_file = options.snpeff_file
+ candidate_list = options.candidate_list
+
+ candidates = parse_candidate_list(candidate_list = candidate_list)
+ mark_snpeff_file(snpeff_file = snpeff_file, output = options.output, candidates = candidates)
+
+def skip_and_write_headers(writer = None, reader = None, i_file = None):
+ # count headers
+ comment = 0
+ while reader.next()[0].startswith('#'):
+ comment = comment + 1
+
+ # skip and write headers
+ i_file.seek(0)
+ for i in range(0, comment):
+ row = reader.next()
+ writer.writerow(row)
+
+def parse_candidate_list(candidate_list = ""):
+ i_file = open(candidate_list, 'rU')
+ reader  = csv.reader(i_file, delimiter = '\t',)
+
+ candidates = {}
+ for row in reader:
+ gene_id = row[0]
+ gene_type = row[1]
+ candidates[gene_id] = gene_type
+
+ i_file.close()
+
+ return candidates
+
+def mark_snpeff_file(snpeff_file = "", output = "", candidates = None):
+ i_file = open(snpeff_file, 'rU')
+ reader = csv.reader(i_file, delimiter = '\t')
+
+ o_file = open(output, 'wb')
+ writer = csv.writer(o_file, delimiter = '\t')
+
+ skip_and_write_headers(writer = writer, reader = reader, i_file = i_file)
+
+ for row in reader:
+ gene_id = row[9]
+ if gene_id in candidates:
+ gene_type = candidates[gene_id]
+ row.append(gene_type)
+ else:
+ row.append('')
+
+ writer.writerow(row)
+
+ o_file.close()
+ i_file.close()
+
+if __name__ == "__main__":
+    main()
b
diff -r 000000000000 -r a3873bb68495 checkSnpEffCandidates.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/checkSnpEffCandidates.xml Tue Mar 20 11:02:34 2012 -0400
b
@@ -0,0 +1,51 @@
+<tool id="check_snpeff_candidates" name="Check snpEff Candidates">
+    <description>Marks up a snpEff output file with matches to a gene candidate list.</description>
+    <command interpreter="python">checkSnpEffCandidates.py -s $snpeff_file -c $candidate_list -o $output</command>
+    <inputs>
+        <param name="snpeff_file" type="data" format="tabular" label="SnpEff File" help="tabular output file from snpEff"/>
+        <param name="candidate_list" type="data" format="tabular" label="Candidate List" help="2 column list consisting of candidate genes and a description"/>
+    </inputs>
+    <outputs>
+        <data format="tabular" name="output" />
+    </outputs>
+    <requirements>
+        <requirement type="python-module">sys</requirement>
+        <requirement type="python-module">optparse</requirement>
+        <requirement type="python-module">csv</requirement>
+    </requirements>
+    <tests>
+ <param name="snpeff_file" value="" />
+ <param name="candidate_list" value="" />
+    </tests>
+    <help>
+
+**What it does:** 
+
+Indicates on a SnpEff output file which genes are found in a candidate list by comparing Gene IDs.  
+
+For a description of the snpEff variant annotation and effect prediction tool:
+
+http://snpeff.sourceforge.net
+
+------
+
+**Input:** 
+
+The candidate list should be in a tabular format with two columns: Gene ID and Gene Description (e.g. C55B7.12 and transcription_factor). The file should contain no headers.
+
+Useful candidate lists (e.g. transcription factors, genes expressed in neurons, transgene silencers, chromatin factors) are available on the Hobert Lab website:
+
+http://biochemistry.hs.columbia.edu/labs/hobert/literature.html
+
+
+------
+
+**Citation:**
+
+This tool is part of the CloudMap package from the Hobert Lab. If you use this tool, please cite `Gregory Minevich, Danny Park, Richard J. Poole and Oliver Hobert CloudMap: A Cloud-based Pipeline for Analysis of Mutant Genome Sequences. (2012 In Preparation)`__
+
+    .. __: http://biochemistry.hs.columbia.edu/labs/hobert/literature.html
+
+
+    </help>
+</tool>