Updated DNA gramplet ready for review

Try this to get the revised file:

Alternately, you can hand edit the dnasegmentmap.py file. The change is adding one line at row 470 (the two previous lines are there for context). It should be indented to align with the if.

            if self.segments[active][5] > 0:
                tooltip_text += _(", {0} SNPs".format(self.segments[active][5]))
            tooltip_text += _("\nStarts at {0} and ends at {1}".format(self.segments[active][1], self.segments[active][2]))

Regarding the color swatches for the legend, on my Mac I see them as aligned. Could be a Gtk compatibility across platforms? Can someone test on a Linux box to see if it aligns.

Screen Shot 2022-10-20 at 5.25.10 PM

2 Likes

Thanks, got it now. I don’t know why I have trouble finding things in GitHub, I guess I just need to spend more time learning how to use it.

Is there a way to format the start and stop values with commas (or whatever thousands separators the user’s locale uses)? Not really needed for the SNPs but that would be nice too.

I added 5 px to the legend_offset_y in line 427 and the swatches aligned nicely on my Windoze 10 PC.
            legend_offset_y + 5,

Found a minor bug. Note the 1st person (call them ‘John Smith’) in the Legend with a bunch of people mapped,

If you right-click on a Person (NOT ‘John Smith’) in the Legend, the Edit Person pops up and the chart is winnowed down to just that person’s segments. But the tooltips are for ‘John Smith’, the 1st Person on the original chart. The tooltips are ALWAYS for “John Smith’s” centimorgans, no matter who was right-clicked.

Yeah, that is part of a work-in-progress. I am trying to add a new feature if you hover over a legend entry, it only shows the segments for that person. Useful if the chart is crowded with overlaps. But I am currently stumped on a technical issue (emitting a redraw event), so the feature is only partly implemented. The implementation would allow you to move over the legend and it would be like a christmas tree, changing highlighted segments. When you move off the legend, all come back.

So you need to bear with this issue until I either resolve it or yank it.

2 Likes

See newest version that displays start and stop cM with localized thousands delimiter.

1 Like

I got this error:

71899: ERROR: grampsapp.py: line 173: Unhandled exception
Traceback (most recent call last):
File “/Users/George/Library/Application Support/gramps/gramps51/plugins/DNA/dnasegmentmap.py”, line 472, in on_pointer_motion
tooltip_text += locale.format(‘%d’,self.segments[active][1], grouping = True)
NameError: name ‘locale’ is not defined

I changed “locale” to “glocale” and now it works.

Ran into another Gramps user today in a DNA facebook group. Invited him to join in here. Feedback from a fresh “first impression” would be instructive.

2 Likes

Hello, I would like to test the gramplet. I am sorry, unfortunately I do not know how to get the file from github. I would like also to chat personally with [GaryGriffin], if possible. I not, no problem. Thanks for your effort in improving the gramplet. Cheers,

You can contact me at: genealogy at rainbowbuilder dot com

I can provide you the updated file. I assume you know where plugins are located on your system.

Gary

1 Like

After some discussion with Michal, he suggested a new gramplet that draws all of the segments of a user-specified chromosome , with each user on a different row. So for instance, just chromosome 4 with the 7 different associated people on separate rows. This avoids the overlap that exists in the current gramplet. And allows for easy identification of triangulation areas and overlap areas.

Does any one else see value in this. I think it is interesting and useful but before I start working on it, wanted to get other peoples thoughts.

New version of DNA Segment Map available.

  1. fixes chromosome painting outside the lines
  2. hover now lists all segments, not just the last drawn when there is overlap.

Feedback welcome

1 Like

A tiny change, please rev the .gpr.py revision (1.1.5 ; 1.2.0 would be the release target) and make your ‘copyright’ in both files from “2020” to “2020-2022”

How about adding an .ini ? Find out what is needed to read & write into the same directory as the Gramplet. (Some Gramplets write into the same folder, a subdirectory, up one level, up 2 levels. Some of those up levels are getting very cluttered. There don’t seem to be any standards. In any .ini , including leading lines with the Gramplet name, version, & help URL might save future pain.)

It only absolutely needs 4 elements:

  • a vertical offset variable for line 427
  • male horizontal bar color
  • female horizontal bar color
  • background color

And maybe a boolean switch to enable/disable showing IDs in the labels. They’ll just confuse people receiving a screen capture.

No interface, we can text edit the tuples as an experiment. We can try different colors to see if it makes a difference.

I sound interesting. But not as a separate Gramplet. Won’t it use all the same data already loaded for this Graph? Maybe the data could just be a different layout?

