Exemplo n.º 1
0
# A script to get transcript family expression levels (reads per family) based on transcript mapping from bowtie (output from bowtie modified by awk to ease data handling) with one file listing where bowtie mapped the read and the other listing the actual transcript from which the read was derived
# Modified 2012.04.12
# Author A. Black P.

# Usage: python getTranscriptFamilyReadCountsFromTranscriptMapping.py geneGroups.input.txt bowtie.input.map.bowtie bowtie.input.map.actual output.bowtie.txt output.actual.txt

import makeRandomTestData, sys

infileGroups = sys.argv[1]
infileMap = sys.argv[2]
infileActual = sys.argv[3]
outfileMap = sys.argv[4]
outfileActual = sys.argv[5]

groups = {}
realExp = {}
print 'Reading groups data\n'
groups = makeRandomTestData.inputSimilarGroups(groups, infileGroups)
print 'Calculating mapping transcript family expression\n'
geneExp = makeRandomTestData.findGeneExpressionFromTranscripts2(groups, infileMap)
print 'Writing mapping transcript family expression\n'
tmp = makeRandomTestData.outputSimilarGroups(geneExp, outfileMap)
print 'Calculating actual transcript family expression\n'
actualExp = makeRandomTestData.findGeneExpressionFromTranscripts2(groups, infileActual)
print 'Writing actual transcript family expression\n'
tmp = makeRandomTestData.outputSimilarGroups(actualExp, outfileActual)
print 'Finished!'
# A script to get isform groups from a fasta file
# Created 2012.02.10
# Author A. Black P.

# Usage: python getIsoformGroupsBowtie.py input.fa names.fa output.txt

import makeRandomTestData, sys

fileIn = sys.argv[1]
fileNames = sys.argv[2]
fileOut = sys.argv[3]

groups = {}
seqs = {}
for newString in open(fileNames):
    newString = newString.rstrip()
    ids = newString.split(',')
    seqs[ids[0]] = newString
groups = makeRandomTestData.generateGroupsBowtie(groups, fileIn)
groups = makeRandomTestData.restoreIdentifiersEnsembl(groups, seqs)
tmp = makeRandomTestData.outputSimilarGroups(groups, fileOut)

print 'Finished!'
# A script to create a groups file from the transcript family reads produced in getTranscriptFamilyReads.py that have been run through bowtie
# Created 2012.04.10
# Author A. Black P.

# Usage: python getTranscriptFamilyGroups.py input.txt output.txt

import makeRandomTestData, sys

fileIn = sys.argv[1]
fileOut = sys.argv[2]

groups = {}
groups = makeRandomTestData.generateGroupsBowtie(groups, fileIn)
#groups = makeRandomTestData.reassignSimilarGroupKeys(groups)
tmp = makeRandomTestData.outputSimilarGroups(groups, fileOut)
tmp = makeRandomTestData.outputSimilarGroupsOneToOne(groups, fileOut + 'OneToOne')
print 'Finished!'