本文整理汇总了Python中reportlib.init函数的典型用法代码示例。如果您正苦于以下问题:Python init函数的具体用法?Python init怎么用?Python init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了init函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mmrrc
def mmrrc():
mmrrcfp = reportlib.init(sys.argv[0], outputdir = os.environ['QCOUTPUTDIR'], fileExt = '.mmrrc.rpt')
title = 'MMRRC Strains w/ Genotype Associations where the Markers/Alleles of the Strain record\n' + \
'do not exactly match the Markers/Alleles of the Genotype record.'
mmrrcfp.write(title + '\n\n')
mmrrcfp.write('MMRRC#' + reportlib.TAB)
mmrrcfp.write('Strain' + reportlib.TAB)
mmrrcfp.write('Genotypes' + reportlib.TAB)
mmrrcfp.write(reportlib.CRT)
# MMNC Strains w/ Genotype Associations; exclude wild type alleles
db.sql('''
select distinct sa.accID, s.strain, g._Genotype_key, g._Strain_key, a._Marker_key, a._Allele_key
into temporary table strains
from PRB_Strain s, PRB_Strain_Genotype g, GXD_AlleleGenotype a, ALL_Allele aa, ACC_Accession sa
where s.strain like '%/Mmnc'
and s._Strain_key = g._Strain_key
and g._Genotype_key = a._Genotype_key
and a._Allele_key = aa._Allele_key
and aa.isWildType = 0
and s._Strain_key = sa._Object_key
and sa._MGIType_key = 10
and sa._LogicalDB_key = 38
and sa.preferred = 1
''', None)
db.sql('create index strains_idx2 on strains(_Strain_key)', None)
printReport(mmrrcfp)
示例2: writeReport
def writeReport(resultsDict, rptName, category):
fp = reportlib.init(rptName, outputdir = os.environ['QCOUTPUTDIR'], printHeading = None)
if category == 1004: # expressed component, has properties
fp.write('Action%sCategory%sOrganizer ID%sOrganizer symbol%sRelationship ID%sRelationship Name%sParticipant ID%sParticipant Name%sQualifier%sAbbreviation%sEvidence Code%sjnum_id%sCurator ID%sNotes%sProperty:Non-mouse_Organism%sProperty:Non-mouse_Gene_Symbol%sProperty:Non-mouse_NCBI_Gene_ID%s' % (TAB, TAB, TAB, TAB, TAB, TAB, TAB, TAB, TAB, TAB,TAB, TAB, TAB, TAB, TAB, TAB, CRT))
else: # 1003 mutation involves, no properties
fp.write('Action%sCategory%sOrganizer ID%sOrganizer symbol%sRelationship ID%sRelationship Name%sParticipant ID%sParticipant Name%sQualifier%sAbbreviation%sEvidence Code%sjnum_id%sCurator ID%sNotes%s' % (TAB, TAB, TAB, TAB, TAB, TAB,TAB, TAB, TAB, TAB, TAB, TAB, TAB, CRT))
nmOrgVal = ''
nmGSVal = ''
nmGIVal = ''
for r in resultsDict:
# Each record in this list represents the same feature,
# but with different properties
resultsList = resultsDict[r]
cat = resultsList[0]['category']
aId = resultsList[0]['alleleId']
aSym = resultsList[0]['alleleSymbol']
rvId = resultsList[0]['rvId']
rel = resultsList[0]['relationship']
mId = resultsList[0]['markerId']
mSym = resultsList[0]['markerSymbol']
qual = resultsList[0]['qualifier']
evid = resultsList[0]['evidence']
jnum = resultsList[0]['JNum']
curator = resultsList[0] ['login']
notes = resultsList[0]['note']
if notes == None:
notes = ''
if category == 1004: # expresses component, get properties
nmOrgVal = ''
nmGSVal = ''
nmGIVal = ''
for res in resultsList:
propName = res['propName']
propValue = res['propValue']
if propName == None:
continue
elif propName == NON_MOUSE_ORG:
nmOrgVal = propValue
elif propName == NON_MOUSE_GS:
nmGSVal = propValue
elif propName == NON_MOUSE_GI:
nmGIVal = propValue
fp.write('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (cat, TAB, aId, TAB, aSym, TAB, rvId, TAB, rel, TAB, mId, TAB, mSym, TAB, qual, TAB, evid, TAB, jnum, TAB, curator, TAB, notes, TAB, nmOrgVal, TAB, nmGSVal, TAB, nmGIVal, CRT) )
else: # mutation involves
fp.write('%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s' % (cat, TAB, aId, TAB, aSym, TAB, rvId, TAB, rel, TAB, mId, TAB, mSym, TAB, qual, TAB, evid, TAB, jnum, TAB, curator, TAB, notes, CRT) )
reportlib.finish_nonps(fp) # non-postscript file
示例3: initFiles
def initFiles(value):
#
# open input, html files
#
# open input (text) file
try:
inFile = open(value, 'r')
head, tail = os.path.split(value)
# initialize output (html) file
htmlFile = reportlib.init(tail, outputdir = os.environ['RPTDIR'], printHeading = None, isHTML = 1)
except:
print 'Cannot open file: %s' % (value)
sys.exit(1)
return inFile, htmlFile
示例4: mmrrc
def mmrrc():
title = 'Public MMRRC strains whose Alleles are used in a Genotype'
title = title + ' but there is no corresponding Strain/Genotype association\n'
title = title + '(where Genotypes have been created within the last week)'
mmrrcfp = reportlib.init(sys.argv[0], title, \
outputdir = os.environ['QCOUTPUTDIR'], fileExt = '.mmrrc.' + os.environ['DATE'] + '.rpt')
mmrrcfp.write('MMRRC' + TAB)
mmrrcfp.write('Strain' + TAB)
mmrrcfp.write('Genotypes' + CRT*2)
# Retrieve all Strains that have a MMRRC ID and whose Alleles are used in a Genotype
db.sql('drop table strains', None)
db.sql('''
select distinct s._Strain_key,
substring(s.strain,1,70) as strain,
a.accID,
a.numericPart,
g._Genotype_key
into temporary table strains
from PRB_Strain s, ACC_Accession a, PRB_Strain_Marker sm, GXD_Genotype g, GXD_AlleleGenotype ag
where s.private = 0
and s._Strain_key = a._Object_key
and a._MGIType_key = 10
and a._LogicalDB_key = 38
and s._Strain_key = sm._Strain_key
and sm._Allele_key = ag._Allele_key
and ag._Genotype_key = g._Genotype_key
and g.creation_date between %s and current_date
''' % (fromDate), None)
printReport(mmrrcfp)
示例5:
import string
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
#
# Main
#
fp1 = reportlib.init(sys.argv[0], outputdir = os.environ['REPORTOUTPUTDIR'], printHeading = None)
fp2 = reportlib.init('MGI_Geno_DiseaseDO', outputdir = os.environ['REPORTOUTPUTDIR'], printHeading = None)
fp3 = reportlib.init('MGI_Geno_NotDiseaseDO', outputdir = os.environ['REPORTOUTPUTDIR'], printHeading = None)
#
# select all MP annotations
#
db.sql('''select distinct a._Object_key, a._Term_key, e._Refs_key
into temporary table mp
from VOC_Annot a, VOC_Evidence e, VOC_Term t
where a._AnnotType_key = 1002
and a._Qualifier_key = t._Term_key
and t.term is null
and a._Annot_key = e._Annot_key
''', None)
示例6: str
column1 = '' # chromosome
column4 = '' # startCoordinate
column5 = '' # endCoordinate
column7 = '' # strand
# template for column nine
column9 = 'Creator %s; Sequence_tag_ID %s; GenBank_ID %s; DBxref %s; Type %s'
# components of column 9
creator = ''
seqTagID = ''
seqID = ''
mgiID = ''
seqType = 'DNA'
fp = reportlib.init(sys.argv[0], fileExt = '.gff', outputdir = \
outputDir, printHeading = None)
print 'Writing gff file ...'
sys.stdout.flush()
for seqKey in gtCoordDictBySeqKey:
if alleleKeyDictBySeqKey.has_key(seqKey):
coordList = gtCoordDictBySeqKey[seqKey]
column1 = coordList[3]
column4 = str(coordList[0])
column5 = str(coordList[1])
column7 = coordList[2]
alleleKey = alleleKeyDictBySeqKey[seqKey]
seqTagID = seqTagIdsDictBySeqKey[seqKey]
seqID = seqIdDictBySeqKey[seqKey]
示例7:
import re
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
#
# Main
#
fp = reportlib.init(sys.argv[0], 'References with GO status "Full-coded" where there is no GO annotation', os.environ['QCOUTPUTDIR'])
fp.write('''
The reference must be:
group = GO, status = 'Full-coded'
No GO annotation
''')
results = db.sql('''select distinct a.accid as jnumID, b.isDiscard,
to_char(b.creation_date, 'MM/dd/yyyy') as cdate
from BIB_Workflow_status wf, ACC_Accession a, BIB_Refs b
where wf._Group_key = 31576666
and wf.isCurrent = 1
and wf._Status_key = 31576674
and wf._Refs_key = a._Object_key
and a._MGIType_key = 1
示例8: Ontology
# - TR12427/Disease Ontology (DO)
#
'''
import sys
import os
import string
import reportlib
import db
db.setTrace()
TAB = reportlib.TAB
CRT = reportlib.CRT
fp = reportlib.init(sys.argv[0], 'Obsolete/Missing OMIM terms in DO as xrefs', outputdir = os.environ['QCOUTPUTDIR'])
results = db.sql('''
(
select a1.accID as doid, a2.accID as omimid
from ACC_Accession a1, ACC_Accession a2
where a1._MGIType_key = 13
and a1._LogicalDB_key = 191
and a1._Object_key = a2._Object_key
and a1.preferred = 1
and a2._LogicalDB_key = 15
and a2.accID not like 'OMIM:PS%'
and not exists (select 1 from ACC_Accession a3, VOC_Term t
where a2.accID = a3.accID
and a3._MGIType_key = 13
and a3._LogicalDB_key = 15
示例9: open
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
gpiSet = ['PR', 'EMBL', 'ENSEMBL', 'RefSeq']
gpiFileName = os.environ['PUBREPORTDIR'] + '/output/mgi.gpi'
gpiFile = open(gpiFileName, 'r')
gpiLookup = []
fp = reportlib.init(sys.argv[0], '', os.environ['QCOUTPUTDIR'])
fp.write('Marker used in Annotation differs from Marker used in Protein Isoform Ontology\n\n')
fp.write('value\tannotation\tontology\n\n')
results = db.sql('''select p.value, m.symbol as annotation, pm.symbol as isoformlookup
from VOC_Annot a, VOC_Evidence e, VOC_Evidence_Property p, VOC_Term t, MRK_Marker m,
ACC_Accession pa1, VOC_Annot pa, MRK_Marker pm
where a._AnnotType_key = 1000
and a._Object_key = m._Marker_key
and a._Annot_key = e._Annot_key
and e._AnnotEvidence_key = p._AnnotEvidence_key
and p._PropertyTerm_key = t._Term_key
and t.term = 'gene product'
and p.value like 'PR:%'
and p.value = pa1.accID
示例10: Database
import db
db.setTrace()
DB_PREFIX = 'MGI'
SPECIES = 'taxon:10090'
DBTYPE_MARKER = 'gene'
DBTYPE_ISOFORM = 'protein'
DBTYPE_RNA = 'transcript'
TAB = reportlib.TAB
CRT = reportlib.CRT
db.useOneConnection(1)
fp = reportlib.init('mgi', fileExt = '.gpi', outputdir = os.environ['REPORTOUTPUTDIR'], printHeading = None)
fp.write('!gpi-version: 1.2\n')
fp.write('!date: %s $\n' % (mgi_utils.date("%m/%d/%Y")))
fp.write('!\n')
fp.write('! from Mouse Genome Database (MGD) & Gene Expression Database (GXD)\n')
fp.write('!\n')
fp.write('! DB required 1 1 MGI\n')
fp.write('! DB_Object_ID required 1 2/17 MGI:87870\n')
fp.write('! DB_Object_Symbol required 1 3 Acat1\n')
fp.write('! DB_Object_Name optional 0 or greater 10 acetyl-Coenzyme A acetyltransferase 1\n')
fp.write('! DB_Object_Synonym(s) optional 0 or greater 11 Acat|6330585C21Rik\n')
fp.write('! DB_Object_Type required 1 12 gene\n')
fp.write('! Taxon required 1 13 taxon:10090\n')
fp.write('! Parent_Object_ID optional 0 or 1 - if DB_Object_ID = Isoform, then MGI:id of the Isoform\n')
fp.write('! DB_Xref(s) optional 0 or greater - if DB_Object_ID = Isoform, then UniProtKB:id of the Isoform\n')
示例11: process
def process(mode):
# Purpose: process data using either 'sql' or 'bcp' mode
# Returns:
# Assumes:
# Effects:
# Throws:
global notenewline
if mode == 'bcp':
fp1 = reportlib.init('allelecombnotetype1', printHeading = None)
fp2 = reportlib.init('allelecombnotetype2', printHeading = None)
fp3 = reportlib.init('allelecombnotetype3', printHeading = None)
else:
notenewline = '\n'
# delete existiing Allele Combination notes for Genotypes we're processing
if DEBUG:
print '\ndeleting existing allele combination\n'
sys.stdout.flush()
db.sql('''delete from MGI_Note
using toprocess p
where p._Genotype_key = MGI_Note._Object_key
and MGI_Note._MGIType_key = %s
and MGI_Note._NoteType_key in (%s,%s,%s)
''' % (mgiTypeKey, combNoteType1, combNoteType2, combNoteType3), None)
if DEBUG:
print 'finished deleting existing allele combination\n'
sys.stdout.flush()
# read in appropriate records
if DEBUG:
print '\nselecting existing allele combination\n'
sys.stdout.flush()
cmd = '''(
select p._Genotype_key,
p.genotypeID,
t1.term as alleleState,
t2.term as compound,
a1.symbol as allele1,
a2.symbol as allele2,
a1.isWildType as allele1WildType,
a2.isWildType as allele2WildType,
c1.accID as mgiID1,
c2.accID as mgiID2,
g.sequenceNum, m.chromosome
from toprocess p,
GXD_AllelePair g LEFT OUTER JOIN MRK_Marker m on (g._Marker_key = m._Marker_key),
VOC_Term t1, VOC_Term t2, ALL_Allele a1, ALL_Allele a2,
ACC_Accession c1, ACC_Accession c2
where p._Genotype_key = g._Genotype_key
and g._PairState_key = t1._Term_key
and g._Compound_key = t2._Term_key
and g._Allele_key_1 = a1._Allele_key
and g._Allele_key_2 = a2._Allele_key
and g._Allele_key_1 = c1._Object_key
and c1._MGIType_key = 11
and c1._LogicalDB_key = 1
and c1.prefixPart = 'MGI:'
and c1.preferred = 1
and g._Allele_key_2 = c2._Object_key
and c2._MGIType_key = 11
and c2._LogicalDB_key = 1
and c2.prefixPart = 'MGI:'
and c2.preferred = 1
union
select p._Genotype_key,
p.genotypeID,
t1.term as alleleState,
t2.term as compound,
a1.symbol as allele1,
null as allele2,
a1.isWildType as allele1WildType,
0 as allele2WildType,
c1.accID as mgiID1,
null as mgiID2,
g.sequenceNum, m.chromosome
from toprocess p,
GXD_AllelePair g LEFT OUTER JOIN MRK_Marker m on (g._Marker_key = m._Marker_key),
VOC_Term t1, VOC_Term t2, ALL_Allele a1, ACC_Accession c1
where p._Genotype_key = g._Genotype_key
and g._PairState_key = t1._Term_key
and g._Compound_key = t2._Term_key
and g._Allele_key_1 = a1._Allele_key
and g._Allele_key_2 is null
and g._Allele_key_1 = c1._Object_key
and c1._MGIType_key = 11
and c1._LogicalDB_key = 1
and c1.prefixPart = 'MGI:'
and c1.preferred = 1
)
order by _Genotype_key, sequenceNum;\n'''
results = db.sql(cmd, 'auto')
#.........这里部分代码省略.........
示例12: showUsage
try:
optlist, args = getopt.getopt(sys.argv[1:], 'K:')
except:
showUsage()
for opt in optlist:
if opt[0] == '-K':
markerKey = opt[1]
else:
showUsage()
if markerKey is None:
showUsage()
db.useOneConnection(1)
fp = reportlib.init(sys.argv[0], printHeading = None)
marker()
accession()
miscellaneous()
allele()
goAnnotations()
history()
mapping()
probes()
gxd()
db.useOneConnection(0)
reportlib.finish_nonps(fp) # non-postscript file
示例13: in
import re
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
#
# Main
#
fp = reportlib.init(sys.argv[0], 'Supplemental Data Needed', os.environ['QCOUTPUTDIR'])
fp.write('\tReferences where:\n')
fp.write('\t- has J#\n')
fp.write('\t- is not Discard\n')
fp.write('\t- is-reviewe-article = No\n')
fp.write('\t- supplemental in:\n')
fp.write('\t\tDb found supplement\n')
fp.write('\t\tCurator found supplement\n')
fp.write('\t- Status in (Chosen, Indexed)\n')
fp.write('\t- Journal not in "Elife"\n')
fp.write('\t- Sorted by Curator/pm2geneload, Status, J#\n\n')
fp.write('\tbecause the J: assignment triggered a search for:\n')
fp.write('\t- supplemental\n')
fp.write('\t- supplementary\n')
fp.write('\t- additional file\n')
示例14: len
'''
import sys
import os
import string
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
fp = reportlib.init(sys.argv[0], 'References that are marked as "MGI discard" and have data associated with them', os.environ['QCOUTPUTDIR'])
results = db.sql('''select distinct a.accid as jNum, a.numericPart
from BIB_Refs b, MRK_Reference m, ACC_Accession a
where b.isDiscard = 1
and b._Refs_key = m._Refs_key
and m._Refs_key = a._Object_key
and a._MGIType_key = 1
and a._LogicalDB_key = 1
and a.preferred = 1
and prefixPart = 'J:' ''', 'auto')
for r in results:
fp.write('%s%s' % (r['jNum'], CRT))
fp.write('Total: %s' % len(results))
reportlib.finish_nonps(fp) # non-postscript file
示例15:
import reportlib
import db
db.setTrace()
CRT = reportlib.CRT
SPACE = reportlib.SPACE
TAB = reportlib.TAB
PAGE = reportlib.PAGE
#
# Main
#
title = 'Genes without Sequence with GXD Annotations'
fp = reportlib.init(sys.argv[0], title = title, outputdir = os.environ['QCOUTPUTDIR'])
fp.write(' includes "official"\n')
fp.write(' excludes "DNA Segment"\n\n')
fp.write(string.ljust('Gene Symbol', 30) + \
string.ljust('Marekr Type', 30) + \
string.ljust('GXD Refs', 30) + \
CRT)
fp.write(string.ljust('-----------', 30) + \
string.ljust('-----------', 30) + \
string.ljust('--------', 30) + \
CRT)
#