Returns true iff there is a sequence called self.CHROM in the
        dict of ref_sequences, and the REF string matches
174729
def ref_string_matches_dict_of_ref_sequences(self, ref_sequences):
        ''''''
        return self.CHROM in ref_sequences and self.ref_string_matches_ref_sequence(ref_sequences[self.CHROM])
694009
def is_job_ref(thing, reftype=dict):
    '''
    
    '''
    return isinstance(thing, reftype) and \
        ((len(thing) == 2 and \
              isinstance(thing.get('field'), basestring) and \
              isinstance(thing.get('job'), basestring)) or \
             (len(thing) == 1 and \
                  isinstance(thing.get('$dnanexus_link'), reftype) and \
                  isinstance(thing['$dnanexus_link'].get('field'), basestring) and \
                  isinstance(thing['$dnanexus_link'].get('job'), basestring)))
1000878
def correct_chrom_names(chroms):
    """"""
    chrom_list = []
    for chrom in chroms:
        # fix chrom numbering
        chrom = str(chrom)
        chrom = chrom.replace('23', 'X')
        chrom = chrom.replace('24', 'Y')
        chrom = chrom.replace('25', 'Mt')
        if not chrom.startswith('chr'):
            chrom = 'chr' + chrom
        chrom_list.append(chrom)
    return chrom_list
925499
def check_input_files_for_numbered_seq(sourceDir, suffix, containers):
    """"""
    # Check input files for each MPL-container type.
    for container in containers:
        files = glob.glob( os.path.join( sourceDir, container, container + '*' + suffix ) )
        for currentFile in sorted( files ):
            if check_header_comment( currentFile ):
                return True
    return False
916052
def get_sequence_str(self):
        '''
        
        '''
        sequence = self.get_sequence()
        return '->'.join(e.dst.name for e in sequence)
1331323
public boolean sequenceAndQualityLengthsMatch()
	{
		if (sequence == null && quality == null)
		{
			return true;
		}
		if ((sequence != null && quality == null) || (sequence == null && quality != null))
		{
			return false;
		}
		return sequence.length() == quality.length();
	}
604162
function hasRefOrSpread(attrs) {
  for (var i = 0; i < attrs.length; i++) {
    var attr = attrs[i];
    if (t.isJSXSpreadAttribute(attr)) return true;
    if (isJSXAttributeOfName(attr, "ref")) return true;
  }
  return false;
}
1320883
def check_bed_contigs(in_file, data):
    
    if not dd.get_ref_file(data):
        return
    contigs = set([])
    with utils.open_gzipsafe(in_file) as in_handle:
        for line in in_handle:
            if not line.startswith(("#", "track", "browser", "@")) and line.strip():
                contigs.add(line.split()[0])
    ref_contigs = set([x.name for x in ref.file_contigs(dd.get_ref_file(data))])
    if contigs and len(contigs - ref_contigs) / float(len(contigs)) > 0.25:
        raise ValueError("Contigs in BED file %s not in reference genome:\n %s\n"
                         % (in_file, list(contigs - ref_contigs)) +
                         "This is typically due to chr1 versus 1 differences in BED file and reference.")
261322
def is_the_same_indel(self, other_record, ref_seq):
        ''''''
        if self.CHROM != other_record.CHROM or len(self.ALT) > 1 or len(other_record.ALT) > 1 or self.is_snp() or other_record.is_snp():
            return False

        # The number of nuleotides that have been added or removed
        # is a necessary condition of the indels being the same,
        # so check that before devling into the actual sequences
        if (len(self.REF) - len(self.ALT[0])) != (len(other_record.REF) - len(other_record.ALT[0])):
            return False

        # make records that start and end in the same place.
        # Then compare the REF and ALT sequences
        record1 = copy.copy(self)
        record2 = copy.copy(other_record)
        new_start = min(self.POS, other_record.POS)
        new_end = max(self.ref_end_pos(), other_record.ref_end_pos())
        record1.add_flanking_seqs(ref_seq, new_start, new_end)
        record2.add_flanking_seqs(ref_seq, new_start, new_end)
        return record1.REF == record2.REF and record1.ALT == record2.ALT
1050511
def chr(self):
    
    if len(self.exons)==0: 
      sys.stderr.write("WARNING can't return chromsome with nothing here\n")
      return None
    return self._rngs[0].chr
