www.gusucode.com > bioinfo 案例源码程序 matlab代码 > bioinfo/SplitSequencesIntoSeparateFilesBasedOnBarcodesExample.m

    %% Split sequences into separate files based on barcodes
% 
%%
% Create a tab-delimited file with barcode IDs and barcode sequences.
 barcodeInfo = {'ID1', 'AAAAC'; 'ID2', 'AGATT'; 'ID3', 'GACTT'};
 writetable(cell2table(barcodeInfo), 'barcodeExample.txt', ...
        'Delimiter', '\t', 'WriteVariableNames', false);
    
%%
% Split sequences into separate output files based on the barcode
% sequences. By default, the function assumes that the barcode is located
% at the 5' end of each sequence, and no mistmatches are allowed during
% barcode matching.
[outFiles, N] = seqsplit('SRR005164_1_50.fastq', 'barcodeExample.txt');
%%
% Check the number of sequences in each output file after splitting.
N

%%
% Allow up to two mismatches during the barcode matching.
[outFiles, N] = seqsplit('SRR005164_1_50.fastq', 'barcodeExample.txt', ...
        'MaxMismatches',2,'OutputSuffix','_MM2_split');
%%
% 
N