Help with these tasks

Help with problem 1

  1. Use the example code as a starting point
  2. Look at the XML while you are developing the Python code - your Python should mirror the structure of the XML
  3. First of all you want to grab the <mutant_group> elements with .getElementsByTagName('mutant_group')
  4. For each <mutant_group>, you must grab the <native_structure> element and since there is only one of these, use .item(0) or [0] to get that first (and only) one
  5. From this, use .getElementsByTagName('resolution') to extract the <resolution> tags
  6. Again, there is only one, so get that one using .item(0); or [0]
  7. Extract the first child from that using .getFirstChild and convert it to a value using .data
  8. If the value is ≤2.0, then extract the 'native' attribute from the <mutant_group> and print its value together with the resolution

Help with problem 2

  1. Use the example code as a starting point
  2. Start by extracting the <mutant_group> elements
  3. For each <mutant_group>, extract the 'native' attribute
  4. If the native attribute has the value '1eugA0' then...
  5. Use .getElementsByTagName('mutant') on the <mutant_group> to extract all the mutant elements and work through each of them
  6. Extract the value of the 'domid' attribute for the <mutant> element
  7. Obtain the first (and only) <structure> element from the <mutant> element using .getElementsByTagName('structure').item(0) or .getElementsByTagName('structure').[0]
  8. Obtain the first (and only) <resolution> element from the <structure> element using .getElementsByTagName('resolution').item(0) or .getElementsByTagName('resolution')[0]
  9. Obtain the value of the resolution from this by using .getFirstChild.data
  10. Get the first (and only) <mutation> element from the <mutant> element by using .getElementsByTagName('mutation').item(0) or .getElementsByTagName('mutation')[0]
  11. From the <mutation> element, get the values for the three attributes
  12. Print the values as required.
Continue