diff seg2matrix/segToMatrixGalaxy.py @ 54:59dbe857f5d4

introduce normal_CNV parameter
author jingchunzhu
date Thu, 17 Sep 2015 22:03:04 -0700
parents 7de3db823f90
children bf57076e27b9
line wrap: on
line diff
--- a/seg2matrix/segToMatrixGalaxy.py	Thu Sep 17 15:38:53 2015 -0700
+++ b/seg2matrix/segToMatrixGalaxy.py	Thu Sep 17 22:03:04 2015 -0700
@@ -33,24 +33,25 @@
 
 
 if __name__ == "__main__":
-    if len(sys.argv[:])!= 5:
-        print "python segToMatrixGalaxy.py inputSegmentFile refGeneFile outputMatrix outputProbeMap\n"
+    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(sys.argv[2])
-#    refgene.load(os.path.dirname(sys.argv[0])+"/"+sys.argv[2])
+    refgene.load(os.path.dirname(sys.argv[0])+"/"+os.path.basename(sys.argv[2]))
+
+    NORMAL_CNV = sys.argv[5]
 
     handle = open(sys.argv[3], "w")
     m = matrix_write(handle)    
-    CGData.SegToMatrix.seg_to_matrix(seg, m)
+    CGData.SegToMatrix.seg_to_matrix(seg, m, NORMAL_CNV)
     handle.close()
     
     handle = open(sys.argv[4], "w")
     probeMapper = CGData.GeneMap.ProbeMapper('b')
-    handle.write("%s\t%s\t%s\t%s\t%s\t%s\n" % ("#id", "gene","chrom","chromStart","chromEnd","strand"))
+    handle.write("%s\t%s\t%s\t%s\t%s\t%s\n" % ("id", "gene","chrom","chromStart","chromEnd","strand"))
     for probe in m.probes:
         hits = []
         for hit in probeMapper.find_overlap( probe, refgene ):