Skip to content
Snippets Groups Projects
Commit b8014c4f authored by Aflitos, Saulo Alves's avatar Aflitos, Saulo Alves
Browse files

added license; added argparse

parent 6e17929d
Branches
No related tags found
No related merge requests found
Copyright (c) 2016, Saulo Alves Aflitos, Wageningen University
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
pypy targets/matcher.py S_lycopersicum_scaffolds.2.50.fa S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
pypy targets/matcher.py S_lycopersicum_chromosomes.2.50.fa S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
pypy matcher.py --ref S_lycopersicum_scaffolds.2.50.fa --out S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_scaffolds.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
pypy matcher.py --ref S_lycopersicum_chromosomes.2.50.fa --out S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa.gff3 S_lycopersicum_chromosomes.2.50.fa.gz_kmasked_RT03_3kb_N2X.fa
......@@ -2,6 +2,8 @@
import os
import sys
import argparse
from collections import OrderedDict
def readFasta(inRef):
......@@ -35,24 +37,43 @@ def readFasta(inRef):
return refs
parser = argparse.ArgumentParser(description='Read fasta reference, read sequences extracted by kmasker and export GFF with the coordinates.')
parser.add_argument('--ref' , metavar='REF' , dest='ref' , required=True, nargs=1 , type=str, help='Reference file')
parser.add_argument('--out' , metavar='OUT' , dest='out' , required=True, nargs=1 , type=str, help='Output GFF file')
parser.add_argument('INFILES', metavar='INFILES', nargs=argparse.REMAINDER, help='Input Files (kmasker output)')
def main():
inRef = sys.argv[1]
outFile = sys.argv[2]
inFiles = sys.argv[3:]
args = parser.parse_args()
inRef = args.ref[0]
outFile = args.out[0]
inFiles = args.INFILES
print "ref", inRef
print "out", outFile
print "files", len(inFiles), inFiles
print "files", len(inFiles), ", ".join(inFiles)
if os.path.exists(outFile):
print "output file {} exists. quitting".format(outFile)
sys.exit(1)
if not os.path.exists(inRef):
print "input file {} does not exists".format(inRef)
sys.exit(1)
if len(files) == 0:
print "no input file given"
sys.exit(1)
if any([x == inRef for x in inFiles]):
print "reference {} in list of files: {}".format(inRef, ", ".join(inFiles))
sys.exit(1)
print "reading reference"
refs = readFasta(inRef)
print "reading sequences"
#seqs = OrderedDict()
with open(outFile, 'w') as fhdo:
fhdo.write("##gff-version 3\n")
......@@ -60,7 +81,6 @@ def main():
for inFile in inFiles:
print " reading", inFile
fileSeqs = readFasta(inFile)
#seqs[inFile] = seq
for seqName, seq in fileSeqs.iteritems():
seqNameId, seqNameLen = seqName.split(" ")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment