def execute(choices, galaxyFn=None, username=''): '''Is called when execute-button is pushed by web-user. Should print output as HTML to standard out, which will be directed to a results page in Galaxy history. If getOutputFormat is anything else than HTML, the output should be written to the file with path galaxyFn.gtr If needed, StaticFile can be used to get a path where additional files can be put (e.g. generated image files). choices is a list of selections made by web-user in each options box. ''' gi=GenomeInfo(choices[0]) gi.fullName = choices[1] urls = choices[2].split() gi.sourceUrls = urls gi.genomeBuildSource = choices[3] gi.genomeBuildName = choices[4] gi.species = choices[5] gi.speciesTaxonomyUrl = choices[6] gi.assemblyDetails = choices[7] gi.privateAccessList = [v.strip() for v in choices[8].replace(os.linesep, ' ').replace(',', ' ').split(' ') if v.find('@')>0] gi.isPrivate = (choices[9] == 'Owners only') gi.isExperimental = (choices[10] == 'Experimental only') gi.ucscClade = choices[11] gi.ucscGenome = choices[12] gi.ucscAssembly = choices[13] gi.store() return "Updated genome %s." % gi.fullName
def execute(cls, choices, galaxyFn=None, username=''): '''Is called when execute-button is pushed by web-user. Should print output as HTML to standard out, which will be directed to a results page in Galaxy history. If getOutputFormat is anything else than HTML, the output should be written to the file with path galaxyFn.gtr If needed, StaticFile can be used to get a path where additional files can be put (e.g. generated image files). choices is a list of selections made by web-user in each options box. ''' gi = GenomeInfo(choices[0]) gi.fullName = choices[1] urls = choices[2].split() gi.sourceUrls = urls gi.genomeBuildSource = choices[3] gi.genomeBuildName = choices[4] gi.species = choices[5] gi.speciesTaxonomyUrl = choices[6] gi.assemblyDetails = choices[7] gi.privateAccessList = [ v.strip() for v in choices[8].replace(os.linesep, ' ').replace( ',', ' ').split(' ') if v.find('@') > 0 ] gi.isPrivate = (choices[9] == 'Owners only') gi.isExperimental = (choices[10] == 'Experimental only') gi.ucscClade = choices[11] gi.ucscGenome = choices[12] gi.ucscAssembly = choices[13] gi.store() return "Updated genome %s." % gi.fullName
def execute(cls, choices, galaxyFn=None , username=''): '''Is called when execute-button is pushed by web-user. Should print output as HTML to standard out, which will be directed to a results page in Galaxy history. If needed, StaticFile can be used to get a path where additional files can be put (e.g. generated image files). choices is a list of selections made by web-user in each options box. ''' #print 'Executing... with choices %s'%str(choices) abbrv = choices[0] name = choices[1] #Should test that the genome is not in hyperbrowser. gi = GenomeInfo(abbrv) if gi.hasOrigFiles(): sys.stderr.write( "Genome "+abbrv+ " is already in the Genomic HyperBrowser. Remove the old first.") else: gi.fullName = name if choices[2] == 'URL': urls = choices[3].split() gi.sourceUrls = urls for url in urls: try: GenomeImporter.downloadGenomeSequence(abbrv, url) except InvalidFormatError: return else: basePath = os.sep.join([NONSTANDARD_DATA_PATH, abbrv] + GenomeInfo.getSequenceTrackName(abbrv)) fnSource = ExternalTrackManager.extractFnFromGalaxyTN(choices[4].split(':')) fnDest = basePath+'/'+abbrv+'Sequence.fasta' ensurePathExists(fnDest) copyfile(fnSource, fnDest) chrs=GenomeImporter.extractChromosomesFromGenome(abbrv) gi.sourceChrNames = chrs gi.installedBy = username gi.genomeBuildSource = choices[5] gi.genomeBuildName = choices[6] gi.species = choices[7] gi.speciesTaxonomyUrl = choices[8] gi.assemblyDetails = choices[9] gi.privateAccessList = [v.strip() for v in choices[10].replace(os.linesep, ' ').replace(',', ' ').split(' ') if v.find('@')>0] gi.isPrivate = (choices[11] != 'All') gi.isExperimental = (choices[12] != 'All') gi.ucscClade = choices[13] gi.ucscGenome = choices[14] gi.ucscAssembly = choices[15] galaxyFile=open(galaxyFn, "w") galaxyFile.write( 'Genome abbreviation: ' + abbrv + os.linesep) galaxyFile.write( 'Genome full name: ' + name + os.linesep) galaxyFile.write( 'Track name: ' + ':'.join(GenomeInfo.getSequenceTrackName(abbrv)) + os.linesep) galaxyFile.write( 'Temp chromosome names: ' + ' || '.join(chrs) + os.linesep) #GenomeImporter.saveTempInfo(abbrv, name, chrs) #print 'Chromosomes: '+chrs gi.store()
def execute(cls, choices, galaxyFn=None, username=''): '''Is called when execute-button is pushed by web-user. Should print output as HTML to standard out, which will be directed to a results page in Galaxy history. If needed, StaticFile can be used to get a path where additional files can be put (e.g. generated image files). choices is a list of selections made by web-user in each options box. ''' #print 'Executing... with choices %s'%str(choices) abbrv = choices[0] name = choices[1] #Should test that the genome is not in hyperbrowser. gi = GenomeInfo(abbrv) if gi.hasOrigFiles(): sys.stderr.write( "Genome " + abbrv + " is already in the Genomic HyperBrowser. Remove the old first." ) else: gi.fullName = name if choices[2] == 'URL': urls = choices[3].split() gi.sourceUrls = urls for url in urls: try: GenomeImporter.downloadGenomeSequence(abbrv, url) except InvalidFormatError: return else: basePath = GenomeImporter.getBasePathSequence(abbrv) fnSource = ExternalTrackManager.extractFnFromGalaxyTN( choices[4].split(':')) fnDest = basePath + os.path.sep + abbrv + '.fa' ensurePathExists(fnDest) copyfile(fnSource, fnDest) if choices[16] == 'from URL': urls = choices[3].split() gi.sourceUrls = urls for url in urls: try: GenomeImporter.downloadGffFile(abbrv, url) except InvalidFormatError: return elif choices[16] == 'from history': fnSource = ExternalTrackManager.extractFnFromGalaxyTN( choices[18].split(':')) fnDest = GenomeImporter.getCollectedPathGFF(abbrv) ensurePathExists(fnDest) copyfile(fnSource, fnDest) chrs = GenomeImporter.extractChromosomesFromGenome(abbrv) #gi.sourceChrNames = chrs gi.installedBy = username gi.genomeBuildSource = choices[5] gi.genomeBuildName = choices[6] gi.species = choices[7] gi.speciesTaxonomyUrl = choices[8] gi.assemblyDetails = choices[9] gi.privateAccessList = [ v.strip() for v in choices[10].replace(os.linesep, ' ').replace( ',', ' ').split(' ') if v.find('@') > 0 ] gi.isPrivate = (choices[11] != 'All') gi.isExperimental = (choices[12] != 'All') gi.ucscClade = choices[13] gi.ucscGenome = choices[14] gi.ucscAssembly = choices[15] galaxyFile = open(galaxyFn, "w") galaxyFile.write('Genome abbreviation: ' + abbrv + os.linesep) galaxyFile.write('Genome full name: ' + name + os.linesep) galaxyFile.write('Track name: ' + ':'.join(GenomeInfo.getSequenceTrackName(abbrv)) + os.linesep) galaxyFile.write('Temp chromosome names: ' + ' || '.join(chrs) + os.linesep) #GenomeImporter.saveTempInfo(abbrv, name, chrs) #print 'Chromosomes: '+chrs gi.store()
sys.exit(1) for track in ProcTrackOptions.getSubtypes('TestGenome', ['GESourceTracks']): ti = TrackInfo('TestGenome', ['GESourceTracks', track]) ti.trackName = [track] ti.genome = 'ModelsForExternalTracks' ti.store() from quick.util.GenomeInfo import GenomeInfo from datetime import datetime gi = GenomeInfo('TestGenome') gi.fullName = 'TestGenome' gi.sourceUrls = ['http://hgdownload.cse.ucsc.edu/goldenPath/hg18/chromosomes/chr21.fa.gz', \ 'http://hgdownload.cse.ucsc.edu/goldenPath/hg18/chromosomes/chrM.fa.gz'] #gi.sourceChrNames = ['chr21', 'chrM'] gi.installedBy = 'Setup.py' gi.genomeBuildSource = 'NCBI' gi.genomeBuildName = 'hg18' gi.species = 'H**o Sapiens' gi.speciesTaxonomyUrl = 'http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=9606' gi.assemblyDetails = 'Chromosome 21 and M from the hg18 genome, used for testing purposes.' gi.isPrivate = False gi.privateAccessList = [] gi.isExperimental = False gi.timeOfInstallation = datetime.now() gi.store() extractTestGenomeAndPreProcess(galaxy_dir)
for track in ProcTrackOptions.getSubtypes('TestGenome', ['GESourceTracks']): ti = TrackInfo('TestGenome', ['GESourceTracks', track]) ti.trackName = [track] ti.genome = 'ModelsForExternalTracks' ti.store() from quick.util.GenomeInfo import GenomeInfo from datetime import datetime gi = GenomeInfo('TestGenome') gi.fullName = 'TestGenome' gi.sourceUrls = ['http://hgdownload.cse.ucsc.edu/goldenPath/hg18/chromosomes/chr21.fa.gz', \ 'http://hgdownload.cse.ucsc.edu/goldenPath/hg18/chromosomes/chrM.fa.gz'] gi.sourceChrNames = ['chr21', 'chrM'] gi.installedBy = 'Setup.py' gi.genomeBuildSource = 'NCBI' gi.genomeBuildName = 'hg18' gi.species = 'H**o Sapiens' gi.speciesTaxonomyUrl = 'http://www.ncbi.nlm.nih.gov/Taxonomy/Browser/wwwtax.cgi?mode=Info&id=9606' gi.assemblyDetails = 'Chromosome 21 and M from the hg18 genome, used for testing purposes.' gi.isPrivate = False gi.privateAccessList = [] gi.isExperimental = False gi.timeOfInstallation = datetime.now() gi.store() def setupHB(galaxyPath='', ignoreVersionChecking=False, installationSetupFn=''): hbPath = os.path.dirname(os.path.realpath(sys.argv[0])) os.chdir(hbPath) checkDependencies()