Checks if the sequence has enough RabF motifs within the G domain

        If there exists more than one G domain in the sequence enough RabF motifs is required in at least one
        of those domains to classify the sequence as a Rab.
348044
def has_rabf_motif(self):
        

        if self.rabf_motifs:
            for gdomain in self.gdomain_regions:
                beg, end = map(int, gdomain.split('-'))
                motifs = [x for x in self.rabf_motifs if x[1] >= beg and x[2] <= end]
                if motifs:
                    matches = int(pairwise2.align.globalxx('12345', ''.join(str(x[0]) for x in motifs))[0][2])
                    if matches >= self.motif_number:
                        return True
        return False
563042
def _isProtein(self):
        
        last = self.blockCount - 1
        return ((self.tEnd == self.tStarts[last] + 3 * self.blockSizes[last]) \
                and self.strand == "+") or \
                ((self.tStart == self.tSize - (self.tStarts[last] + 3 * self.blockSizes[last])\
                and self.strand == "-"))
663275
private boolean isDomainAlwaysInScope(String domain) {
		for (DomainAlwaysInScopeMatcher domainInScope : domainsAlwaysInScope) {
			if (domainInScope.matches(domain)) {
				return true;
			}
		}
		return false;
	}
735755
public static boolean check(int[] mutations) {
        for (int i = 0; i < mutations.length; ++i) {
            if (i > 0) {
                if (isDeletion(mutations[i - 1]) && isInsertion(mutations[i]) &&
                        getPosition(mutations[i - 1]) == getPosition(mutations[i]) - 1)
                    return false;
                if (isDeletion(mutations[i]) && isInsertion(mutations[i - 1]) &&
                        getPosition(mutations[i - 1]) == getPosition(mutations[i]))
                    return false;
            }
            if (isSubstitution(mutations[i]) && getFrom(mutations[i]) == getTo(mutations[i]))
                return false;
        }
        return true;
    }
718784
public boolean checkContains(String uri, String[] patterns) {
		for (String pattern : patterns) {
			if (pattern.length() > 0) {
				if (uri.contains(pattern)) {
					return true;
				}
			}
		}
		return false;
	}
780980
def iTable2GFF(iTable, fa, contig = False):
    
    columns = ['#seqname', 'source', 'feature', 'start', 'end', 'score', 'strand', 'frame', 'attribute']
    gff = {c:[] for c in columns}
    for insertion in iTable.iterrows():
        insertion = insertion[1]
        if insertion['ID'] not in fa:
            continue
        # rRNA strand
        strand = insertion['sequence'].split('strand=', 1)[1].split()[0]
        # set rRNA positions for reporting features on contig or extracted sequence
        if contig is True:
            gene = [int(i) for i in insertion['sequence'].split('pos=', 1)[1].split()[0].split('-')]
            if strand == '-':
                offset = -1 * (gene[1])
            else:
                offset = gene[0]
        else:
            strand = '+'
            gene = [1, int(insertion['sequence'].split('total-len=', 1)[1].split()[0])]
            offset = gene[0]
        insertion['strand'] = strand
        insertion['offset'] = offset
        # source for prediction
        source = insertion['sequence'].split('::model', 1)[0].rsplit(' ', 1)[-1]
        insertion['source'] = source
        # rRNA gene
        geneAnnot = '%s rRNA gene' % (source.split('from', 1)[0])
        geneNum = insertion['sequence'].split('seq=', 1)[1].split()[0]
        gff['#seqname'].append(insertion['ID'])
        gff['source'].append(source)
        gff['feature'].append('Gene')
        gff['start'].append(gene[0])
        gff['end'].append(gene[1])
        gff['score'].append('.')
        gff['strand'].append(strand)
        gff['frame'].append('.')
        gff['attribute'].append('ID=%s; Name=%s' % (geneNum, geneAnnot))
        # rRNA
        gff = parse_rRNA(insertion, fa[insertion['ID']], gff)
        # insertions
        gff = parse_insertion(insertion, gff)
        # orfs
        gff = parse_orf(insertion, gff)
        # catalytic RNAs
        gff = parse_catalytic(insertion, gff)
    return pd.DataFrame(gff)[columns].drop_duplicates()
1229892
public static int countGC(Sequence<NucleotideCompound> sequence) {
		CompoundSet<NucleotideCompound> cs = sequence.getCompoundSet();
		NucleotideCompound G = cs.getCompoundForString("G");
		NucleotideCompound C = cs.getCompoundForString("C");
		NucleotideCompound g = cs.getCompoundForString("g");
		NucleotideCompound c = cs.getCompoundForString("c");
		return countCompounds(sequence, G, C, g, c);
	}
