def convertIdsToTxIds(errorIds): """read the sequence from a file in fasta format""" txList = list() for record in fasta.fasta_itr(three_utr_combined_file): header = record.header geneId, transcriptId, geneName = header.split('|') txList.append(transcriptId); for list1 in itertools.izip(errorIds): print list1 for list2 in itertools.izip(list1[0]): idx = list2[0] print txList[idx] return txList;
def constructFromFile(self, fileName, **args) : print 'reading from', fileName headerHandler = fastaHeaderHandler if 'headerHandler' in args : headerHandler = args['headerHandler'] numPatterns = fasta.fasta_count(fileName) self.container.__init__(self, numPatterns) patternIDs = [] L = [] for record in fasta.fasta_itr(fileName) : self.addPattern(record.sequence) patternID, label = headerHandler(record.header) patternIDs.append(patternID) if label is not None : L.append(label) self.attachLabels(Labels(L, patternID = patternIDs, **args))
def constructFromFile(self, fileName, **args): print 'reading from', fileName headerHandler = fastaHeaderHandler if 'headerHandler' in args: headerHandler = args['headerHandler'] numPatterns = fasta.fasta_count(fileName) self.container.__init__(self, numPatterns) patternIDs = [] L = [] for record in fasta.fasta_itr(fileName): self.addPattern(record.sequence) patternID, label = headerHandler(record.header) patternIDs.append(patternID) if label is not None: L.append(label) self.attachLabels(Labels(L, patternID=patternIDs, **args))
def fasta_read(file_name) : """read the sequence from a file in fasta format""" return [record.sequence for record in fasta.fasta_itr(file_name)]
def fasta_read(file_name): """read the sequence from a file in fasta format""" return [record.sequence for record in fasta.fasta_itr(file_name)]