aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
authorPjotr Prins2015-03-05 17:27:36 +0300
committerPjotr Prins2015-03-05 17:27:36 +0300
commitb9d8057c2017ade6dd6ce54c45d718beb7c25c6a (patch)
tree54e06e5ed89680adaff0452b7d57375cfea0e31b /wqflask
parent0754dbf77f4362beaef45b0ac651676d47659b70 (diff)
downloadgenenetwork2-b9d8057c2017ade6dd6ce54c45d718beb7c25c6a.tar.gz
Kinship file format support (reader and writer)
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py1
-rw-r--r--wqflask/wqflask/my_pylmm/pyLMM/runlmm.py49
2 files changed, 49 insertions, 1 deletions
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
index 35fccef4..012e96b2 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/convertlmm.py
@@ -23,7 +23,6 @@ import numpy as np
# from lmm import LMM, run_other
import input
-
usage = """
python convertlmm.py [--kinship] infile
diff --git a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
index df86f718..4a640d6d 100644
--- a/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
+++ b/wqflask/wqflask/my_pylmm/pyLMM/runlmm.py
@@ -17,4 +17,53 @@
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+from optparse import OptionParser
+import sys
+import os
+import numpy as np
+# from lmm import LMM, run_other
+import csv
+
+usage = """
+python runlmm.py [options] command
+
+ runlmm.py processing multiplexer reads standard input types and calls the routines
+
+ Current commands are:
+
+ parse : only parse input files
+
+ try --help for more information
+"""
+
+parser = OptionParser(usage=usage)
+# parser.add_option("-f", "--file", dest="input file",
+# help="In", metavar="FILE")
+parser.add_option("--kinship",dest="kinship",
+ help="Kinship file format")
+parser.add_option("-q", "--quiet",
+ action="store_false", dest="verbose", default=True,
+ help="don't print status messages to stdout")
+
+(options, args) = parser.parse_args()
+
+if len(args) != 1:
+ print usage
+ sys.exit(1)
+
+cmd = args[0]
+print "Command: ",cmd
+
+if options.kinship:
+ K1 = []
+ print options.kinship
+ with open(options.kinship,'r') as tsvin:
+ assert(tsvin.readline().strip() == "# Kinship format version 1.0")
+ tsvin.readline()
+ tsvin.readline()
+ tsv = csv.reader(tsvin, delimiter='\t')
+ for row in tsv:
+ ns = np.genfromtxt(row[1:])
+ K1.append(ns) # <--- slow
+ K = np.array(K1)