393673
def validate_sequence(sequence: str, sequence_is_as_nucleotide=True):
    

    tmp_seq = tempfile.NamedTemporaryFile(mode="wb+", delete=False)

    if len(str(sequence).strip()) == 0:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_ERROR_MSG)

    if str(sequence).strip()[0] != ">":
        tmp_seq.write(">seq1\n".encode())

    tmp_seq.write(sequence.encode())
    tmp_seq.close()

    records = SeqIO.index(tmp_seq.name, "fasta")
    record_count = len(records)

    if record_count == 0:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_ERROR_MSG)

    if record_count > blast_settings.BLAST_MAX_NUMBER_SEQ_IN_INPUT:
        raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_MAX_SEQ_NUMB_ERROR_MSG)

    # read query sequence from temporary file
    first_sequence_list_in_file = SeqIO.parse(tmp_seq.name, "fasta")

    for sequence in first_sequence_list_in_file:

        if len(sequence.seq) <= 10:
            raise forms.ValidationError(blast_settings.BLAST_CORRECT_SEQ_TOO_SHORT_ERROR_MSG)

        if sequence_is_as_nucleotide:
            check_allowed_letters(str(sequence.seq), ALLOWED_NUCL)
        else:
            check_allowed_letters(str(sequence.seq), ALLOWED_AMINOACIDS)

    return tmp_seq
1094875
def is_a_sequence(var, allow_none=False):
    
    return isinstance(var, (list, tuple)) or (var is None and allow_none)
65774
function isBranchAssociatedDomains(domain, linkDomains) {
    return !(
      domain.indexOf("bnc.lt") > 0 ||
      domain.indexOf("app.link") > 0 ||
      linkDomains.indexOf(domain) >= 0
    );
  }
284610
public ValidationResult check(Entry entry) {
        result = new ValidationResult();

        if (entry == null) {
            return result;
        }

        //collect all gene features
        Collection<Feature> geneFeatures =
                SequenceEntryUtils.getFeatures(Feature.GENE_FEATURE_NAME, entry);

        if (geneFeatures.isEmpty()) {
            return result;
        }

        /**
         * which locus tag qualifiers are mapped to which gene features - should be an exclusive association
         */
        HashMap<String, Feature> locusTag2GeneFeature = new HashMap<String, Feature>();

        for (Feature geneFeature : geneFeatures) {

            List<Qualifier> locusQualifiers = geneFeature.getQualifiers(Qualifier.LOCUS_TAG_QUALIFIER_NAME);
            if (locusQualifiers.size() > 0) {

                String locus_tag_name = locusQualifiers.get(0).getValue();//got other checks for multiple locus_tags

                if (locusTag2GeneFeature.containsKey(locus_tag_name)) {
                    ValidationMessage<Origin> message =
                            reportError(result, geneFeature.getOrigin(), MESSAGE_ID, locus_tag_name);
                    message.append(locusTag2GeneFeature.get(locus_tag_name).getOrigin());
                } else {
                    locusTag2GeneFeature.put(locus_tag_name, geneFeature);
                }

            }
        }

        return result;
    }
114591
def check_padding_around_mutation(given_padding, epitope_lengths):
    
    min_required_padding = max(epitope_lengths) - 1
    if not given_padding:
        return min_required_padding
    else:
        require_integer(given_padding, "Padding around mutation")
        if given_padding < min_required_padding:
            raise ValueError(
                "Padding around mutation %d cannot be less than %d "
                "for epitope lengths %s" % (
                    given_padding,
                    min_required_padding,
                    epitope_lengths))
        return given_padding
951056
def check(self):
        

        pathfinder = Pathfinder(True)
        if pathfinder.add_path(pathfinder['superfamily']) is None:
            raise RuntimeError("'superfamily' data directory is missing")

        for tool in ('hmmscan', 'phmmer', 'mast', 'blastp', 'ass3.pl', 'hmmscan.pl'):
            if not pathfinder.exists(tool):
                raise RuntimeError('Dependency {} is missing'.format(tool))
347707
def contains_glob(path_to_directory, pattern, wanted=None):
    """"""
    if not path_to_directory:
        return False
    needed = make_needed(pattern, path_to_directory, wanted)
    for name in _names_in_directory(path_to_directory):
        if needed(name):
            return True
    return False
112586
public static boolean checkKeyAgreement(Platform platform, byte[] aMsg, int keyPos,
			int keyCount) {
		if (keyCount != 4)
			return false;
		
		boolean result = (platform.getUtils().equals(KeyAgreementType.ECDH384.getType(), 0, aMsg, keyPos , 4)  &&
			    platform.getUtils().equals(KeyAgreementType.ECDH256.getType(), 0, aMsg, keyPos + 1 * 4, 4) &&
			    platform.getUtils().equals(KeyAgreementType.DH3K.getType(), 0, aMsg, keyPos + 2 * 4, 4) &&
			    platform.getUtils().equals(new byte[] { 'D', 'H', '2', 'k' }, 0, aMsg, keyPos + 3 * 4, 4));
		
		return result;
	}
1006917
def is_sequential(self):
        
        seq_ids = tuple(int(residue["Seq_ID"]) for residue in self)
        return seq_ids == tuple(range(int(seq_ids[0]), int(seq_ids[-1])+1))
510355
def is_gene_list(bed_file):
    
    with utils.open_gzipsafe(bed_file) as in_handle:
        for line in in_handle:
            if not line.startswith("#"):
                if len(line.split()) == 1:
                    return True
                else:
                    return False