Esempio n. 1
0
along with D3E.  If not, see <http://www.gnu.org/licenses/>.

'''

from D3EUtil import readData
import sys

inFileName = sys.argv[1]
label1 = sys.argv[2]
label2 = sys.argv[3]
outDir = sys.argv[4]
n = int(sys.argv[5])

inFile = open(inFileName)

data1, data2, ids, lineStatus = readData(inFile,
                                         label1,
                                         label2,
                                         normalise=True)

i = 0

for p1, p2, idx in zip(data1, data2, ids):
    if i % n == 0:
        ouputFile = open(
            outDir + label1 + '_' + label2 + '_' + str(i / n) + '.txt', 'w')
        ouputFile.write('GeneID\t' + '\t'.join([label1] * len(data1[0]) +
                                               [label2] * len(data2[0])) +
                        '\n')
    ouputFile.write('\t'.join([idx] + [str(x) for x in p1 + p2]) + '\n')
    i = i + 1
Esempio n. 2
0
D3E is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with D3E.  If not, see <http://www.gnu.org/licenses/>.

'''

from D3EUtil import readData
import sys

inFileName = sys.argv[1]
label1 = sys.argv[2]
label2 =sys.argv[3]
outDir = sys.argv[4]
n = int(sys.argv[5])

inFile = open(inFileName)

data1, data2, ids, lineStatus = readData(inFile, label1, label2, normalise = True)

i = 0

for p1, p2, idx in zip(data1, data2, ids):
	if i % n == 0:
		ouputFile = open( outDir + label1 + '_' + label2 + '_' + str(i/n) + '.txt', 'w' )
		ouputFile.write('GeneID\t' + '\t'.join( [label1] * len(data1[0]) + [label2] * len(data2[0]) ) + '\n' )
	ouputFile.write('\t'.join ( [idx] + [str(x) for x in p1+p2] ) + '\n')
	i = i + 1
Esempio n. 3
0
                    action='store_const',
                    const=True,
                    dest='verbose',
                    default=True,
                    help='verbose')
parser.add_argument('-f',
                    '--fdr',
                    action='store',
                    type=float,
                    dest='fdr',
                    default=1,
                    help='FDR parameter')
args = parser.parse_args()

data1, data2, ids, lineStatus = readData(args.inputFile, args.label1[0],
                                         args.label2[0], args.normalise,
                                         args.removeZeros, args.useSpikeIns,
                                         args.spikeInStart)

if args.verbose:
    for status in lineStatus:
        logStatus(status)

if args.mode == 0:
    args.outputFile.write(
        '#GeneID\ta1\tb1\tg1\tGOF1\ta2\tb2\tg2\tGOF2\ts1\tf1\td1\ts2\tf2\td2\tRs\tRf\tRd\tp-value\tmu1\tcv1\tmu2\tcv2\n\n'
    )
elif args.mode == 1:
    args.outputFile.write(
        '#GeneID\ta1\tb1\tg1\tGOF1\ta2\tb2\tg2\tGOF2\ts1\tf1\td1\ts2\tf2\td2\tRs\tRf\tRd\tpSize\tpFreq\tpDuty\tp-value\tmu1\tcv1\tmu2\tcv2\n\n'
    )
Esempio n. 4
0
	beta = params.beta
	gamma = params.gamma

	return BioParams( gamma / beta, alpha, alpha * beta / (alpha + beta) )

inputString = fileinput.input()[0].rstrip('\n')

inputJSON = json.loads(inputString)
inputFile = StringIO.StringIO(inputJSON['input']);
label1 = inputJSON['label1']
label2 = inputJSON['label2']
normalise = int(inputJSON['normalise'])
removeZeros = inputJSON['removeZeros']
useSpikeIns = inputJSON['useSpikeIns']

data1, data2, ids, lineStatus = readData(inputFile, label1, label2, normalise, removeZeros, useSpikeIns)

errors = []
rows = []
cols = []

for status in lineStatus:
	if status.code == 1:
		errors.append( {'geneId': status.idx, 'message': 'Warning: ' + status.message}  )
	elif status.code == 2:
		errors.append( {'geneId': status.idx, 'message': 'Error: ' + status.message}  )


rowKeys = ["geneId"]
rowKeys.extend( ["col" + str(i) for i in range(1,21)] )
Esempio n. 5
0
(at your option) any later version.

D3E is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with D3E.  If not, see <http://www.gnu.org/licenses/>.

'''

import sys
from D3EUtil import readData

inFileName = sys.argv[1]
outFileName = sys.argv[2]
label = sys.argv[3]

inFile = open(inFileName)
outFileName = open(outFileName,'w')

p1, p2, ids, lineStatus = readData(inFile, label, label, normalise=False, removeZeros=False, useSpikeIns = False, verbose = True)

n = len(p1[0]) / 2

outFileName.write('GeneID\t' + '\t'.join( [ label+'_1' ] * n + [label+'_2'] * (len(p1[0])-n) ) + '\n')

for idx, p in zip(ids, p1):
	outFileName.write(idx + '\t' + '\t'.join( str(int(x)) for x in p ) + '\n')
Esempio n. 6
0
You should have received a copy of the GNU General Public License
along with D3E.  If not, see <http://www.gnu.org/licenses/>.

'''

import sys
from D3EUtil import readData

inFileName = sys.argv[1]
outFileName = sys.argv[2]
label = sys.argv[3]

inFile = open(inFileName)
outFileName = open(outFileName, 'w')

p1, p2, ids, lineStatus = readData(inFile,
                                   label,
                                   label,
                                   normalise=False,
                                   removeZeros=False,
                                   useSpikeIns=False,
                                   verbose=True)

n = len(p1[0]) / 2

outFileName.write('GeneID\t' + '\t'.join([label + '_1'] * n + [label + '_2'] *
                                         (len(p1[0]) - n)) + '\n')

for idx, p in zip(ids, p1):
    outFileName.write(idx + '\t' + '\t'.join(str(int(x)) for x in p) + '\n')