Example #1
0
#use a sample map to check for sample overlaps between matrix files

import sys
from cgData.matrix import GeneMatrix
from cgData.sampleMap import SampleMap

handle = open( sys.argv[1] )
sm = SampleMap()
sm.read( handle )
handle.close()

gmList = []
sampleHash = {}
for path in sys.argv[2:]:
    gm = GeneMatrix()
    handle = open( path )
    gm.readTSV( handle, skipVals=True )
    handle.close()
    gmList.append( gm )
    for sample in gm.getSampleList():
        if sample not in sampleHash:
            sampleHash[ sample ] = []
        sampleHash[ sample ].append( path )

sampleRemap = {}
for sample in sampleHash:
    children = sm.getChildren( sample ) 
    for c in children:
        if c in sampleHash:
            sampleRemap[ c ] = sample
Example #2
0
#!/usr/bin/env python

from cgData.matrix import GeneMatrix
import sys

handle = open(sys.argv[1])

gm = GeneMatrix()
gm.readTSV(handle)

gm.writeGCT(sys.stdout, missing="0")
Example #3
0
#!/usr/bin/env python

from cgData.matrix import GeneMatrix
import sys


handle = open( sys.argv[1] )

gm = GeneMatrix()
gm.readTSV( handle )

gm.writeGCT( sys.stdout, missing="0" )