def _insert_genomic_set_from_row(row, csv_filename, timestamp):
    """Creates a new GenomicSet object from a CSV row.

  Raises:
    DataError if the row is invalid.
  Returns:
    A new GenomicSet.
  """
    genomic_set_name = row[CsvColumns.GENOMIC_SET_NAME],

    set_dao = GenomicSetDao()
    genomic_set_version = set_dao.get_new_version_number(genomic_set_name)
    kwargs = dict(
        genomicSetName=genomic_set_name,
        genomicSetCriteria=row[CsvColumns.GENOMIC_SET_CRITERIA],
        genomicSetFile=csv_filename,
        genomicSetFileTime=timestamp,
        genomicSetStatus=GenomicSetStatus.UNSET,
        genomicSetVersion=genomic_set_version,
    )

    genomic_set = GenomicSet(**kwargs)
    set_dao.insert(genomic_set)

    return genomic_set
Exemple #2
0
    def _create_fake_genomic_set(self, genomic_set_name, genomic_set_criteria,
                                 genomic_set_filename):
        now = clock.CLOCK.now()
        genomic_set = GenomicSet()
        genomic_set.genomicSetName = genomic_set_name
        genomic_set.genomicSetCriteria = genomic_set_criteria
        genomic_set.genomicSetFile = genomic_set_filename
        genomic_set.genomicSetFileTime = now
        genomic_set.genomicSetStatus = GenomicSetStatus.INVALID

        set_dao = GenomicSetDao()
        genomic_set.genomicSetVersion = set_dao.get_new_version_number(
            genomic_set.genomicSetName)

        set_dao.insert(genomic_set)

        return genomic_set