changeset 60:bf57076e27b9 default tip

change genomicSegment input data
author jingchunzhu@gmail.com
date Tue, 27 Oct 2015 16:07:09 -0700
parents b88b95642f59
children
files seg2matrix/CGData/GenomicSegment.py seg2matrix/mapSegToGeneMatrix.py seg2matrix/segToMatrixGalaxy.py segToGeneMatrix.xml segToMatrix.xml
diffstat 5 files changed, 22 insertions(+), 24 deletions(-) [+]
line wrap: on
line diff
--- 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",
--- 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))
--- 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]))
 
--- 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
--- 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