Exemple #1
0
    'kive')  # don't do this in practice, store your password somewhere safe

efd_name = "ExternalFiles"  # make an ExternalFileDirectory with this name
efd_path = ""  # fill this in with your own path
external_path = "external_file.dat"
external_file_contents = "foo"

with open(os.path.join(efd_path, external_path), "wb") as f:
    f.write(external_file_contents)

# Upload data
try:
    ext_ds = kive.add_dataset('ExternalDatasetFile',
                              'External copy of 1234A_R1',
                              None,
                              None,
                              None, ["Everyone"],
                              externalfiledirectory=efd_name,
                              external_path=external_path)
except KiveMalformedDataException:
    ext_ds = kive.find_datasets(name='ExternalDatasetFile')[0]

# Now get the file and check that the results make sense.
retrieved_ext_ds = kive.get_dataset(ext_ds.dataset_id)

print(retrieved_ext_ds.__dict__)

assert retrieved_ext_ds.dataset_id == ext_ds.dataset_id
assert retrieved_ext_ds.filename == ext_ds.filename
assert retrieved_ext_ds.name == "ExternalDatasetFile"
assert retrieved_ext_ds.cdt.cdt_id == "__raw__"
efd_name = "ExternalFiles"  # make an ExternalFileDirectory with this name
efd_path = ""  # fill this in with your own path
external_path = "external_file.dat"
external_file_contents = "foo"

with open(os.path.join(efd_path, external_path), "wb") as f:
    f.write(external_file_contents)

# Upload data
try:
    ext_ds = kive.add_dataset(
        'ExternalDatasetFile',
        'External copy of 1234A_R1',
        None,
        None,
        None,
        ["Everyone"],
        externalfiledirectory=efd_name,
        external_path=external_path
    )
except KiveMalformedDataException:
    ext_ds = kive.find_datasets(name='ExternalDatasetFile')[0]

# Now get the file and check that the results make sense.
retrieved_ext_ds = kive.get_dataset(ext_ds.dataset_id)

print(retrieved_ext_ds.__dict__)

assert retrieved_ext_ds.dataset_id == ext_ds.dataset_id
assert retrieved_ext_ds.filename == ext_ds.filename
assert retrieved_ext_ds.name == "ExternalDatasetFile"
Exemple #3
0
from kiveapi import KiveAPI, KiveMalformedDataException

# This assumes you have a Kive instance listening on port 8000, running
# the demo fixture.  In production, you wouldn't put your authentication
# information in source code.
KiveAPI.SERVER_URL = 'http://localhost:8000'
kive = KiveAPI()
kive.login('kive', 'kive')

# Upload data
try:
    fastq1 = kive.add_dataset('New fastq file 1', 'None', open('exfastq1.fastq', 'r'), None, None, ["Everyone"])
except KiveMalformedDataException:
    fastq1 = kive.find_datasets(name='New fastq file 1')[0]

try:
    fastq2 = kive.add_dataset('New fastq file 2', 'None', open('exfastq2.fastq', 'r'), None, None, ["Everyone"])
except KiveMalformedDataException:
    fastq2 = kive.find_datasets(name='New fastq file 2')[0]

# Get the pipeline by family ID
pipeline_family = kive.get_pipeline_family(2)

print('Using data:')
print(fastq1, fastq2)

print('With pipeline:')
print(pipeline_family.published_or_latest())

# Create a RunBatch.
rb = kive.create_run_batch(
Exemple #4
0
from kiveapi import KiveAPI, KiveMalformedDataException

# This assumes you have a Kive instance listening on port 8000, running
# the demo fixture.  In production, you wouldn't put your authentication
# information in source code.
KiveAPI.SERVER_URL = 'http://localhost:8000'
kive = KiveAPI()
kive.login('kive', 'kive')

# Upload data
try:
    fastq1 = kive.add_dataset('New fastq file 1', 'None',
                              open('exfastq1.fastq', 'r'), None, None,
                              ["Everyone"])
except KiveMalformedDataException:
    fastq1 = kive.find_datasets(name='New fastq file 1')[0]

try:
    fastq2 = kive.add_dataset('New fastq file 2', 'None',
                              open('exfastq2.fastq', 'r'), None, None,
                              ["Everyone"])
except KiveMalformedDataException:
    fastq2 = kive.find_datasets(name='New fastq file 2')[0]

# Get the pipeline by family ID
pipeline_family = kive.get_pipeline_family(2)

print('Using data:')
print(fastq1, fastq2)

print('With pipeline:')