def main(): db = mds.get_db() schema_version = mds.get_schema_version(db) if schema_version is not None: hit_schema_version = False for from_version, conversion_func in SCHEMA_UPGRADE_FUNCTIONS: if hit_schema_version or schema_version == from_version: hit_schema_version = True observed_from_version = mds.get_schema_version(db) if observed_from_version != from_version: raise Exception( 'Aborting schema upgrade. ' 'Expected schema version to be {} but observed {}'. format( mds.version_to_str(from_version), mds.version_to_str(observed_from_version), )) print('upgrading schema from version:', mds.version_to_str(from_version)) conversion_func(db) mds.init_db(db) print( 'successfully upgraded schema to version:', mds.version_to_str(mds.get_schema_version(db)), )
def main(): # parse command line arguments parser = argparse.ArgumentParser(description='import SNP annotations') parser.add_argument( 'platform', help= 'the platform for the data we are importing. eg: MegaMUGA or GigaMUGA') parser.add_argument( 'snp_annotation_txt', help= 'the tab-delimited snp annotation file. There should be a header row and one row per SNP' ) args = parser.parse_args() import_snp_anno(args.snp_annotation_txt, args.platform, mds.init_db())
def main(): # parse command line arguments parser = argparse.ArgumentParser( description='import the final report with probe intensities') parser.add_argument( '--generate-ids', action='store_true', help= 'this option indicates that the "Sample ID" column should be treated as a non-canonical identifier and ' 'a canonical ID will be automatically generated for each sample', ) parser.add_argument( '--on-duplicate', choices=['halt', 'skip', 'replace'], help= 'this option is only meaningful if --canonical-ids is also set. This indicates what action to take if a ' 'duplicate canonical ID is encountered during import: halt the import process with an error message, ' 'skip the sample with a warning message or replace the existing sample with a warning', ) parser.add_argument( 'platform', help='the platform for the data we are importing. eg: MegaMUGA') parser.add_argument( 'final_report', help= 'the final report file as exported by GenomeStudio Genotyping Module. This report must ' 'be tab separated, must be in the "Standard" format and must contain ' 'at least the following columns: ' 'SNP Name, Sample ID, X, Y, Allele1 - Forward, Allele2 - Forward') parser.add_argument( 'sample_annotation_txt', nargs='*', help= 'an (optional) tab-delimited sample annotation file. There should be a header row and one row per sample' ) args = parser.parse_args() sample_anno_dicts = dict() for sample_anno_filename in args.sample_annotation_txt: curr_dicts = sai.sample_anno_dicts(sample_anno_filename) sample_anno_dicts = sai.merge_dicts(sample_anno_dicts, curr_dicts) report_name = splitext(basename(args.final_report))[0] import_final_report(args.generate_ids, args.on_duplicate, args.final_report, sample_anno_dicts, args.platform, [report_name, args.platform], mds.init_db())
def main(): # parse command line arguments parser = argparse.ArgumentParser( description='import annotations for genetically-engineered constructs') parser.add_argument( 'platform', help= 'the platform for the data we are importing. eg: MegaMUGA or GigaMUGA') parser.add_argument( 'annotation_txt', help= 'the tab-delimited file with header columns: "Target", "Marker" and "Informative axis". ' 'The target column contains an identifiers for the genetically-engineered construct being ' 'targeted by the marker. Informative axis will be "x" or "y" and indicates which axis ' 'is informative for performing a presence/absence call for the genetically-engineered ' 'constructs (the non-informative axis will be ignored)') args = parser.parse_args() import_gemm_anno(args.annotation_txt, args.platform, mds.init_db())
def main(): # parse command line arguments parser = argparse.ArgumentParser( description='import the final report with probe intensities') parser.add_argument( 'platform', help='the platform for the data we are importing. eg: MegaMUGA') parser.add_argument( 'tag', help='a tag name that should be associated with all imported samples') parser.add_argument('geno_matrix_csv', help='comma-separated genotype values matrix') parser.add_argument('x_matrix_csv', help='comma-separated X intensity values matrix') parser.add_argument('y_matrix_csv', help='comma-separated Y intensity values matrix') args = parser.parse_args() import_samples(args.platform, args.geno_matrix_csv, args.x_matrix_csv, args.y_matrix_csv, [args.tag, args.platform], mds.init_db())