Package: pybarrnap
pybarrnap: Python implementation of barrnapTable of contentsOverviewInstallationCLI UsageAPI UsageLICENSEOverviewpybarrnap is a python implementation ofbarrnap(Bacterial ribosomal RNA predictor).
It provides a CLI compatible with barrnap and also provides a python API for running rRNA prediction and retrieving predicted rRNA.
pybarrnap depends only on the python library and not on the external command-line tools nhmmer and bedtools.[!NOTE]
pybarrnap is developed experimentally.
I have confirmed that it gives almost the same results as barrnap, but the evalue is slightly different.
Maybe there is a slight difference in behavior betweennhmmerandpyhmmer.nhmmerwhen setting the window_length option?InstallationPython 3.8 or lateris required for installation.
pybarrnap depends onpyhmmerandbiopython.Install PyPI package:pip install pybarrnapCLI UsageBasic Commandpybarrnap genome.fna > genome_rrna.gffOptions$ pybarrnap --help
usage: pybarrnap [options] genome.fna > genome_rrna.gff

Python implementation of barrnap (Bacterial ribosomal RNA predictor)

positional arguments:
  fasta              Input fasta file (or stdin)

optional arguments:
  -e , --evalue      E-value cutoff (default: 1e-06)
  -l , --lencutoff   Proportional length threshold to label as partial (default: 0.8)
  -r , --reject      Proportional length threshold to reject prediction (default: 0.25)
  -t , --threads     Number of threads (default: 1)
  -k , --kingdom     Target kingdom [bac|arc|euk|mito] (default: 'bac')
  -o , --outseq      Output rRNA hit seqs as fasta file (default: None)
  -i, --incseq       Include FASTA input sequences in GFF output (default: OFF)
  -q, --quiet        No print log on screen (default: OFF)
  -v, --version      Print version information
  -h, --help         Show this help message and exitCLI ExampleClickhereto download examples dataset.CLI Example 1Print rRNA prediction result on screenpybarrnap examples/bacteria.fnaCLI Example 2Output rRNA predition result to filepybarrnap examples/archaea.fna -k arc --outseq rrna.fna --incseq > rrna_incseq.gffCLI Example 3With pipe stdincat examples/mitochondria.fna | pybarrnap -q -k mito | grep 16SAPI Usagepybarrnap provides simple API for running rRNA prediction and retrieving predicted rRNA.frompybarrnapimportBarrnapfrompybarrnap.utilsimportload_example_fasta_file# Get example fasta file pathfasta_file=load_example_fasta_file("bacteria.fna")# Run pybarrnap rRNA predictionbarrnap=Barrnap(fasta_file,evalue=1e-6,lencutoff=0.8,reject=0.25,threads=1,kingdom="bac",quiet=False)result=barrnap.run()# Output rRNA GFF fileresult.write_gff("bacteria_rrna.gff")# Output rRNA GFF file (Include input fasta sequence)result.write_gff("bacteria_rrna_incseq.gff",incseq=True)# Output rRNA fasta fileresult.write_fasta("bacteria_rrna.fna")# Get rRNA GFF text and printprint("\n========== Print rRNA GFF ==========")print(result.get_gff_text())# Get rRNA features and printprint("\n========== Print rRNA features ==========")forrecinresult.seq_records:forfeatureinrec.features:print(feature.id,feature.type,feature.location,feature.qualifiers)# Get rRNA sequences and printprint("\n========== Print rRNA sequences ==========")forrecinresult.get_rrna_seq_records():print(f">{rec.id}\n{rec.seq}")LICENSEpybarrnap uses Barrnap v0.9 HMM profile database created from Rfam and SILVA.pybarrnap:GPLv3Barrnap:GPLv3Rfam:CC0SILVA:Free for academic use