OpenersPrimaryExamplesSection(Spacer1)Examples  (8)

OpenersExampleSection0(Spacer1)Basic Examples  (5)

This reads the file header from a sample SFF file:

Short@Import["ExampleData/Echinococcus.sff", {"SFF","Header"}]

Read the DNA sequences:

Short@Import["ExampleData/Echinococcus.sff",{"SFF","Sequence"}]

Read the DNA sequences with qualities, flowgram values, etc.:

First@Import["ExampleData/Echinococcus.sff",{"SFF","LabeledData"}]

Import names of the reads in the file:

names=Import["ExampleData/Echinococcus.sff", {"SFF","ReadName"}];
Short[names]

Retrieve a sequence entry by name:

Short@Import["ExampleData/Echinococcus.sff", {"SFF",Last@names,"LabeledData"}]

Retrieve the XML manifest of the sequencing run in the file and extract the analysis name:

manifest=Import["ExampleData/Echinococcus.sff", {"SFF","XMLManifest"}];
Flatten@Cases[manifest,XMLElement["analysis_name",_,a_]:>a,Infinity]

OpenersExampleSection1(Spacer1)Scope  (3)

Trim the sequences according to the quality-trimming coordinates:

MapThread[StringTake[#1,#2]&,Import["ExampleData/Echinococcus.sff",{"SFF",{"Sequence","ClipQualities"}}]]//Short[#,5]&

Convert the SFF file to a FASTQ file, adding 64 to the quality scores for the character encoding:

{names,seqs,quals}=Import["ExampleData/Echinococcus.sff", {"SFF",{"ReadName","Sequence","Qualities"}}];

quals=StringJoin/@FromCharacterCode[quals+64];

ExportString[First/@{names,seqs,quals},"FASTQ"]

Plot the flowgram intensity values:

numOfFlows=Import["ExampleData/Echinococcus.sff", {"SFF","Header","NumberOfFlows"}];
{flowValues,flowIndexPerBase}=Import["ExampleData/Echinococcus.sff", {"SFF",{"FlowgramValues","FlowIndexPerBase"},1}];

(*Calculate positions of bases*){a,c,g,t}=Intersection[Range[1,numOfFlows,4]+#,Accumulate[flowIndexPerBase]]&/@Range[0,3];

Labeled[ListPlot[Transpose/@({#,flowValues[[#]]}&/@{a,c,g,t}),Filling->Axis,ImageSize->400],Text@Style[#]&/@{"Flow Cycle","Intensity"},{Bottom,Left},RotateLabel->True]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {Related Formats:  (RefLink[MOL, paclet:ref/format/MOL])  ▪  (RefLink[PDB, paclet:ref/format/PDB])  ▪  (RefLink[XYZ, paclet:ref/format/XYZ])  ▪  (RefLink[FASTA, paclet:ref/format/FASTA])  ▪  (RefLink[FASTQ, paclet:ref/format/FASTQ])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Importing & Exporting, paclet:guide/ImportingAndExporting])}, {▪(RefLinkPlain[Listing of All Formats, paclet:guide/ListingOfAllFormats])}, {▪(RefLinkPlain[Scientific & Medical Data Formats, paclet:guide/ScientificAndMedicalDataFormats])}})}})