Пример #1
0
    def yield_karyotype(self, karyotype):
        assert self.level == 1, "Karyotype file can only be built for the top level." 
        line = ['chr','-','c_c','Cell_Communication','0','725', 'spectral-5-div-1']
        
        ### if there s only one chromosome create a hypothetical one
        ##### very unpythonic but it's too late to quench the root of the circular import evil.    
        from pacfm.controller import CircosConfigParser
        ccp= CircosConfigParser("conf")
        ccp.parse()
        chromosomes= []

        for chromosome in self.chromosomes:
            name= chromosome.name
            line[2] = karyotype[name]
            line[3] = name.replace(' ','_')
            line[5] = str(chromosome.get_end())
            chromosomes.append(karyotype[name])
            yield "\t".join(line)+ "\n"
       
        if len(self.chromosomes) == 1:
            name= "Hypothetical"
            abbr= "h"
            end= "2"
            line[2]= abbr
            line[3]= name
            line[5]= end
            chromosomes.append(abbr)
            yield "\t".join(line) +"\n"
   
        
        ccp.set("chromosomes", ";".join(chromosomes))
        ccp.write()