def recolorTransMap(self, genome, gp): """ Recolors the comparativeAnnotation results based on the scheme assembly > alignment > biology. Transcripts not in one of these categories will become black. """ records = seq_lib.get_gene_pred_transcripts(gp) # first we recolor everything black for x in records: x.rgb = "0" # now we find all interesting biology and color that the interesting biology color detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.interestingBiology() aIds = {x[0] for x in sql_lib.selectBetweenDatabases(self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome)} for x in records: if x.name in aIds: x.rgb = self.colors["mutation"] # now the alignment errors... detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.alignmentErrors() aIds = {x[0] for x in sql_lib.selectBetweenDatabases(self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome)} for x in records: if x.name in aIds: x.rgb = self.colors["alignment"] # finally the assembly detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.assemblyErrors() aIds = {x[0] for x in sql_lib.selectBetweenDatabases(self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome)} for x in records: if x.name in aIds: x.rgb = self.colors["assembly"] return ["\t".join(map(str, x.get_bed())) for x in records]
def get_transcript_dict(gp, filter_set): transcripts = seq_lib.get_gene_pred_transcripts(gp) d = seq_lib.transcript_list_to_dict(transcripts, noDuplicates=True) r = defaultdict(list) for aln_id, rec in d.iteritems(): tx_id = strip_alignment_numbers(aln_id) if tx_id in filter_set: r[tx_id].append(rec) return r
def recolorAugustus(self, genome, gp): """ Recolors the Augustus tracks based on OK-ness. """ records = seq_lib.get_gene_pred_transcripts(gp) # first we recolor everything black for x in records: x.rgb = "0" detailsFields, classifyFields, classifyValues, classifyOperations = src.augustusQueries.augustusNotOk() aIds = {x[0] for x in sql_lib.selectBetweenDatabases(self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome)} for x in records: if x.name in aIds: x.rgb = "83,179,64" return ["\t".join(map(str, x.get_bed())) for x in records]
def recolorTransMap(self, genome, gp): """ Recolors the comparativeAnnotation results based on the scheme assembly > alignment > biology. Transcripts not in one of these categories will become black. """ records = seq_lib.get_gene_pred_transcripts(gp) # first we recolor everything black for x in records: x.rgb = "0" # now we find all interesting biology and color that the interesting biology color detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.interestingBiology( ) aIds = { x[0] for x in sql_lib.selectBetweenDatabases( self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome) } for x in records: if x.name in aIds: x.rgb = self.colors["mutation"] # now the alignment errors... detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.alignmentErrors( ) aIds = { x[0] for x in sql_lib.selectBetweenDatabases( self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome) } for x in records: if x.name in aIds: x.rgb = self.colors["alignment"] # finally the assembly detailsFields, classifyFields, classifyValues, classifyOperations = src.queries.assemblyErrors( ) aIds = { x[0] for x in sql_lib.selectBetweenDatabases( self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome) } for x in records: if x.name in aIds: x.rgb = self.colors["assembly"] return ["\t".join(map(str, x.get_bed())) for x in records]
def recolorAugustus(self, genome, gp): """ Recolors the Augustus tracks based on OK-ness. """ records = seq_lib.get_gene_pred_transcripts(gp) # first we recolor everything black for x in records: x.rgb = "0" detailsFields, classifyFields, classifyValues, classifyOperations = src.augustusQueries.augustusNotOk( ) aIds = { x[0] for x in sql_lib.selectBetweenDatabases( self.cur, "details", self.primaryKeyColumn, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome) } for x in records: if x.name in aIds: x.rgb = "83,179,64" return ["\t".join(map(str, x.get_bed())) for x in records]
def load_gp(path): tm_recs = seq_lib.get_gene_pred_transcripts(path) tm_dict = seq_lib.transcript_list_to_dict(tm_recs, noDuplicates=True) return tm_dict