@@ -0,0 +1,1908 @@
+%0Aimport os, sys%0Aimport gzip%0A%0Aimport json%0Aimport os%0Ascript_dir = os.getcwd()%0Acurrent_dir = os.getcwd().split('/')%0A#remove just one path and add mendel,md%0Acurrent_dir%5B-1%5D = 'mendelmd_source'%0A%0Aproj_path = %22/%22.join(current_dir)%0A# This is so Django knows where to find stuff.%0Aos.environ.setdefault(%22DJANGO_SETTINGS_MODULE%22, %22mendelmd.settings%22)%0Asys.path.append(proj_path)%0A%0A# This is so my local_settings.py gets loaded.%0Aos.chdir(proj_path)%0A%0A# This is so models get loaded.%0Afrom django.core.wsgi import get_wsgi_application%0Aapplication = get_wsgi_application()%0A%0Afrom individuals.models import Individual%0Afrom django.contrib.auth.models import User%0Afrom django.core.files import File%0Afrom django.utils.text import slugify%0Afrom individuals.tasks import VerifyVCF%0Afrom django.conf import settings%0Aimport argparse%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument('-i', '--input', default='input', required=True)%0Aargs = parser.parse_args()%0A%0A# print(args)%0A%0A%0Aindividuals = Individual.objects.all()%0A%0Auser = User.objects.first()%0A%0Aprint(user)%0Aindividual = Individual.objects.create(user=user, status='new')%0A%0A# filepath = '/home/raony/dev/mendelmd/examples/miller.vcf.gz'%0Afilepath = args.input%0A%0Afilename = os.path.basename(filepath)%0Adirname = os.path.dirname(filepath)%0Aprint(dirname)%0Aprint(filename)%0A%0Acommand = 'cp %25s .' %25 (filepath)%0Aos.system(command)%0A%0Aif filename.endswith('.gz'):%0A    file = gzip.open('%25s' %25 (filename))%0Aelse:%0A    file = open('%25s' %25 (filename))%0A%0Aindividual.vcf_file = File(file)%0A%0A# print(individual.vcf_file.file)%0A%0Acommand = 'rm %25s' %25 (filename)%0Aos.system(command)%0A%0Aindividual.name = str(os.path.splitext(individual.vcf_file.name)%5B0%5D).replace('.vcf', '').replace('.gz', '').replace('.rar', '').replace('.zip', '').replace('._', ' ').replace('.', ' ')%0Aindividual.save()%0Aos.chmod(%22%25s/genomes/%25s/%25s%22 %25 (settings.BASE_DIR, slugify(individual.user), individual.id), 0o777)%0A%0AVerifyVCF.delay(individual.id)

add import script