Skip to content

Instantly share code, notes, and snippets.

@JWDebler
Created January 6, 2022 07:18
Show Gist options
  • Save JWDebler/4af1e37ac96af3d9ed2104658993d944 to your computer and use it in GitHub Desktop.
Save JWDebler/4af1e37ac96af3d9ed2104658993d944 to your computer and use it in GitHub Desktop.
fast5 demultiplex by barcode
pip3 install ont-fast5-api
cat sequencing_summary.txt | cut -f 21 | grep barcode[0-9] | sort | uniq > barcodes.log
while read -r barcode
do
head -n 1 sequencing_summary.txt > $barcode.txt
cat sequencing_summary.txt | grep $barcode >> $barcode.txt
for f in *.txt
do
fast5_subset -i folder/with/your/fast5s -s output/folder/for/demultiplexed_fast5/$barcode -l $f -t 14
done
done < barcodes.log
@JWDebler
Copy link
Author

JWDebler commented Feb 17, 2022 via email

@Fatihlrcfs
Copy link

Hi Johannes,

I am still working to fix my problem but many thanks for your help. I have really appreciated your effort for help. have a great days.:)

Sincerely.

@JWDebler
Copy link
Author

JWDebler commented Feb 21, 2022 via email

@Fatihlrcfs
Copy link

Hi Johannes,

I wanna let you know that your code has worked on my last run and ı have been able to separate fast5 for each barcode. I dont know why but ıt has not been working my previous run (still generate - folder and put all fast5 in there like here nanoporetech/ont_fast5_api#68) so ı decided to basecall all my previous raw data again and see how it come up. I wanna personally say many thanks for your effort. have a great days.:)

Best wishes.

@JWDebler
Copy link
Author

JWDebler commented Feb 28, 2022 via email

@Fatihlrcfs
Copy link

hi @BeatrizFaustino

I used demux_fast5 --input fast5_skip/ --save_path ./demutiplexedfast5/ --summary_file sequencing_summary.txt command for demultiplex my fast_skip folder for barcoded. You should use Minknown sequencing summary file for input.

@Fatihlrcfs
Copy link

Hi @BeatrizFaustino ,

the sequence summary file that ı used is provided after sample runs (sequenced) from MiKnown generally sequence_summarry_FAPxxxxx.txt. it's not generated a file after base calling like a guppy.
Yes fast5_skip includes all fast5 that is generated after sequencing by MinKnown and they don't separate by MinKnown (or you stopped the basecalling after sequencing finished but basecalling was still continuing). I hope this help you. thanks

@BeatrizFaustino
Copy link

Hi
is demux present in guppy or other software?

@Fatihlrcfs
Copy link

hi @BeatrizFaustino ,

I used this page as a demultiplex ont_fast5_api

@BeatrizFaustino
Copy link

Hi @Fatihlrcfs
Thank you very much, using the commands you gave me the analyzes ended now and I was successful

@JWDebler
Copy link
Author

JWDebler commented Dec 20, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment