Mercurial > repos > peterjc > venn_list
comparison tools/plotting/venn_list.py @ 3:6aae6bc0802d draft
Uploaded v0.0.6, basic unit test, MIT licence, RST README, citation information, development moved to GitHub
author | peterjc |
---|---|
date | Wed, 18 Sep 2013 06:19:51 -0400 |
parents | baf7031d470e |
children |
comparison
equal
deleted
inserted
replaced
2:c96bef0643dc | 3:6aae6bc0802d |
---|---|
3 | 3 |
4 This script is copyright 2010 by Peter Cock, The James Hutton Institute | 4 This script is copyright 2010 by Peter Cock, The James Hutton Institute |
5 (formerly SCRI), UK. All rights reserved. | 5 (formerly SCRI), UK. All rights reserved. |
6 See accompanying text file for licence details (MIT/BSD style). | 6 See accompanying text file for licence details (MIT/BSD style). |
7 | 7 |
8 This is version 0.0.3 of the script. | 8 This is version 0.0.4 of the script. |
9 """ | 9 """ |
10 | 10 |
11 | 11 |
12 import sys | 12 import sys |
13 import rpy | 13 import rpy |
44 print "Doing %i-way Venn Diagram" % n | 44 print "Doing %i-way Venn Diagram" % n |
45 | 45 |
46 def load_ids(filename, filetype): | 46 def load_ids(filename, filetype): |
47 if filetype=="tabular": | 47 if filetype=="tabular": |
48 for line in open(filename): | 48 for line in open(filename): |
49 if not line.startswith("#"): | 49 line = line.rstrip("\n") |
50 yield line.rstrip("\n").split("\t",1)[0] | 50 if line and not line.startswith("#"): |
51 yield line.split("\t",1)[0] | |
51 elif filetype=="fasta": | 52 elif filetype=="fasta": |
52 for line in open(filename): | 53 for line in open(filename): |
53 if line.startswith(">"): | 54 if line.startswith(">"): |
54 yield line[1:].rstrip("\n").split(None,1)[0] | 55 yield line[1:].rstrip("\n").split(None,1)[0] |
55 elif filetype.startswith("fastq"): | 56 elif filetype.startswith("fastq"): |