Return true if this package is an Amino Acid alignment package, otherwise
        False i.e. it is a nucleotide package. In general it is best to use
        'is_protein_package' instead.
349170
def graftm_package_is_protein(graftm_package):
        '''

        '''
        found = None
        with open(graftm_package.alignment_hmm_path()) as f:
            r = f.read().split("\n")
        for line in r:
            if line=='ALPH  DNA':
                found = False
                break
            elif line=='ALPH  amino':
                found = True
                break
        if found is None:
            raise Exception("Unable to determine whether the HMM was amino acid or dna")
        return found
152519
public static final boolean isNucleotide(String groupCode3) {
		String code = groupCode3.trim();
		return nucleotides30.containsKey(code)
				|| nucleotides23.containsKey(code);
	}
870792
def InputAA(seq_length, name=None, **kwargs):
    
    return Input((seq_length, len(AMINO_ACIDS)), name=name, **kwargs)
610845
def is_het_residue(self, obres):
        """"""
        if not obres.GetResidueProperty(0):
            # If the residue is NOT amino (0)
            # It can be amino_nucleo, coenzme, ion, nucleo, protein, purine, pyrimidine, solvent
            # In these cases, it is a ligand candidate
            return True
        else:
            # Here, the residue is classified as amino
            # Amino acids can still be ligands, so we check for HETATM entries
            # Only residues with at least one HETATM entry are processed as ligands
            het_atoms = []
            for atm in pybel.ob.OBResidueAtomIter(obres):
                het_atoms.append(obres.IsHetAtom(atm))
            if True in het_atoms:
                return True
        return False
844632
def is_app_linked(source, pkg, java_package):
        
        for line in source.split("\n"):
            if java_package in line:
                return True
        return False
21117
public boolean isIBMPackage(String packageName) {
        if (packageName != null) {
            BundlePackages p = populatePackageLists();
            // If we still can't get our list of packages (for example, in unit tests), let everything pass
            if (p != null) {
                if (p.containsPrivatePackage(packageName)) {
                    return true;
                } else if (p.containsExportedPackage(packageName)) {
                    // Add an extra check - if this is an exported package, it could be spec or third-party, not IBM
                    SharedPackageInspector inspector = st.getService();
                    if (inspector != null) {
                        PackageType exported = inspector.getExportedPackageType(packageName);
                        // If it's spec, third party, or stable it's not internal - otherwise, it is
                        if ( exported == null )
                            return true;
                        if ( exported.isSpecApi() || exported.isThirdPartyApi() || exported.isStableApi() ) 
                            return false;
                        
                        return true;
                    }

                    // If we couldn't get hold of the service, assume it was internal if our bundles export it
                    return true;
                }

            }
        }
        return false;
    }
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
634740
def is_valid_package_name(name, raise_error=False):
    
    is_valid = PACKAGE_NAME_REGEX.match(name)
    if raise_error and not is_valid:
        raise PackageRequestError("Not a valid package name: %r" % name)
    return is_valid
352873
boolean isValidPackageName(String s) {
        int index;
        while ((index = s.indexOf('.')) != -1) {
            if (!isValidClassName(s.substring(0, index))) return false;
            s = s.substring(index+1);
        }
        return isValidClassName(s);
    }
306538
def is_package(self, fullname):
        """"""
        filename = os.path.split(self.get_filename(fullname))[1]
        filename_base = filename.rsplit('.', 1)[0]
        tail_name = fullname.rpartition('.')[2]
        return filename_base == '__init__' and tail_name != '__init__'
1277671
def is_file(package):
    """"""
    if hasattr(package, "keys"):
        return any(key for key in package.keys() if key in ["file", "path"])

    if os.path.exists(str(package)):
        return True

    for start in SCHEME_LIST:
        if str(package).startswith(start):
            return True

    return False
1359695
def is_cpat_compatible(gtf):
    
    if not gtf:
        return False
    db = get_gtf_db(gtf)
    pred = lambda biotype: biotype and biotype == "protein_coding"
    biotype_lookup = _biotype_lookup_fn(gtf)
    if not biotype_lookup:
        return False
    db = get_gtf_db(gtf)
    for feature in db.all_features():
        biotype = biotype_lookup(feature)
        if pred(biotype):
            return True
    return False
