Page History
...
Code Block | ||
---|---|---|
| ||
curl --form username=admin --form encrypt=RSA --form password=cUOWY0VvkSFagr... http://localhost:8080/flow/api/v1/users/list |
Upload and analyze a group of samples
...
Create a project
Flow organizes data by projects and they can be created and managed by the REST API.
To create a project:
Code Block | ||
---|---|---|
| ||
curl -X POST --form username=admin --form encrypt=RSA --form password=$FLOW_TOKEN --form project="My Project" http://localhost:8080/flow/api/v1/projects |
The server will respond with JSON data describing the new project:
Code Block |
---|
{"name":"My Project","id":"0","description":"","owner":"0","userRoles":{"0":"Project owner"},"outputFolders":{"0":"/home/flow/FlowData/Project_My Project"},"diskUsage":"0 GB","lastModifiedTimeStamp":1506013662476,"lastModifiedDate":"12:00 PM","data":[]} |
The new project will appear on the Flow homepage:
Upload a group of samples
UploadSamples.py is a python script that can create samples within a project by uploading files:
Code Block | ||
---|---|---|
| ||
python UploadSamples.py --verbose --user admin --password $FLOW_TOKEN --server http://localhost:8080 --project "My Project" \
--files ~/MoreData/REST/sample1.fastq.gz ~/MoreData/REST/sample2.fastq.gz ~/MoreData/REST/sample3.fastq.gz ~/MoreData/REST/sample4.fastq.gz |
This operation will generate a data node on the Analyses tab for the imported samples:
Assign sample attributes
We can associate attributes with samples for use in visualizations and statistical analysis:
Code Block | ||
---|---|---|
| ||
python AddAttribute.py -v --server http://localhost:8080 --user admin --password $FLOW_TOKEN --project_name "My Project" --sample_name sample1 --attribute Type --value Case
python AddAttribute.py -v --server http://localhost:8080 --user admin --password $FLOW_TOKEN --project_name "My Project" --sample_name sample2 --attribute Type --value Case
python AddAttribute.py -v --server http://localhost:8080 --user admin --password $FLOW_TOKEN --project_name "My Project" --sample_name sample3 --attribute Type --value Control
python AddAttribute.py -v --server http://localhost:8080 --user admin --password $FLOW_TOKEN --project_name "My Project" --sample_name sample4 --attribute Type --value Control
|
The sample attributes can be viewed and managed on the data tab:
Run a pipeline
A pipeline is a series of tasks used to process and analyze genomic data. You can read more about pipelines here
To run a pipeline, first we need to know its name.
We can get the name of a pipeline from the GUI or from the API:
Code Block | ||
---|---|---|
| ||
wget -O - http://localhost:8080/flow/api/v1/pipelines/ |
...
list$AUTHDETAILS | python -m json.tool | gvim -
|
Get the list of required inputs for the pipeline from the API
...
http://localhost:8080/flow/api/v1/library_files/list?assembly=hg19
Use Alternatively, UploadSamples.py to can create the project, upload the samples and launch the pipeline in one step:
Code Block | ||
---|---|---|
| ||
python UploadSamples.py -v --server http://localhost:8080 --user admin --password [access token] $FLOW_TOKEN --files ~/sample1.fastq.gz ~/sample2.fastq.gz --project ProjectNameNewProject --pipeline AlignAndQuantify --inputs 28061,145855 |
Use AddAttribute.py to add sample attributes:
Code Block | ||
---|---|---|
| ||
python AddAttribute.py -v --server http://localhost:8080 --user admin --password [access token] --project_name ProjectName --sample_name sample1 --attribute Type --value Case |
Add a collaborator to a project
To add a collaborator to a project:
Code Block | ||
---|---|---|
| ||
curl -X PUT "http://localhost:8080/flow/api/v1/projects?project=ProjectName&collaborator=user1&role=Collaborator&username=admin&encrypt=RSA&password=[url encoded token]" |
Monitor a folder and upload files as they are created
Code Block | ||
---|---|---|
| ||
#!/bin/bash inotifywait -m $PATH_TO_MONITOR -e create -e moved_to | while read path action file; do if [[ $file == *.fastq.gz ]]; then echo "Uploading $file" python UploadSamples.py -v --server $SERVER --user $USER --password $TOKEN --files $path/$file --project "$PROJECT" fi done |
...