class GoodPrimers(PrimerGroup): """Both primers found at right place""" short_name = 'good_primers' all_paths = PrimerGroup.all_paths + """ / /chimeras_ref/ /chimeras_denovo/ """ def load(self): if self.parent == 'assembled': self.uchime_ref = UchimeRef(self.trimmed_barcodes.path, self.p.chimeras_ref_dir, self) self.uchime_denovo = UchimeDenovo(self.trimmed_barcodes.path, self.p.chimeras_denovo_dir, self) def check_chimeras(self): # Only assembled sequences # if self.parent != 'assembled': return # Message # message = "----> Checking pool %i %s for chimeras" print Color.l_ylw + message % (self.parent.parent.pool.num, self.parent.parent.short_name) + Color.end sys.stdout.flush() # Check empty # if not self.trimmed_barcodes: print Color.l_ylw + 'No chimeras to check for %s (empty set)' % (self,) + Color.end sys.stdout.flush() return # Call # self.uchime_ref.check() self.uchime_denovo.check()
def __init__(self, parent, base_dir, lower_bound, upper_bound): # Save parent # self.parent, self.fractions = parent, parent # Auto paths # self.base_dir = base_dir self.p = AutoPaths(self.base_dir, self.all_paths) # Bounds # self.lower_bound = lower_bound self.upper_bound = upper_bound # Size fractions # self.reads = FASTA(self.p.reads_fasta) self.refere = UchimeRef(self.p.reads, self.p.refere_dir, self) self.denovo = UchimeDenovo(self.p.reads, self.p.denovo_dir, self) # Classification # self.rdp = SimpleRdpTaxonomy(self.reads, self.p.rdp_dir) self.crest = SimpleCrestTaxonomy(self.reads, self.p.crest_dir)
class Fraction(object): """One size fraction from the quality reads.""" all_paths = """ /reads.fasta /refere/ /denovo/ /rdp/ /crest/ """ def __init__(self, parent, base_dir, lower_bound, upper_bound): # Save parent # self.parent, self.fractions = parent, parent # Auto paths # self.base_dir = base_dir self.p = AutoPaths(self.base_dir, self.all_paths) # Bounds # self.lower_bound = lower_bound self.upper_bound = upper_bound # Size fractions # self.reads = FASTA(self.p.reads_fasta) self.refere = UchimeRef(self.p.reads, self.p.refere_dir, self) self.denovo = UchimeDenovo(self.p.reads, self.p.denovo_dir, self) # Classification # self.rdp = SimpleRdpTaxonomy(self.reads, self.p.rdp_dir) self.crest = SimpleCrestTaxonomy(self.reads, self.p.crest_dir) def extract(self): self.fractions.pool.quality_reads.only_used.extract_length(self.lower_bound, self.upper_bound, self.reads) return self.reads def check_chimeras(self): self.refere.check() self.denovo.check() return self.refere, self.denovo def check_classification(self): self.rdp.assign()
def load(self): if self.parent == 'assembled': self.uchime_ref = UchimeRef(self.trimmed_barcodes.path, self.p.chimeras_ref_dir, self) self.uchime_denovo = UchimeDenovo(self.trimmed_barcodes.path, self.p.chimeras_denovo_dir, self)