nodes: 0, module; 1, function_definition; 2, function_name:_short_chrom; 3, parameters; 4, block; 5, identifier:self; 6, identifier:chrom; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, expression_statement; 11, try_statement; 12, if_statement; 13, comment:"""Plot standard chromosomes + X, sorted numerically.
  
          Allows specification from a list of chromosomes via config
          for non-standard genomes.
          """; 14, assignment; 15, assignment; 16, assignment; 17, block; 18, except_clause; 19, identifier:allowed_chroms; 20, block; 21, elif_clause; 22, identifier:default_allowed; 23, call; 24, identifier:allowed_chroms; 25, call; 26, identifier:chrom_clean; 27, call; 28, expression_statement; 29, identifier:ValueError; 30, block; 31, if_statement; 32, boolean_operator; 33, block; 34, identifier:set; 35, argument_list; 36, identifier:set; 37, argument_list; 38, attribute; 39, argument_list; 40, assignment; 41, if_statement; 42, boolean_operator; 43, block; 44, call; 45, comparison_operator:chrom_clean in default_allowed; 46, return_statement; 47, list; 48, call; 49, identifier:chrom; 50, identifier:replace; 51, string:"chr"; 52, string:""; 53, identifier:chrom_clean; 54, call; 55, boolean_operator; 56, block; 57, comparison_operator:chrom in allowed_chroms; 58, comparison_operator:chrom_clean in allowed_chroms; 59, return_statement; 60, identifier:isinstance; 61, argument_list; 62, identifier:chrom_clean; 63, identifier:default_allowed; 64, identifier:chrom_clean; 65, string:"X"; 66, attribute; 67, argument_list; 68, identifier:int; 69, argument_list; 70, comparison_operator:chrom_clean not in default_allowed; 71, comparison_operator:chrom_clean not in allowed_chroms; 72, expression_statement; 73, identifier:chrom; 74, identifier:allowed_chroms; 75, identifier:chrom_clean; 76, identifier:allowed_chroms; 77, identifier:chrom_clean; 78, identifier:chrom_clean; 79, identifier:int; 80, call; 81, identifier:get; 82, string:"chromosomes"; 83, list; 84, identifier:chrom_clean; 85, identifier:chrom_clean; 86, identifier:default_allowed; 87, identifier:chrom_clean; 88, identifier:allowed_chroms; 89, assignment; 90, identifier:getattr; 91, argument_list; 92, identifier:chrom_clean; 93, None; 94, identifier:config; 95, string:"goleft_indexcov_config"; 96, dictionary
code: def _short_chrom(self, chrom):
          """Plot standard chromosomes + X, sorted numerically.
  
          Allows specification from a list of chromosomes via config
          for non-standard genomes.
          """
          default_allowed = set(["X"])
          allowed_chroms = set(getattr(config, "goleft_indexcov_config", {}).get("chromosomes", []))
  
          chrom_clean = chrom.replace("chr", "")
          try:
              chrom_clean = int(chrom_clean)
          except ValueError:
              if chrom_clean not in default_allowed and chrom_clean not in allowed_chroms:
                  chrom_clean = None
  
          if allowed_chroms:
              if chrom in allowed_chroms or chrom_clean in allowed_chroms:
                  return chrom_clean
          elif isinstance(chrom_clean, int) or chrom_clean in default_allowed:
              return chrom_clean