Mercurial > repos > jay > pdaug_fishers_plot
view PDAUG_Peptide_Core_Descriptors/PDAUG_Peptide_Core_Descriptors.py @ 6:45f11237c243 draft
"planemo upload for repository https://github.com/jaidevjoshi83/pdaug commit ac4353ca5c0ac9ce60df9f4bf160ed08b99fbee3"
author | jay |
---|---|
date | Thu, 28 Jan 2021 02:44:24 +0000 |
parents | 668434d3fc8a |
children |
line wrap: on
line source
from modlamp.core import BaseDescriptor from modlamp.descriptors import PeptideDescriptor import pandas as pd import argparse, os parser = argparse.ArgumentParser() parser.add_argument("-I", "--InFile", required=True, default=None, help="Input file") parser.add_argument("-O", "--OutFile", required=True, default=None, help="Output file") parser.add_argument("-N", "--Ngrams", required=True, default=None, help="ngrams") args = parser.parse_args() file = open(args.InFile) lines = file.readlines() Index = [] Pep = [] for line in lines: if '>' in line: Index.append(line.strip('\n')) else: line = line.strip('\n') line = line.strip('\r') Pep.append(line) df = pd.DataFrame() for i, l in enumerate(Pep): D = PeptideDescriptor(l) D.count_ngrams([int(args.Ngrams)]) df1 = pd.DataFrame(D.descriptor, index=["sequence"+str(i),]) df = pd.concat([df, df1], axis=0) df = df.fillna(0) df.to_csv(args.OutFile, sep='\t', index=None)