def importFastaSeq(self): if not self.project: showWarning('Failure','Please create a new CCPN project.', parent=self) return fileTypes = [ FileType('Fasta', ['*.fsa']), FileType('All', ['*']) ] fileSelectPopup = FileSelectPopup(self, file_types=fileTypes, title='Import Fasta sequence file', dismiss_text='Cancel', selected_file_must_exist=True, multiSelect=False,) fileName = fileSelectPopup.getFile() if not os.path.exists(fileName): showWarning('Failure','No such file.', parent=self) return if fileName: name = os.path.split(fileName)[1] if '.' in name: name = name.split('.')[0] fastaObj = FastaFormat(self.project, self, verbose=True) fastaObj.readSequence(fileName, minimalPrompts=True) self.eciFrame.updateAll() return fastaObj
nmrEntry.addApplicationData(appData) # Print it. entryAppData = nmrEntry.findFirstApplicationData() print 'Application data: [%s]' % entryAppData # Find it based on the application and keyword values. keywds2 = {'application': 'Fasta format', 'keyword': 'sequence file'} seqFileFromAppData = nmrEntry.findFirstApplicationData(**keywds2).value # Read in a sequence to create a molSystem object - can also set the # Tkinter object to None for using all text-based format converter sub # routines. fastaObj = FastaFormat(project, None) fastaObj.readSequence(seqFileFromAppData, minimalPrompts=1) # Connect the molSystem to the BMRB Entry. nmrEntry.setMolSystem(project.sortedMolSystems()[0]) # Also create a new study object. keywordList = ['NMR', 'Structure determination'] study = entryStore.newStudy(name=project.name, keywords=keywordList) # And connect to the Entry object. nmrEntry.setStudy(study) affStore = project.newAffiliationStore(name=project.name)
# # Give the location of the sequence file # sequenceFile = os.path.join(dataDir, sequenceFileName) # # Create a FastaFormat instance # # Again, if this was PDB format, this would read: # # formatObject = PdbFormat(ccpnProject,guiRoot) # formatObject = FastaFormat(ccpnProject, guiRoot) # # Call the readSequence method from the fastaFormat instance # and pass in the name of the file to read # # This line would be the same for a PDB format - the read/write methods # are the same for all formats (except for some format-specific keywords # in some cases) # formatObject.readSequence(sequenceFile, minimalPrompts=1) # # Testing to see if all is there... #
import memops.api.Implementation as Implementation # Get FastaFormat class for format conversion. from ccpnmr.format.converters.FastaFormat import FastaFormat if __name__ == '__main__': # CCPN project. project = Implementation.MemopsRoot(name = 'readFasta') # Create a Tkinter object. guiRoot = Tkinter.Tk() # Create a FastaFormat object and associate it with the CCPN project and # Tkinter object. fastaObj = FastaFormat(project, guiRoot) # Give the location of the sequence file. seqDir = '../data/seq' seqFile = os.path.join(seqDir, 'fasta.seq') # Call the readSequence method from the fastaFormat instance # and pass in the name of the file to read. fastaObj.readSequence(seqFile, minimalPrompts = 1) # Check to see if molSystem and molecule objects are in the CCPN project. print '\nProject object: [%s]' % project print "'list' of MolSystem objects: [%s]" % project.sortedMolSystems() print "'list' of Molecule objects: [%s]" % project.sortedMolecules() # Select first available molecule.
# # Give the location of the sequence file # sequenceFile = os.path.join(dataDir,sequenceFileName) # # Create a FastaFormat instance # # Again, if this was PDB format, this would read: # # formatObject = PdbFormat(ccpnProject,guiRoot) # formatObject = FastaFormat(ccpnProject,guiRoot) # # Call the readSequence method from the fastaFormat instance # and pass in the name of the file to read # # This line would be the same for a PDB format - the read/write methods # are the same for all formats (except for some format-specific keywords # in some cases) # formatObject.readSequence(sequenceFile,minimalPrompts = 1) # # Testing to see if all is there... #