def get_expression_tsv(experiment_md): """get path to expression TSV file or None if not valid for this experiment. Will not include .gz extension or check for existence.""" if experiment_md.challenge_id is Challenge.iso_quant: return existing_datafile_name( osp.join(experiment_md.experiment_dir, EXPRESSION_TSV)) else: return None
def get_rna_fasta(experiment_md): """get path to RNA fasta file or None if not valid for this experiment. Will not include .gz extension or check for existence.""" if experiment_md.challenge_id is Challenge.iso_detect_de_novo: return existing_datafile_name( osp.join(experiment_md.experiment_dir, DE_NOVO_RNA_FASTA)) else: return None
def get_models_gtf(experiment_md): """get path to models.gtf file or None if not valid for this experiment. Will not include .gz extension or check for existence.""" if experiment_md.challenge_id in (Challenge.iso_detect_ref, Challenge.iso_quant): return existing_datafile_name( osp.join(experiment_md.experiment_dir, MODELS_GTF)) else: return None
def get_read_model_map_tsv(experiment_md): """get path to read_model_map.gtf file or None if not valid for this experiment. Will not include .gz extension or check for existence.""" if experiment_md.challenge_id in (Challenge.iso_detect_ref, Challenge.iso_detect_de_novo): return existing_datafile_name( osp.join(experiment_md.experiment_dir, READ_MODEL_MAP_TSV)) else: return None
def load(model_map_tsv): read_model_map = ReadModelMap() try: with gopen(existing_datafile_name(model_map_tsv)) as fh: for pair in _tsv_reader(fh): read_model_map.add(pair) if len(read_model_map) == 0: raise LrgaspException("TSV contains no data") return read_model_map except (LrgaspException, FileNotFoundError, csv.Error) as ex: raise LrgaspException("Parse of reads-to-models TSV failed: {}".format( model_map_tsv)) from ex