558314
def PhyDMSPrepAlignmentParser():
    """"""
    parser = ArgumentParserNoArgHelp(formatter_class=ArgumentDefaultsRawDescriptionFormatter,
            description='\n'.join([
            "Prepare alignment of protein-coding DNA sequences.\n",
            "Steps:",
            " * Any sequences specified by '--purgeseqs' are removed.",
            " * Sequences not of length divisible by 3 are removed.",
            " * Sequences with ambiguous nucleotides are removed.",
            " * Sequences with non-terminal stop codons are removed;",
            "   terminal stop codons are trimmed.",
            " * Sequences that do not encode unique proteins are removed",
            "   unless they are specified for retention by '--keepseqs'.",
            " * A multiple sequence alignment is built using MAFFT.",
            "   This step is skipped if you specify '--prealigned'.",
            " * Sites gapped in reference sequence are stripped.",
            " * Sequences with too little protein identity to reference",
            "   sequence are removed, counting both mismatches and unstripped",
            "   gaps as differences. Identity cutoff set by '--minidentity'.",
            " * Sequences too similar to other sequences are removed. An",
            "   effort is made to keep one representative of sequences found",
            "   many times in input set. Uniqueness threshold set ",
            "   by '--minuniqueness'. You can specify sequences to not",
            "   remove via '--keepseqs'.",
            " * Problematic characters in header names are replaced by",
            "   underscores. This is any space, comma, colon, semicolon",
            "   parenthesis, bracket, single quote, or double quote.",
            " * An alignment is written, as well as a plot with same root",
            "   but extension '.pdf' that shows divergence from reference",
            "   of all sequences retained and purged due to identity or",
            "   uniqueness.\n",
            phydmslib.__acknowledgments__,
            'Version {0}'.format(phydmslib.__version__),
            'Full documentation at {0}'.format(phydmslib.__url__),
            ]))
    parser.add_argument('inseqs', type=ExistingFile, help="FASTA file giving input coding sequences.")
    parser.add_argument('alignment', help="Name of created output FASTA alignment. PDF plot has same root, but extension '.pdf'.")
    parser.add_argument('refseq', help="Reference sequence in 'inseqs': specify substring found ONLY in header for that sequence.")
    parser.set_defaults(prealigned=False)
    parser.add_argument('--prealigned', action='store_true', dest='prealigned', help="Sequences in 'inseqs' are already aligned, do NOT re-align.")
    parser.add_argument('--mafft', help="Path to MAFFT (http://mafft.cbrc.jp/alignment/software/).", default='mafft')
    parser.add_argument('--minidentity', type=FloatBetweenZeroAndOne, help="Purge sequences with <= this protein identity to 'refseq'.", default=0.7)
    parser.add_argument('--minuniqueness', type=IntGreaterThanZero, default=2, help="Require each sequence to have >= this many protein differences relative to other sequences.")
    parser.add_argument('--purgeseqs', nargs='*', help="Specify sequences to always purge. Any sequences with any of the substrings specified here are always removed. The substrings can either be passed as repeated arguments here, or as the name of an existing file which has one substring per line.")
    parser.add_argument('--keepseqs', nargs='*', help="Do not purge any of these sequences for lack of identity or uniqueness. Specified in the same fashion as for '--purgeseqs'.")
    parser.add_argument('-v', '--version', action='version', version='%(prog)s {version}'.format(version=phydmslib.__version__))
    return parser
1174689
def as_protein(structure, filter_residues=True):
    

    from ssbio.biopython.Bio.Struct.Protein import Protein
    return Protein.from_structure(structure, filter_residues)
177042
def is_protein_or_chemical(agent):
    ''''''
    # Default is True if agent is None
    if agent is None:
        return True
    dbs = set(['UP', 'HGNC', 'CHEBI', 'PFAM-DEF', 'IP', 'INDRA', 'PUBCHEM',
               'CHEMBL'])
    agent_refs = set(agent.db_refs.keys())
    if agent_refs.intersection(dbs):
        return True
    return False
458327
def map_all(self, prot_alignment, nucl_sequences):
        
        zipped = itertools.zip_longest(prot_alignment, nucl_sequences)
        for p, n in zipped:
            if p is None:
                raise ValueError("Exhausted protein sequences")
            elif n is None:
                raise ValueError("Exhausted nucleotide sequences")
            yield self.map_alignment(p, n)
1005620
boolean isValidPackageName(String s) {
        if (s.contains("/")) {
            String[] a = s.split("/");
            if (a.length == 2) {
                 return isValidPackageName0(a[0]) && isValidPackageName0(a[1]);
            }
            return false;
        }
        return isValidPackageName0(s);
    }