Biotools

geneblocks.biotools.annotate_record(seqrecord, location='full', feature_type='feature', margin=0, **qualifiers)[source]

Add a feature to a Biopython SeqRecord.

Parameters
seqrecord

The biopython seqrecord to be annotated.

location

Either (start, end) or (start, end, strand). (strand defaults to +1)

feature_type

The type associated with the feature

margin

Number of extra bases added on each side of the given location.

qualifiers

Dictionnary that will be the Biopython feature’s qualifiers attribute.

geneblocks.biotools.random_dna_sequence(length, probas=None, seed=None)[source]

Return a random DNA sequence (“ATGGCGT…”) with the specified length.

Parameters
length

Length of the DNA sequence.

proba

Frequencies for the different nucleotides, for instance probas={"A":0.2, "T":0.3, "G":0.3, "C":0.2}. If not specified, all nucleotides are equiprobable (p=0.25).

seed

The seed to feed to the random number generator. When a seed is provided the random results depend deterministically on the seed, thus enabling reproducibility

geneblocks.biotools.sequences_differences(seq1, seq2)[source]

Return the number of nucleotides that differ in the two sequences.

seq1, seq2 should be strings of DNA sequences e.g. “ATGCTGTGC”

geneblocks.biotools.sequences_differences_array(seq1, seq2)[source]

Return an array [0, 0, 1, 0, …] with 1s for sequence differences.

seq1, seq2 should both be ATGC strings.