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]
Exemple #2
0
 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 writeBed(self, genome, detailsFields, classifyFields, classifyValues, classifyOperations, categoryName):
     bedPath = os.path.join(self.bedDir, categoryName, genome, genome + ".bed")
     with open(bedPath, "w") as outf:
         for details in detailsFields:
             for record in sql_lib.selectBetweenDatabases(self.cur, "details", details, classifyFields, classifyValues, classifyOperations, self.primaryKeyColumn, genome):
                 if record[0] == None:
                     continue
                 elif type(record[0]) == type(u''):
                     outf.write(record[0] + "\n")
                 else:
                     for x in record[0]:
                         outf.write(x)
     return bedPath
 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]
Exemple #5
0
 def writeBed(self, genome, detailsFields, classifyFields, classifyValues,
              classifyOperations, categoryName):
     bedPath = os.path.join(self.bedDir, categoryName, genome,
                            genome + ".bed")
     with open(bedPath, "w") as outf:
         for details in detailsFields:
             for record in sql_lib.selectBetweenDatabases(
                     self.cur, "details", details, classifyFields,
                     classifyValues, classifyOperations,
                     self.primaryKeyColumn, genome):
                 if record[0] == None:
                     continue
                 elif type(record[0]) == type(u''):
                     outf.write(record[0] + "\n")
                 else:
                     for x in record[0]:
                         outf.write(x)
     return bedPath
Exemple #6
0
 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]