Interactive data analysis can be performed in cells with different kernels as follows. Because SoS is an extension to Python 3, you can use arbitrary Python statements in SoS cells.
In [1]:
fastq_file = 'raw_data.fastq'
count_file = 'aligned.csv'
output_pdf = 'myfigure.pdf'
In [2]:
%expand
echo count_reads --infile {fastq_file} --outfile {count_file}
echo "A,B" > {count_file}
echo "1,2" >> {count_file}
In [3]:
%expand
count.data <- read.csv('{count_file}')
pdf('{output_pdf}')
plot(count.data)
dev.off()
SoS workflows within a SoS Notebook are defined by sections marked by section headers ([name: option]). A [global] section should be used for definitions that will be used by all steps.
You also need to convert scripts to SoS actions so that they can be executed as complete scripts. Remember also to change the cell type from subkernel to SoS.
In [ ]:
[global]
fastq_file = 'raw_data.fastq'
count_file = 'aligned.csv'
output_pdf = 'myfigure.pdf'
In [ ]:
[analysis_10 (align)]
sh: expand=True
echo count_reads --infile {fastq_file} --outfile {count_file}
echo "A,B" > {count_file}
echo "1,2" >> {count_file}
In [ ]:
[analysis_20 (plot)]
R: expand=True
count.data <- read.csv('{count_file}')
pdf('{output_pdf}')
plot(count.data)
dev.off()
In [ ]:
%preview --workflow
In [ ]:
%sosrun