Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openbis
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sispub
openbis
Commits
8dbcea20
Commit
8dbcea20
authored
11 years ago
by
barillac
Browse files
Options
Downloads
Patches
Plain Diff
dropbox script for importing movies of genes
SVN: 30059
parent
cee9ec31
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
screening/sinergia/import-genes.py
+75
-0
75 additions, 0 deletions
screening/sinergia/import-genes.py
with
75 additions
and
0 deletions
screening/sinergia/import-genes.py
0 → 100644
+
75
−
0
View file @
8dbcea20
#! /usr/bin/env python
"""
Script for uploading gene data. Data is organized in directories called as gene names. In each of these are:
two pdf files (gene and RNA); 10 mp4 gene files; 10 mp4 control files.
Samples with gene names must already exist in openBIS (created with import-clusters.py script). All data should go in the corresponding sample.
"""
import
os
,
re
,
glob
,
shutil
from
time
import
*
from
datetime
import
*
from
java.io
import
File
from
ch.systemsx.cisd.openbis.dss.etl.dto.api.v1
import
SimpleImageDataConfig
,
ImageMetadata
,
Location
from
ch.systemsx.cisd.openbis.plugin.screening.shared.api.v1.dto
import
Geometry
from
ch.systemsx.cisd.openbis.dss.etl.dto.api.v1
import
SimpleImageContainerDataConfig
,
ChannelColor
from
loci.formats
import
ImageReader
print
"
###################################################
"
tz
=
localtime
()[
3
]
-
gmtime
()[
3
]
d
=
datetime
.
now
()
print
d
.
strftime
(
"
%Y-%m-%d %H:%M:%S GMT
"
+
"
%+.2d
"
%
tz
+
"
:00
"
)
def
process
(
transaction
):
incoming
=
transaction
.
getIncoming
()
geneName
=
os
.
path
.
basename
(
incoming
.
getPath
())
#Set project/experiment/sample
project
=
transaction
.
getProject
(
"
/SINERGIA/CLUSTERS
"
)
exp
=
transaction
.
getExperiment
(
"
/SINERGIA/CLUSTERS/CLUSTERS
"
)
sample
=
transaction
.
getSample
(
"
/SINERGIA/
"
+
geneName
)
#upload the gene pdf and the RNA pdf
for
pdf
in
glob
.
glob
(
os
.
path
.
join
(
incoming
.
getPath
(),
'
*.pdf
'
)):
dataSetPDF
=
transaction
.
createNewDataSet
()
dataSetPDF
.
setDataSetType
(
"
PDF
"
)
dataSetPDF
.
setSample
(
sample
)
transaction
.
moveFile
(
pdf
,
dataSetPDF
)
# upload the 10 tif images for each gene
# tifDir = incoming.getPath() + "/tiffs"
# if not os.path.exists(tifDir):
# os.makedirs(tifDir)
# for tif in glob.glob(os.path.join(incoming.getPath(), '*.tif')):
# shutil.move(tif, tifDir)
# dataSetTIF = transaction.createNewDataSet()
# dataSetTIF.setDataSetType("TIF_IMAGES")
# dataSetTIF.setSample(sample)
# transaction.moveFile(tifDir, dataSetTIF)
#upload the 10 control movies
videoControlDir
=
incoming
.
getPath
()
+
"
/controlVideos
"
if
not
os
.
path
.
exists
(
videoControlDir
):
os
.
makedirs
(
videoControlDir
)
for
mp4
in
glob
.
glob
(
os
.
path
.
join
(
incoming
.
getPath
(),
'
control*.mp4
'
)):
shutil
.
move
(
mp4
,
videoControlDir
)
dataSetMP4Control
=
transaction
.
createNewDataSet
()
dataSetMP4Control
.
setDataSetType
(
"
VIDEOS
"
)
dataSetMP4Control
.
setSample
(
sample
)
transaction
.
moveFile
(
videoControlDir
,
dataSetMP4Control
)
#upload the 10 gene synthetic movies
videoGeneDir
=
incoming
.
getPath
()
+
"
/geneVideos
"
if
not
os
.
path
.
exists
(
videoGeneDir
):
os
.
makedirs
(
videoGeneDir
)
for
mp4
in
glob
.
glob
(
os
.
path
.
join
(
incoming
.
getPath
(),
'
*.mp4
'
)):
shutil
.
move
(
mp4
,
videoGeneDir
)
dataSetMP4Gene
=
transaction
.
createNewDataSet
()
dataSetMP4Gene
.
setDataSetType
(
"
VIDEOS
"
)
dataSetMP4Gene
.
setSample
(
sample
)
transaction
.
moveFile
(
videoGeneDir
,
dataSetMP4Gene
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment