当前位置: 首页>>代码示例>>Python>>正文


Python reportlib.finish_nonps函数代码示例

本文整理汇总了Python中reportlib.finish_nonps函数的典型用法代码示例。如果您正苦于以下问题:Python finish_nonps函数的具体用法?Python finish_nonps怎么用?Python finish_nonps使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了finish_nonps函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: exit

def exit(
    status,          # numeric exit status (integer)
    message = None   # exit message (string)
    ):

    # Purpose:
    # Returns: nothing
    # Assumes: nothing
    # Effects: nothing
    # Throws: nothing

    if message is not None:
        sys.stderr.write('\n' + str(message) + '\n')
 
    try:
        diagFile.write('\n\nEnd Date/Time: %s\n' % (mgi_utils.date()))
        diagFile.close()
    except:
        pass

    try:
        reportlib.finish_nonps(reportFile)
    except:
	pass

    db.useOneConnection(0)
    sys.exit(status)
开发者ID:mgijax,项目名称:vocload,代码行数:27,代码来源:GOremoveannot.py

示例2: printReport

def printReport(fp):

    # Same Strains and the Marker/Allele associations
    db.sql('''
	select s._Strain_key, a._Marker_key, a._Allele_key 
	into temporary table strains2 
	from strains s, PRB_Strain_Marker a 
	where s._Strain_key = a._Strain_key
	''', None)
    db.sql('create index strains2_idx1 on strains2(_Strain_key)', None)

    # Strains that do not have the same Allele
    
    db.sql('''
	select s.* into temporary table strainsToProcess from strains s 
	where not exists (select 1 from strains2 ss where s._Strain_key = ss._Strain_key 
	and s._Allele_key = ss._Allele_key)
	''', None)

    # Retrieve MGI ids of the Genotypes

    mgiIDs = {}
    results = db.sql('''
	select s._Strain_key, a.accID 
	from strainsToProcess s, ACC_Accession a 
	where s._Genotype_key = a._Object_key 
	and a._MGIType_key = 12 
	and a._LogicalDB_key = 1 
	and a.preferred = 1
	''', 'auto')
    for r in results:
        key = r['_Strain_key']
        value = r['accID']
        if not mgiIDs.has_key(key):
	    mgiIDs[key] = []
        mgiIDs[key].append(value)

    # Process

    rows = 0
    results = db.sql('select distinct _Strain_key, accID, strain from strainsToProcess order by strain', 'auto')
    for r in results:
        key = r['_Strain_key']
        fp.write(r['accID'] + reportlib.TAB)
        fp.write(r['strain'] + reportlib.TAB)
        fp.write(string.join(mgiIDs[key], ',') + reportlib.CRT)

    fp.write('\n(%d rows affected)\n' % (len(results)))

    db.sql('drop table strains', None)
    db.sql('drop table strains2', None)
    db.sql('drop table strainsToProcess', None)

    reportlib.finish_nonps(fp)
开发者ID:mgijax,项目名称:qcreports_db,代码行数:54,代码来源:PRB_StrainJAX3.py

示例3: processMGI_8columns

def processMGI_8columns():
    #
    # process MGI-oriented reports with 8 columns
    #

    # iterate thru files
    
    for b in column8Files:

        value = os.environ[b]
	inFile, htmlFile = initFiles(value)

        # print html header

        htmlFile.write(tableStart + CRT)
        htmlFile.write('<TD>Marker</TD>')
        htmlFile.write('<TD>Symbol</TD>')
        htmlFile.write('<TD>Chromosome</TD>')
        htmlFile.write('<TD>Entrez Gene</TD>')
        htmlFile.write('<TD>Associated Sequences</TD>')
	htmlFile.write('<TD>Marker Type</TD>' + CRT)

        # iterate thru input file

        for line in inFile.readlines():

	    tokens = string.split(line, TAB)

	    if len(tokens) < 3:
		continue

	    mgiID = tokens[0]
	    mgiSymbol = tokens[1]
            mgiChromosome = tokens[2]
	    egID = tokens[3]
            sequences = tokens[6]
	    markerType = tokens[7]

	    htmlFile.write('<TR><TD>' + mgiAnchor(mgiID) + '</TD>')
	    htmlFile.write('<TD>' + mgiSymbol + '</TD>')
	    htmlFile.write('<TD>' + mgiChromosome + '</TD>')
	    htmlFile.write('<TD>' + externalAnchor(egID, EG_URL_KEY) + '</TD>')
	    htmlFile.write('<TD>' + idAnchors(sequences) + '</TD>')
	    htmlFile.write('<TD>' + markerType + '</TD></TR>')
	    htmlFile.write(CRT)

        htmlFile.write(tableEnd)

        inFile.close()
        reportlib.finish_nonps(htmlFile, isHTML = 1)
开发者ID:mgijax,项目名称:egload,代码行数:50,代码来源:formatreports.py

示例4: 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
开发者ID:mgijax,项目名称:qcreports_db,代码行数:50,代码来源:PHENO_Features.py

示例5: printReport

def printReport(fp):

    db.sql('create index idx1 on strains(_Strain_key)', None)
    db.sql('create index idx2 on strains(_Genotype_key)', None)

    genotypes = {}
    results = db.sql('''
	    select distinct s._Strain_key, a.accID, a.numericPart
	    from strains s, ACC_Accession a 
	    where s._Genotype_key = a._Object_key 
	    and a._MGIType_key = 12 
	    and a._LogicalDB_key = 1 
	    and a.prefixPart = 'MGI:' 
	    and a.preferred = 1
	    order by a.numericPart''', 'auto')
    for r in results:
        key = r['_Strain_key']
        value = r['accID']
        if not genotypes.has_key(key):
	    genotypes[key] = []
        genotypes[key].append(value)

    results = db.sql('''
	    (
	    select distinct s._Strain_key, s.strain, s.accID, s.numericPart
	    from strains s
	    where not exists (select 1 from PRB_Strain_Genotype g where s._Strain_key = g._Strain_key and s._Genotype_key = g._Genotype_key)
	    and exists (select 1 from VOC_Annot va where va._AnnotType_key = 1002 and s._Genotype_key = va._Object_key)
	    union
	    select distinct s._Strain_key, s.strain, s.accID, s.numericPart
	    from strains s
	    where not exists (select 1 from PRB_Strain_Genotype g where s._Strain_key = g._Strain_key and s._Genotype_key = g._Genotype_key)
	    and exists (select 1 from VOC_Annot va where va._AnnotType_key = 1020 and s._Genotype_key = va._Object_key)
	    )
	    order by numericPart''', 'auto')
    for r in results:
        fp.write(r['accID'] + TAB)
        fp.write(r['strain'] + TAB)
        fp.write(string.join(genotypes[r['_Strain_key']], ',') + CRT)

    fp.write('\n(%d rows affected)\n' % (len(results)))
    reportlib.finish_nonps(fp)
开发者ID:mgijax,项目名称:qcreports_db,代码行数:42,代码来源:PRB_StrainJAX2.py

示例6: processMGI_2columns

def processMGI_2columns():
    #
    # process MGI-oriented reports w/ 2 columns
    #

    # iterate thru files

    for b in column2Files:

        value = os.environ[b]
        inFile, htmlFile = initFiles(value)

        # print html header

        htmlFile.write(tableStart + CRT)
	htmlFile.write('<TD>Marker</TD>' + CRT)
        htmlFile.write('<TD>EG ID</TD>')

        # iterate thru input file

        for line in inFile.readlines():

            tokens = string.split(line, TAB)

	    if len(tokens) < 2:
		continue

            egID = tokens[0]
            mgiID = tokens[1]
	    htmlFile.write('<TR><TD>' + mgiAnchor(mgiID) + '</TD>')
	    htmlFile.write('<TD>' + egID + '</TD>')
            htmlFile.write(CRT)

        htmlFile.write(tableEnd)

        inFile.close()
        reportlib.finish_nonps(htmlFile, isHTML = 1)
开发者ID:mgijax,项目名称:egload,代码行数:37,代码来源:formatreports.py

示例7:

# retrieve all UniProt ID associated with mouse markers

sequence = {}

results = db.sql('select a.accID ' + \
      'from MRK_Marker m, ACC_Accession a ' + \
      'where m._Organism_key = 1 ' + \
      'and m._Marker_key = a._Object_key ' + \
      'and a._MGIType_key = 2 ' + \
      'and a._LogicalDB_key = 13 ' + \
      'order by a.accID', 'auto')

count = 1
for r in results:
    fpLinkOut.write(2 * TAB + '<Query>' + r['accID'] + '[pacc]</Query>' + CRT)
    count = count + 1

fpLinkOut.write('''         </ObjectList>
         </ObjectSelector>
         <ObjectUrl>
            <Base>&base;</Base>
            <Rule>&lo.pacc;</Rule>
         </ObjectUrl>
      </Link>
</LinkSet>
''')

reportlib.finish_nonps(fpLinkOut)
db.useOneConnection(0)

开发者ID:mgijax,项目名称:reports_db,代码行数:29,代码来源:protein_linkout.py

示例8:

        fp2.write(string.join(mpDO1[genotype], '|') + TAB)
	if mpOMIM1.has_key(genotype):
        	fp2.write(string.join(mpOMIM1[genotype], '|'))
	fp2.write(CRT)

    #
    # DO report 2
    #

    if mpDO2.has_key(genotype):

        fp3.write(mpDisplay[genotype] + TAB)
        fp3.write(string.join(mpAlleles[genotype], '|') + TAB)
        if mpAlleleIDs.has_key(genotype):
            fp3.write(string.join(mpAlleleIDs[genotype], '|'))
        fp3.write(TAB)
        fp3.write(mpStrain[genotype] + TAB)
        fp3.write(mpID[term] + TAB)
        if mpRef.has_key(refKey):
            fp3.write(string.join(mpRef[refKey], '|'))
        fp3.write(TAB + string.join(mpMarker[genotype], '|') + TAB)
        fp3.write(string.join(mpDO2[genotype], '|') + TAB)
	if mpOMIM2.has_key(genotype):
        	fp3.write(string.join(mpOMIM2[genotype], '|'))
	fp3.write(CRT)

reportlib.finish_nonps(fp1)	# non-postscript file
reportlib.finish_nonps(fp2)	# non-postscript file
reportlib.finish_nonps(fp3)	# non-postscript file

开发者ID:mgijax,项目名称:reports_db,代码行数:29,代码来源:MGI_GenePheno.py

示例9: processJournal


#.........这里部分代码省略.........
	db.sql('create index markers1_idx1 on markers1(_Refs_key)', None)

	db.sql('''WITH ref_counts1 AS (
		SELECT _Refs_key, count(*) AS markerCount
		FROM markers1
		GROUP BY _Refs_key
		)
		select m.*, r.markerCount
		into mcount1 
		from markers1 m , ref_counts1 r
		where m._Refs_key = r._Refs_key
		''', None)

	db.sql('create index mcount1_idx1 on mcount1(_Refs_key)', None)

	# get the set of references not coded with high priority,
	# add newGeneCount column to be updated later

	results = db.sql('''
		select distinct a.jnumID, i._Refs_key, i.markerCount, 
                                i.conditional, i.priority, 
                                a.short_citation,
                                0 as newGeneCount
		into temporary table final 
		from mcount1 i, BIB_Citation_Cache a 
		where i._Refs_key = a._Refs_key 
		''', None)

	#
	# new genes
	#
	# the set of references/markers = high/medium priorty
	# and references/markers are not referenced in the assay module
	#

	db.sql('''
	       select distinct i._Refs_key, i._Marker_key
	       into temporary table markers2 
	       from GXD_Index i, BIB_Refs b
	       where i._Refs_key = b._Refs_key 
	       and b.journal in ('%s')
	       and i._Priority_key in (74714, 74715) /* high/medium */
	       and not exists (select 1 from GXD_Assay a where i._Refs_key = a._Refs_key) 
	       and not exists (select 1 from GXD_Assay a where i._Marker_key = a._Marker_key) 
	       ''' % journalTitle, None)
	db.sql('create index markers2_idx1 on markers2(_Refs_key)', None)

	#
	# by reference, get the count
	#
	db.sql('''WITH ref_counts2 AS (
		SELECT _Refs_key, count(*) AS newGeneCount
		FROM markers2
		GROUP BY _Refs_key
		)
		select m.*, r.newGeneCount
		into mcount2
		from markers2 m , ref_counts2 r
		where m._Refs_key = r._Refs_key
		''', None)

	db.sql('create index mcount2_idx1 on mcount2(_Refs_key)', None)

	#
	# by reference, set final.newGeneCount = mcount2.newGeneCount
	#
	db.sql('''
	       update final 
	       set newGeneCount = m.newGeneCount
	       from mcount2 m
	       where final._Refs_key = m._Refs_key
	       ''', None)

	# now write the report
	results = db.sql('select * from final order by priority, newGeneCount desc, markerCount desc', 'auto')

	for r in results:
	    fp.write(string.ljust(str(r['jnumID']), 30))
	    fp.write(SPACE)
	    fp.write(string.ljust(str(r['markerCount']), 12))
	    fp.write(SPACE)
	    fp.write(string.ljust(str(r['newGeneCount']), 12))
	    fp.write(SPACE)
	    fp.write(string.ljust(str(r['conditional']), 20))
	    fp.write(SPACE)
	    fp.write(string.ljust(str(r['priority']), 10))
	    fp.write(SPACE)
	    fp.write(string.ljust(str(r['short_citation']), 50))
	    fp.write(CRT)

	fp.write('%s(%d rows affected)%s%s' % (CRT, len(results), CRT, CRT))

	# drop all the temp tables because we are looping
        db.sql('drop table markers1', None)
	db.sql('drop table mcount1', None)
	db.sql('drop table final', None)
	db.sql('drop table markers2', None)
        db.sql('drop table mcount2', None)

    reportlib.finish_nonps(fp)
开发者ID:mgijax,项目名称:qcreports_db,代码行数:101,代码来源:GXD_FullCode.py

示例10: process


#.........这里部分代码省略.........
                displayNotes1 = displayNotes1 + topType1 + separatorTopBottom + bottomType1 + notenewline
                displayNotes2 = displayNotes2 + topType2 + separatorTopBottom + bottomType2 + notenewline

            elif compound == 'Top':

                # new top, new group: process old group

                if foundBottom >= 1:
                    displayNotes1 = displayNotes1 + topType1 + separatorTopBottom + bottomType1 + notenewline
                    displayNotes2 = displayNotes2 + topType2 + separatorTopBottom + bottomType2 + notenewline
                    topType1 = ''
                    topType2 = ''
                    bottomType1 = ''
                    bottomType2 = ''
                    foundTop = 0
                    foundBottom = 0

                # new top, same group: need space to separate tops + existing information

                if foundTop >= 1:
                    topType1 = topType1 + separatorBottom + allele1
                    topType2 = topType2 + ' \Allele(' + mgiID1 + '|' + allele1 + '|)'

		# if there is no top, then copy in existing information

		else:
                    topType1 = allele1
                    topType2 = '\Allele(' + mgiID1 + '|' + allele1 + '|)'

                foundTop = foundTop + 1

            elif compound == 'Bottom':

                # new bottom, same group: need space to separate bottoms + existing information

                if foundBottom >= 1:
                    bottomType1 = bottomType1 + separatorBottom + allele1
		    bottomType2 = bottomType2 + separatorBottom

		    if allele1WildType == 1:
			bottomType2 = bottomType2 + '\AlleleSymbol(' + mgiID1 + '|0)'
                    else:
			bottomType2 = bottomType2 + '\Allele(' + mgiID1 + '|' + allele1 + '|)'

		# if there is no bottom, then copy in existing information

		else:
                    bottomType1 = allele1

		    if allele1WildType == 1:
			bottomType2 = '\AlleleSymbol(' + mgiID1 + '|0)'
                    else:
			bottomType2 = '\Allele(' + mgiID1 + '|' + allele1 + '|)'

                foundBottom = foundBottom + 1

        if foundTop >= 1 and foundBottom >= 1:
            displayNotes1 = displayNotes1 + topType1 + separatorTopBottom + bottomType1 + notenewline
            displayNotes2 = displayNotes2 + topType2 + separatorTopBottom + bottomType2 + notenewline
	    #print displayNotes1
	    #print displayNotes2

	if mode == 'sql':
	    #
	    # initialize the MGI_Note._Note_key primary key
	    #

	    cmd = 'begin transaction;\n'
	    cmd = cmd + 'create temp table noteKeyMax on commit drop as select max(_Note_key) + 1 as noteKey from MGI_Note;\n'
	    cmd = cmd + processNote(g, displayNotes1, combNoteType1) 
	    cmd = cmd + processNote(g, displayNotes2, combNoteType2)
	    cmd = cmd + processNote(g, displayNotes2, combNoteType3)

	    print processNote(g, displayNotes1, combNoteType1)
	    print processNote(g, displayNotes1, combNoteType2)
	    print processNote(g, displayNotes1, combNoteType3)
	    #print cmd

	    cmd = cmd + "commit transaction;\n"

	    db.sql(cmd, None)
        else:
            fp1.write(r['genotypeID'] + reportlib.TAB + displayNotes1 + reportlib.CRT)
            fp2.write(r['genotypeID'] + reportlib.TAB + displayNotes2 + reportlib.CRT)
            fp3.write(r['genotypeID'] + reportlib.TAB + displayNotes2 + reportlib.CRT)

	if DEBUG:
       	    print 'finished with genotype\n'
	    sys.stdout.flush()

    if DEBUG:
        print '\nfinished running allele combination\n'
        sys.stdout.flush()

    if mode == 'bcp':
        reportlib.finish_nonps(fp1)     # non-postscript file
        reportlib.finish_nonps(fp2)     # non-postscript file
        reportlib.finish_nonps(fp3)     # non-postscript file

    db.commit()
开发者ID:mgijax,项目名称:allcacheload,代码行数:101,代码来源:allelecombination.py

示例11: iphone_do


#.........这里部分代码省略.........
        value = r
        if not refs2.has_key(key):
	    refs2[key] = []
        refs2[key].append(value)

    #
    # DO/Human Marker by Marker
    #
    results = db.sql('''
            select distinct m._term_key, a.accid
            from diseaseontology m, VOC_Annot aa, ACC_Accession a
            where m._term_key = aa._term_key
	    and aa._annottype_key = 1022
	    and aa._object_key = a._object_key
	    and a._mgitype_key = 2
	    and a._logicaldb_key = 55
	    and a.preferred = 1
            ''', 'auto')
    markerannots2 = {}
    for r in results:
        key = r['_term_key']
        value = r['accid']
    
        if not markerannots2.has_key(key):
	    markerannots2[key] = []
        markerannots2[key].append(value)

    #
    # report
    #
    results = db.sql('select * from diseaseontology', 'auto')
    
    for r in results:
    
        key = r['_term_key']

	fp.write(r['accid'] + TAB)
	fp.write(r['term'] + TAB)

    #   DO (_annottype_key = 1022)
    #	MGI Ref ID (MGI:xxx|MGI:xxx|...)
        if refs1.has_key(key):
            i=0
	    for n in refs1[key]:
                if i>0:
                   fp.write('|'+str(n['mgiid']))
                else:
                   fp.write(str(n['mgiid']))
                   i=1
            fp.write(TAB)
        else:
            fp.write('0' + TAB)

    #   DO (_annottype_key = 1022)
    #	MGI Genotype ID (MGI:xxx|MGI:xxx|...)
        if genoannots1.has_key(key):
	    fp.write(string.join(genoannots1[key], '|') + TAB)
        else:
            fp.write('0' + TAB)

    #   DO (_annottype_key = 1022)
    #	MGI Marker ID (MGI:xxx|MGI:xxx|...)
        if markerannots1.has_key(key):
	    fp.write(string.join(markerannots1[key], '|') + TAB)
        else:
            fp.write('0' +TAB)

    #   DO (_annottype_key = 1022)
    #	MGI Allele ID (MGI:xxx|MGI:xxx|...)
        if alleleannots1.has_key(key):
	    fp.write(string.join(alleleannots1[key], '|') + TAB)
        else:
            fp.write('0' + TAB)

    #   DO (_annottype_key = 1022)
    #	MGI Ref ID (MGI:xxx|MGI:xxx|...)
        if refs2.has_key(key):
            i=0
	    for n in refs2[key]:
                if i>0:
                   fp.write('|'+str(n['mgiid']))
                else:
                   fp.write(str(n['mgiid']))
                   i=1
            fp.write(TAB)
        else:
            fp.write('0' + TAB)

    #   DO (_annottype_key = 1022)
    #	EntrezGene ID (xxx|xxx|...)
        if markerannots2.has_key(key):
	    fp.write(string.join(markerannots2[key], '|'))
        else:
            fp.write('0')
        fp.write(CRT)
    reportlib.finish_nonps(fp)
    
    # re-create a symbolic link between the new file and the current file
    os.chdir(reportDir)
    os.symlink(reportWithDate + '.rpt', currentReport)
开发者ID:mgijax,项目名称:reports_db,代码行数:101,代码来源:MGI_iphone_app.py

示例12: iphone_genes


#.........这里部分代码省略.........
	    for n in refs[key]:
                if i>0:
	           fp.write('|'+str(n['mgiid']))
                else:
                   fp.write(str(n['mgiid']))
                   i=1;
            fp.write(TAB)
        else:
            fp.write('0' + TAB)
    
    #	MGI Allele ID (MGI:xxx|MGI:xxx|...)
        if alleles.has_key(key):
	    fp.write(string.join(alleles[key], '|') + TAB)
        else:
            fp.write('0' + TAB)

    #	GO ID (C group): (GO:xxxx|GO:xxxx|...)
        if goCannots.has_key(key):
            i=0
	    for n in goCannots[key]:
                if i>0:
	           fp.write('|'+str(n['accid']))
                else:
	           fp.write(str(n['accid']))
                   i=1
	    fp.write(TAB)
        else:
            fp.write('0' + TAB)

    #	GO ID (F group): (GO:xxxx|GO:xxxx|...)
        if goFannots.has_key(key):
            i=0
	    for n in goFannots[key]:
                if i>0:
                   fp.write('|'+str(n['accid']))
                else:
                   fp.write(str(n['accid']))
                   i=1
	    fp.write(TAB)
        else:
            fp.write('0' +TAB)
    
    #	GO ID (P group): (GO:xxxx|GO:xxxx|...)
        if goPannots.has_key(key):
            i=0
	    for n in goPannots[key]:
                if i>0:
                   fp.write('|'+str(n['accid']))
                else:
                   fp.write(str(n['accid']))
                   i=1
	    fp.write(TAB)
        else:
            fp.write('0' +TAB)
    
    #	MP ID: (MP:xxxx|MP:xxxx|...)
        if phenoannots.has_key(key):
            i=0
	    for n in phenoannots[key]:
                if i>0:
                   fp.write('|'+str(n['accid']))
                else:
                   fp.write(str(n['accid']))
                   i=1
	    fp.write(TAB)
        else:
            fp.write('0' +TAB)

    #	DO ID: (xxxx|xxxx|...)
        if dogenotype.has_key(key):
            i=0
	    for n in dogenotype[key]:
                if i>0:
                   fp.write('|'+str(n['accid']))
                else:
                   fp.write(str(n['accid']))
                   i=1
	    fp.write(TAB)
        else:
            fp.write('0' + TAB)
    
    #	DO ID: (xxxx|xxxx|...)
        if dohuman.has_key(key):
            i=0
	    for n in dohuman[key]:
                if i>0:
                   fp.write('|'+str(n['accid']))
                else:
                   fp.write(str(n['accid']))
                   i=1
	    #fp.write(TAB)
        else:
            fp.write('0')
        fp.write(CRT)

    reportlib.finish_nonps(fp)
    
    # re-create a symbolic link between the new file and the current file
    os.chdir(reportDir)
    os.symlink(reportWithDate + '.rpt', currentReport)
开发者ID:mgijax,项目名称:reports_db,代码行数:101,代码来源:MGI_iphone_app.py

示例13: processEG

def processEG():
    #
    # process EG-oriented reports
    #

    try:
        inFile = open(egFileName, 'r')
        head, tail = os.path.split(egFileName)

        # initialize output (html) file

        htmlFile = reportlib.init(tail, \
				  outputdir = os.environ['RPTDIR'], printHeading = None, isHTML = 1)
        egmgiFile = reportlib.init(egmgiFileName, fileExt = '.txt', \
				   outputdir = os.environ['RPTDIR'], printHeading = None)
        egnomgiFile = reportlib.init(egnomgiFileName, fileExt = '.txt', \
				   outputdir = os.environ['RPTDIR'], printHeading = None)

    except:

	print 'Problem with file: %s' % (egFileName)
	print 'Problem with file: %s' % (egmgiFileName)
	print 'Problem with file: %s' % (egnomgiFileName)
        sys.exit(1)

    # print html header

    htmlFile.write(tableStart + CRT)
    htmlFile.write('<TD>Entrez Gene</TD>')
    htmlFile.write('<TD>Symbol</TD>')
    htmlFile.write('<TD>Chromosome</TD>')
    htmlFile.write('<TD>Associated Sequences</TD>' + CRT)

    # iterate thru input file

    for line in inFile.readlines():

        tokens = string.split(line, TAB)

        if len(tokens) < 3:
                continue

	egID = tokens[0]
	egSymbol = tokens[1]
        egChromosome = tokens[2];
        sequences = tokens[3];

	htmlFile.write('<TR><TD>' + externalAnchor(egID, EG_URL_KEY) + '</TD>')
	htmlFile.write('<TD>' + egSymbol + '</TD>')
	htmlFile.write('<TD>' + egChromosome + '</TD>')
	htmlFile.write('<TD>' + idAnchors(sequences) + '</TD></TR>')
	htmlFile.write(CRT)

	# if file does not contains MGIids...
	if string.find(sequences, 'MGIID=[-]') > 0:
	    egnomgiFile.write(egID + TAB)
	    egnomgiFile.write(egSymbol + TAB)
	    egnomgiFile.write(egChromosome + TAB)
	    egnomgiFile.write(sequences + CRT)

	# if file does contains MGIids...
        else:
	    seqs = string.split(sequences, ',')

	    # only print sequences with MGI ids
	    for s in seqs:
	        if string.find(s, 'MGIID=[') >= 0:
	            s = string.replace(s, 'MGIID=[', '')
	            s = string.replace(s, ']', '')
	            s = string.replace(s, '{', '')
	            s = string.replace(s, '}', '')
		    s = string.replace(s, ' ', '')
		    s = string.replace(s, '\n', '')
	            egmgiFile.write(egID + TAB)
	            egmgiFile.write(egSymbol + TAB)
	            egmgiFile.write(egChromosome + TAB)
	            egmgiFile.write(s + CRT)

    htmlFile.write(tableEnd)

    egmgiFile.close()
    egnomgiFile.close()

    inFile.close()
    reportlib.finish_nonps(htmlFile, isHTML = 1)
开发者ID:mgijax,项目名称:egload,代码行数:85,代码来源:formatreports.py

示例14: writeHTML

        imsrTAB.setdefault(accID, []).append(strain)

	value = string.replace(strain, '<', 'beginss')
	value = string.replace(value, '>', 'endss')
	value = string.replace(value, 'beginss', '<sup>')
	value = string.replace(value, 'endss', '</sup>')
	value = '%s%s%s' % (reportlib.create_imsrstrain_anchor(strain), value, reportlib.close_accession_anchor())

	imsrHTML.setdefault(accID, []).append(value)

#
# process results
#
results = db.sql('select * from cre order by driverNote', 'auto')

for r in results:
    writeHTML(r, imsrHTML)
    writeTAB(r, imsrTAB)

#
# clean up
#

fpHTML.write('</TABLE>')
fpHTML.write('<pre>')

reportlib.finish_nonps(fpHTML, isHTML = 1)  # non-postscript file
reportlib.finish_nonps(fpTAB)	# non-postscript file

db.useOneConnection(0)
开发者ID:mgijax,项目名称:reports_db,代码行数:30,代码来源:MGI_Recombinase_Full.py

示例15: runQueries


    results = db.sql('select * from results order by hstatus desc, mstatus desc, msymbol', 'auto')

    for r in results:
	key = r['m_Marker_key']

	fp.write(string.ljust(r['msymbol'], 32) + \
		 string.ljust(r['mstatus'], 12) + \
		 string.ljust(r['hsymbol'], 32) + \
		 string.ljust(r['hstatus'], 15))

        fp.write(CRT)

    fp.write('\n(%d rows affected)\n' % (len(results)))

#
# Main
#

fp1 = reportlib.init('HMD_SymbolDiffs1', outputdir = os.environ['QCOUTPUTDIR'])
runQueries(includeRiken = 0)
report1(fp1, includeRiken = 0)
reportlib.finish_nonps(fp1)

fp3 = reportlib.init('HMD_SymbolDiffs3', outputdir = os.environ['QCOUTPUTDIR'])
runQueries(includeRiken = 1)
report1(fp3, includeRiken = 1)
reportlib.finish_nonps(fp3)

开发者ID:mgijax,项目名称:qcreports_db,代码行数:27,代码来源:HMD_SymbolDiffs.py


注:本文中的reportlib.finish_nonps函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。