<commit_before>Cli cli = new Cli()
cli.with {
    vcf "VCF file to import to database", args:1, required:true
    ped "Pedigree file (PED format) for samples in VCF file", args:1, required:true
    db "SQLite database file to insert into", args:1, required:true
    batch "Name of batch to which sample belongs", args:1, required:true
}

def opts = cli.parse(args)
if(!opts)
    System.exit(1)

Pedigrees peds = Pedigrees.parse(opts.ped)

VariantDB db = new VariantDB(opts.db)
def progress = new ProgressCounter(withRate:true)
try {
    db.tx {
        VCF.parse(opts.vcf) { Variant v ->
            // println "Adding variant $v to database"
            db.add(opts.batch, peds, v)    
            progress.count()
        }
    }
    progress.end()
}
finally {
    db.db.close()
}<commit_msg>force display of exception, flush db<commit_after>import org.codehaus.groovy.runtime.StackTraceUtils;

Cli cli = new Cli()
cli.with {
    vcf "VCF file to import to database", args:1, required:true
    ped "Pedigree file (PED format) for samples in VCF file", args:1, required:true
    db "SQLite database file to insert into", args:1, required:true
    batch "Name of batch to which sample belongs", args:1, required:true
}

def opts = cli.parse(args)
if(!opts)
    System.exit(1)

Pedigrees peds = Pedigrees.parse(opts.ped)

VariantDB db = new VariantDB(opts.db)
def progress = new ProgressCounter(withRate:true)
int exitCode = 0
try {
    db.tx {
        VCF.parse(opts.vcf) { Variant v ->
            // println "Adding variant $v to database"
            db.add(opts.batch, peds, v)    
            progress.count()
        }
    }
    progress.end()
}
catch(Exception e) {
    StackTraceUtils.sanitize(e).printStackTrace()
    exitCode = 1
}
finally {
    db.db.close()
}
System.exit(exitCode)
{'fraction_non_alphanumeric': 0.1165644171779141, 'fraction_numerical': 0.006692693809258227, 'mean_word_length': 2.9602649006622515, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4127488', 'n_tokens_mistral': 612, 'n_tokens_neox': 595, 'n_words': 174}