Skip to content

Commit

Permalink
initial commit trying to use scikit
Browse files Browse the repository at this point in the history
  • Loading branch information
publicdb committed Feb 18, 2017
1 parent feb5006 commit 9c2e137
Showing 1 changed file with 55 additions and 0 deletions.
55 changes: 55 additions & 0 deletions bitk3/keepSeqByOrgId.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/python3.5
import argparse
import skbio


def main(sampleFile, pos, sep=''):
""" script to split a MSA by the organisms id """
seqInfo = bitk3.fastaReader(sampleFile)
if sep == '':
countsDict = bitk3.countFeaturesInHeaders(seqInfo[0], pos)
else:
countsDict = bitk3.countFeaturesInHeaders(seqInfo[0], pos, sep)

keys = list(countsDict.keys())
keys.sort()

for key in keys:
print('{} : {}'.format(key, countsDict[key]))

return countsDict

if __name__ == "__main__":
import bitk3
parser = argparse.ArgumentParser(prog='countFeatureInTag',
usage='%(prog)s fasta_file.fa position',
description='Count features in headers of \
fasta formated files')

parser.add_argument('sampleFile',
metavar='fasta_file.fa',
type=str,
help='Valid fasta formated file')

parser.add_argument('pos',
metavar='position',
type=int,
help='Integer of the position of the information \
to be counted. Positions are divided by default \
using "|" as separator')
parser.add_argument('--sep',
metavar='sep',
type=str,
help='Change the character that separates the \
fields in header',
default='')

args = parser.parse_args()

sampleFile = args.sampleFile
pos = args.pos
sep = args.sep

main(sampleFile, pos, sep)
else:
from bitk3 import bitk3

0 comments on commit 9c2e137

Please sign in to comment.