Click a Chomosome label and explode that data. Since it would need the space if exploding Chomosomes 1 thru 5. if The Legend goes away moving the names (with their mouse links) expanding into the 1st column (The label changes from “Chr” to become "Chomosome " + ##

Clicking bars of a row (in the exploded graph) could show the 23 Chr. pair regular display but filter for just that Person with the full Legend. (Clicking a Swatch in the 23 pair Legend could access the same feature for a different Person.)

Clicking the backgound graph area could reset back to the default

FYI, I found I had to fix some of my data. It looks like you are using Build 38 lengths for the chromosomes. Most of my data (from GEDmatch and from recent FamilyTreeDNA downloads) uses Build 37 start and end positions, but some of my older data from FamilyTreeDNA used Build 36, in which chromosome 19 (for example) was somewhat longer, and so I had a segment at the end of chromosome 19 that was hanging past the end of the underlying bar:

image

For that little segment on the right, the start and end positions in Build 36 are 61 to 63 million; in Build 37 they are 56 to 59 million. The length of chromosome 19 in Build 38 is only 58 million.

I am not attempting to convert my data to Build 38 (not sure how I would do it anyway; probably there is a tool somewhere?). But you might consider switching to Build 37 to avoid any minor discrepancies, if most users currently have their data in Build 37. Or possibly make it configurable, in case another build becomes more common in the future.

Regardless, users should determine which build(s) are represented in their match data and be careful to avoid mismatches when combining older and newer data, or data from different providers – not just within this gramplet, but with any tool they use. GEDmatch gives users a choice of viewing comparisons in Buld 36, 37, or 38. FamilyTreeDNA currently uses Build 37. I haven’t used any of the other providers and don’t know what they are currently showing.

For those who need it, here is a handy reference of chromosome lengths in the different builds (use the drop-down menu to switch build number).

@GaryGriffin, it would also be nice if the same data could also be used for other visualizations. I’m thinking particularly of a “DNA pedigree chart” such as the examples that I’ve mocked up and pasted below. I’ve used Ahnentafel numbers for these illustrations, but the actual chart could show names, dates, whatever.

The bars would be scaled according to the percent of DNA that each ancestor (number 4 and beyond) is known to have contributed to the active person’s genome, based on match data entered and the relationships derived. The gaps (in the first example) and different bar heights (in the second example) would change over time as more match relationships are determined. In more distant generation, some ancestors would not appear unless/until there is match data to support them.

Maybe there could also be the option of filtering on a particular chromosome.

Of course, it could also just be a fan chart in which each ancestor’s wedge is shaded accordingly and possibly annotated with a percentage in the tooltip. That way all ancestors would appear, but some would lack any shading.

If these ideas have any merit, they can be discussed in a new thread, but I just wanted to make the point about keeping future possible uses of the data in mind as you continue to refine the current gramplet. Thank you for all of your work!

Yet another update is available. I added Builds 36 and 37 lengths (previously only Build 38 was used) and changed the default to 37, which seems to be the most commonly used for data input.

I added a config file to control

  • Build number
  • Maternal background color
  • Paternal background color
  • Legend swatch offset (for Windows users).

I am not updating the version number in the gpr file. After screwing this up for years, I am letting that get addressed when the gramplet is actually published, rather than a draft on my tree.

I understand the desire to integrate this with the DNA Chromosome gramplet. At this point, I have a technical issue that I have not been able to resolve (emit a redraw event from a mouse click) that is blocking that consideration. I am working on them separately at this point. If someone can provide some programming advice on this, it might unblock me (I am a Fortran programmer from way back).

The DNA Pedigree chart is an interesting idea. Can you start a new thread to discuss how this might be implemented, focusing at least on how to determine the box info based on the tree.

1 Like

One last version that addresses most of the requests. Incorporated the single Chromosome view. Click on the chromosome number to switch to a detailed view. Click on the background to go back to the standard view.

CAVEAT: There is still an issue on generating a redraw when switching views. Currently you have to take some action that will force a redraw. The simplest method is to switch to a different gramplet and then back.

Added config changes, so delete any config file you have for this gramplet.

  • Changed the maternal/paternal background to a tuple instead of separate R/G/B.
  • Added option to view/hide ID number
  • Added option to adjust legend in single-chromosome view. If you have more than 12 people sharing the chromosome, you will probably need to tweak this.

Please let me know other feedback. The redraw is the only open work at this point.

Thanks @GaryGriffin!

In between Gramps sessions, I edited the ini file and changed the “;;show_associate_id=1” line to have 0 instead of 1, but it seems to get reset to 1 as soon as I get back into the gramplet.

Interesting. I don’t particularly care for Individual Chromosome view expanding to the full width of the Graph. I means that If I do a capture of the shared graph and the individual chromosome, the they are too difficult to correlate visually. But also, not having any padding on the sides gives the impression that that bar data actually runs off the left of right. That you’re not seeing some of it.

But I found something odd things about the /gramps/gramps51/plugins/DNASegmentMap.ini
If the color lines are changes but still commented, those lines get overwritten each time the Gramplet is run in a session. If that are commented, the line is preserved. And a REALLY weird one was that changes to the commented offset lines were restored even though the DNASegmentMap.ini is deleted between Gramps sessions. Is the .ini values stored somewhere else too?