# HG changeset patch # User jingchunzhu@gmail.com # Date 1445987229 25200 # Node ID bf57076e27b9f64d2c63d7805c380ac2dde6a8af # Parent b88b95642f593c1d997c3496eb1df01c033bba2f change genomicSegment input data diff -r b88b95642f59 -r bf57076e27b9 seg2matrix/CGData/GenomicSegment.py --- a/seg2matrix/CGData/GenomicSegment.py Tue Sep 22 15:41:03 2015 -0700 +++ b/seg2matrix/CGData/GenomicSegment.py Tue Oct 27 16:07:09 2015 -0700 @@ -13,7 +13,6 @@ "chrom", "chrom_start", "chrom_end", - "strand", "value" ], "groupKey" : "id", diff -r b88b95642f59 -r bf57076e27b9 seg2matrix/mapSegToGeneMatrix.py --- a/seg2matrix/mapSegToGeneMatrix.py Tue Sep 22 15:41:03 2015 -0700 +++ b/seg2matrix/mapSegToGeneMatrix.py Tue Oct 27 16:07:09 2015 -0700 @@ -48,11 +48,11 @@ if line[0]=="#": continue tmp = string.split(line,"\t") - if len(tmp)!= 6: + if len(tmp)!= 5: continue - seg = segToProbeMap.probeseg("", tmp[1], int(tmp[2]), int(tmp[3]),tmp[4]) + seg = segToProbeMap.probeseg("", tmp[1], int(tmp[2]), int(tmp[3]),".") sample = tmp[0] - value = float(tmp[5]) + value = float(tmp[4]) if sample not in samples: samples[sample]=len(samples) matrix.append(copy.deepcopy(oneSample)) diff -r b88b95642f59 -r bf57076e27b9 seg2matrix/segToMatrixGalaxy.py --- a/seg2matrix/segToMatrixGalaxy.py Tue Sep 22 15:41:03 2015 -0700 +++ b/seg2matrix/segToMatrixGalaxy.py Tue Oct 27 16:07:09 2015 -0700 @@ -1,6 +1,6 @@ #!/usr/bin/env python -import sys,os +import sys,os, string import CGData.GenomicSegment import CGData.SegToMatrix import CGData.RefGene @@ -15,7 +15,7 @@ self.buff += s if s.endswith("\n"): tmp = self.buff.split("\t") - if tmp[0] != "probe": + if string.strip(tmp[0]) != "probe": tmp2 = tmp[0].split("_") p = probeseg(tmp[0], tmp2[0], int(tmp2[1]), int(tmp2[2])) self.probes.append(p) @@ -31,14 +31,13 @@ self.chrom_end = chrom_end self.strand = "." - if __name__ == "__main__": if len(sys.argv[:])!= 6: print "python segToMatrixGalaxy.py inputSegmentFile refGeneFile outputMatrix outputProbeMap NORMAL_CNV\n" sys.exit() seg = CGData.GenomicSegment.GenomicSegment() seg.load(sys.argv[1]) - + refgene = CGData.RefGene.RefGene() refgene.load(os.path.dirname(sys.argv[0])+"/"+os.path.basename(sys.argv[2])) diff -r b88b95642f59 -r bf57076e27b9 segToGeneMatrix.xml --- a/segToGeneMatrix.xml Tue Sep 22 15:41:03 2015 -0700 +++ b/segToGeneMatrix.xml Tue Oct 27 16:07:09 2015 -0700 @@ -30,14 +30,14 @@ 1. Input data file format: tab-deliminated - ======= ===== ======= ===== ====== ====== - sample chr start end strand value - ======= ===== ======= ===== ====== ====== - sample1 chr1 1 100 . 0.5 - sample2 chr1 101 1000 . 1.5 - sample3 chr1 1000 2000 . -0.5 - ... ... ... ... ... ... - ======= ===== ======= ===== ====== ====== + ======= ===== ======= ===== ====== + sample chr start end value + ======= ===== ======= ===== ====== + sample1 chr1 1 100 0.5 + sample2 chr1 101 1000 1.5 + sample3 chr1 1000 2000 -0.5 + ... ... ... ... ... + ======= ===== ======= ===== ====== 2. Output file: gene-level matrix file diff -r b88b95642f59 -r bf57076e27b9 segToMatrix.xml --- a/segToMatrix.xml Tue Sep 22 15:41:03 2015 -0700 +++ b/segToMatrix.xml Tue Oct 27 16:07:09 2015 -0700 @@ -31,14 +31,14 @@ 1. Input data file format: tab-deliminated - ======= ===== ======= ===== ====== ====== - sample chr start end strand value - ======= ===== ======= ===== ====== ====== - sample1 chr1 1 100 . 0.5 - sample2 chr1 101 1000 . 1.5 - sample3 chr1 1000 2000 . -0.5 - ... ... ... ... ... ... - ======= ===== ======= ===== ====== ====== + ======= ===== ======= ===== ====== + sample chr start end value + ======= ===== ======= ===== ====== + sample1 chr1 1 100 0.5 + sample2 chr1 101 1000 1.5 + sample3 chr1 1000 2000 -0.5 + ... ... ... ... ... + ======= ===== ======= ===== ====== 2. Output File no 1. matrix file