Mercurial > repos > jay > pdaug_tsvtofasta
annotate PDAUG_Peptide_Length_Distribution/PDAUG_Peptide_Length_Distribution.py @ 4:87b77f2ddb0c draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit 8b18552f6d2b2261efebe1075ff4c18a295b94dd"
author | jay |
---|---|
date | Tue, 29 Dec 2020 18:13:00 +0000 |
parents | c3f0b3a6339e |
children |
rev | line source |
---|---|
0
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
1 import matplotlib.pyplot as plt |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
2 import Bio |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
3 from Bio import SeqIO |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
4 import os |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
5 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
6 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
7 def LegnthDestribution(InFile, OutFile): |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
8 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
9 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
10 sizes = [len(rec.seq) for rec in SeqIO.parse(InFile, "fasta")] |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
11 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
12 plt.hist(sizes, bins=20) |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
13 plt.title("%i Negative bacteriocin sequences\nLengths %i to %i" \ |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
14 % (len(sizes),min(sizes),max(sizes))) |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
15 plt.xlabel("Sequence length (bp)") |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
16 plt.ylabel("Count") |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
17 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
18 plt.savefig(OutFile) |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
19 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
20 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
21 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
22 if __name__=="__main__": |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
23 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
24 import argparse |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
25 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
26 parser = argparse.ArgumentParser() |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
27 |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
28 parser.add_argument("-I", "--InFile", required=True, default=None, help="Input file name") |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
29 parser.add_argument("-O", "--OutFile", required=False, default="Out.png", help="Input file name") |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
30 args = parser.parse_args() |
c3f0b3a6339e
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit a9bd83f6a1afa6338cb6e4358b63ebff5bed155e"
jay
parents:
diff
changeset
|
31 LegnthDestribution(args.InFile, args.OutFile) |