I am having possibly a simple question which is proving difficult.

My objective is to take the reference FASTA file and flat file database with 1500 restriction enzymes with its cutting sites (mostly pattern I would say).

  1. I first want to see that how many times each enzyme cut the FASTA file and;
  2. second to check the number and size of fragment that each enzyme would give me, this output pregerably would be a CSV file may be.

Background I tried to do pattern search using R, but its just collapsing my system. I am looking for bash command may be.

  • $\begingroup$ This looks like the RAM load of the reg-ex in R. Bash isn't the best for reg-ex style commands IMO, Python can do this, I would assume awk too, and dare I say Perl is really good. $\endgroup$
    – M__
    Commented Nov 1, 2022 at 14:34

2 Answers 2


Biopython has a module dedicated to working with restriction enzymes. Without any code examples we cannot help you much further.


The diffHic package might have solved this issue in R.

# Load the genomic data
genome <- biostrings::readDNAStringSet("your_file.fa")

# Run the in silico restriction digest 
cuts <- cutGenome(genome, "CCGCGG", overhang=2L) # SacII

the cuts GRanges object contains the boundaries of each restriction fragment for given genome.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.