305976
def is_sequence(obj):
    
    seq = (not hasattr(obj, "strip") and
           hasattr(obj, "__getitem__") or
           hasattr(obj, "__iter__"))

    # check to make sure it is not a set, string, or dictionary
    seq = seq and all(not isinstance(obj, i) for i in (dict,
                                                       set,
                                                       basestring))

    # PointCloud objects can look like an array but are not
    seq = seq and type(obj).__name__ not in ['PointCloud']

    # numpy sometimes returns objects that are single float64 values
    # but sure look like sequences, so we check the shape
    if hasattr(obj, 'shape'):
        seq = seq and obj.shape != ()

    return seq
335650
def has_duplicates(self):
        
        for n in getattr(self.__kcount, _iter_values)():
            if n != 1:
                return True

        def dict_recurse(obj):
            for v in getattr(obj, _iter_values)():
                if isinstance(v, VDFDict) and v.has_duplicates():
                    return True
                elif isinstance(v, dict):
                    return dict_recurse(v)
            return False

        return dict_recurse(self)
865448
def check_is_a_sequence(var, allow_none=False):
    
    if not is_a_sequence(var, allow_none=allow_none):
        raise TypeError("var must be a list or tuple, however type(var) is {}"
                        .format(type(var)))
125799
def match_RCSB_pdb_chains(pdb_id1, pdb_id2, cut_off = 60.0, allow_multiple_matches = False, multiple_match_error_margin = 3.0, use_seqres_sequences_if_possible = True, strict = True):
    ''''''
    try:
        stage = pdb_id1
        pdb_1 = PDB(retrieve_pdb(pdb_id1), strict = strict)
        stage = pdb_id2
        pdb_2 = PDB(retrieve_pdb(pdb_id2), strict = strict)
    except (PDBParsingException, NonCanonicalResidueException, PDBValidationException), e:
        raise PDBParsingException("An error occurred while loading %s: '%s'" % (stage, str(e)))

    return match_pdb_chains(pdb_1, pdb_id1, pdb_2, pdb_id2, cut_off = cut_off, allow_multiple_matches = allow_multiple_matches, multiple_match_error_margin = multiple_match_error_margin, use_seqres_sequences_if_possible = use_seqres_sequences_if_possible)
197088
def canonical_chrom_sorted(in_chroms):
    
    if len(in_chroms) == 0:
        return []
    chr_prefix = False
    mt = False
    if in_chroms[0].startswith('chr'):
        in_chroms = [x.lstrip('chr') for x in in_chroms]
        chr_prefix = True
    if 'MT' in in_chroms:
        in_chroms[in_chroms.index('MT')] = 'M'
        mt = True
    in_chroms = sorted(in_chroms, key=lambda c: int(c) if c not in ('X', 'Y', 'M') else c)
    try:
        m_index = in_chroms.index('M')
    except ValueError:
        pass
    else:
        in_chroms.pop(m_index)
        in_chroms.append('M')
    # At this point it should be nicely sorted
    if mt:
        in_chroms[in_chroms.index('M')] = 'MT'
    if chr_prefix:
        in_chroms = [''.join(['chr', x]) for x in in_chroms]
    return in_chroms
219463
def get_match_history_by_sequence_num(start_at_match_seq_num,
                                      matches_requested=None, **kwargs):
    
    params = {
        "start_at_match_seq_num": start_at_match_seq_num,
        "matches_requested": matches_requested
    }

    return make_request("GetMatchHistoryBySequenceNum", params,
        **kwargs)
50909
def match_sequence(self, tokens, item):
        """"""
        tail = None
        if len(tokens) == 2:
            series_type, matches = tokens
        else:
            series_type, matches, tail = tokens
        self.add_check("_coconut.isinstance(" + item + ", _coconut.abc.Sequence)")
        if tail is None:
            self.add_check("_coconut.len(" + item + ") == " + str(len(matches)))
        else:
            self.add_check("_coconut.len(" + item + ") >= " + str(len(matches)))
            if tail != wildcard:
                if len(matches) > 0:
                    splice = "[" + str(len(matches)) + ":]"
                else:
                    splice = ""
                self.assign_to_series(tail, series_type, item + splice)
        self.match_all_in(matches, item)