-
Notifications
You must be signed in to change notification settings - Fork 0
/
gRNA4Patents_SNP_step1.py
58 lines (45 loc) · 1.66 KB
/
gRNA4Patents_SNP_step1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import pandas as pd
import sys
import argparse
import tempfile
import os
import shutil
import logging
import datetime
curdir=os.path.dirname(os.path.realpath(__file__))
sys.path.append(curdir+'/libs')
assert sys.version_info >= (3, 6)
from gRNA_SNP import gRNA_SNP
from FileUtils import BasicFileUtils
curDate = datetime.datetime.now().strftime("%d-%m-%Y")
def main():
# Reported to console only
parser = argparse.ArgumentParser(description="gRNAs4IP_Step1",
formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("-is3xlsx", required=True, help="Input xlsx file on s3")
parser.add_argument("-s3odir", required=True, help="output s3 directory")
args = parser.parse_args()
ifile = args.is3xlsx
if not ifile.startswith('s3://emendobio'):
print ("Input file {} is not in emendo s3 bucket. \
Exiting ...".format(ifile))
sys.exit()
if not (ifile.endswith('xlsx') or ifile.endswith('xls')):
print ("Input file {} is not excel file. \
Exiting ...".format(ifile))
sys.exit()
ofile = args.s3odir
if not ifile.startswith('s3://emendobio'):
print ("Output directiry {} is not in emendo s3 bucket. \
Exiting ...".format(ofile))
sys.exit()
BasicFileUtils.fileExist(ifile)
# Reported in consloe and in log file
tmpdir = tempfile.mkdtemp(dir="/efs/tmp")
os.chmod(tmpdir, 0o2775)
BasicFileUtils.create_log(tmpdir, curDate, 'SNPs')
print("Producing guides for SNPs ...")
gRNA_snp = gRNA_SNP(ifile, '.xlsx', ofile, tmpdir)
print("Finished succesfully !!!")
if __name__ == "__main__":
main()