ponnhide / pyCircos

python Circos
GNU General Public License v3.0
339 stars 66 forks source link

Issue with plotting CDS #32

Open menickname opened 9 months ago

menickname commented 9 months ago

Dear

I tried to follow tutorial 2 on the example dataset and whenever plotting the CDS, I receive following error message. I have tried to resolve it myself without success.


AttributeError Traceback (most recent call last) in <cell line: 9>() 7 elif feat.strand == -1: 8 minus_CDS.append(feat) ----> 9 gcircle.featureplot("NC_000913", source=plus_CDS, raxis_range=(700,780), facecolor="tomato") 10 gcircle.featureplot("NC_000913", source=minus_CDS, raxis_range=(780,860), facecolor="cornflowerblue")

/content/pycircos/pycircos.py in featureplot(self, garc_id, feature_type, source, raxis_range, facecolor, edgecolor, linewidth, spine) 1034 for feat in feature_list: 1035 if feat.location.strand >= 0: -> 1036 s = int(feat.location.parts[0].start.position) 1037 e = int(feat.location.parts[-1].end.position) 1038 pos = start + ((end-start) * s/size)

AttributeError: 'ExactPosition' object has no attribute 'position'

Thank you in advance!

anw-sh commented 8 months ago

Faced the same issue, hope you have solved it... It worked for me after removing .position attribute after start and end in the pycircos.py

for feat in feature_list:
            if feat.location.strand >= 0:
                s = int(feat.location.parts[0].start) 
                e = int(feat.location.parts[-1].end)
                pos   = start + ((end-start) * s/size)
                width = start + ((end-start) * e/size) - pos    
                positions.append(pos) 
                widths.append(width)
            else:
                s = int(feat.location.parts[-1].start) 
                e = int(feat.location.parts[0].end)
                pos   = start + ((end-start) * s/size)
                width = start + ((end-start) * e/size) - pos    
                positions.append(pos) 
                widths.append(width)

Regards