view PDAUG_Peptide_Length_Distribution/PDAUG_Peptide_Length_Distribution.py @ 11:7e6c49b99153 draft

"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit d396d7ff89705cc0dd626ed32c45a9f4029b1b05"
author jay
date Mon, 10 Jan 2022 04:15:37 +0000
parents c3f0b3a6339e
children
line wrap: on
line source

import matplotlib.pyplot as plt
import Bio
from Bio import SeqIO
import os


def LegnthDestribution(InFile, OutFile):


    sizes = [len(rec.seq) for rec in SeqIO.parse(InFile, "fasta")]

    plt.hist(sizes, bins=20)
    plt.title("%i Negative bacteriocin sequences\nLengths %i to %i" \
                % (len(sizes),min(sizes),max(sizes)))
    plt.xlabel("Sequence length (bp)")
    plt.ylabel("Count")

    plt.savefig(OutFile)



if __name__=="__main__":

    import argparse
    
    parser = argparse.ArgumentParser()
    
    parser.add_argument("-I", "--InFile", required=True, default=None, help="Input file name")
    parser.add_argument("-O", "--OutFile", required=False, default="Out.png", help="Input file name")
    args = parser.parse_args()
    LegnthDestribution(args.InFile, args.OutFile)