def getPopGenomeStats(inputFile): totleng = 0 totcount = 0 for head, seq in FastaReader(inputFile): totcount += 1 totleng += len(seq) averagegenomesize = float(totleng) / float(totcount) popgenomesamples = totcount return averagegenomesize, popgenomesamples
def load_chasis(inputFile): fr = FastaReader(inputFile) counter = 0 h = None s = None for header, seq in fr: h = header s = seq counter += 1 if counter > 1: raise ValueError( "Chasis file must only contain a single reference genome") return h, s
def read_te_fasta(self, fasta_file): from fastaIO import FastaReader seq_dict1 = {} seq_dict2 = {} ct = 1 handle = FastaReader(fasta_file) for seq_id, seq in handle: seq_dict1[ct] = seq_id seq_dict2[ct] = seq ct = ct + 1 handle.close() return seq_dict1, seq_dict2
def read_chesis_fasta(self, fasta_file): from fastaIO import FastaReader seq_dict = {} ct = 1 handle = FastaReader(fasta_file) seq_id = "" seq_length = 0 chr_seq = "" for seq_id, seq in handle: seq_length = len(seq) chr_seq = seq handle.close() return seq_id, seq_length, chr_seq