Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
バイオシェル芸のためのPerlワンライナー
Search
ktnyt
October 18, 2017
0
1.3k
バイオシェル芸のためのPerlワンライナー
「本物」のワンライナーを書こう。
ktnyt
October 18, 2017
Tweet
Share
More Decks by ktnyt
See All by ktnyt
runeとUnicodeと文字数と
ktnyt
0
280
ioのテストをうまくやりたい
ktnyt
0
170
若手から生命情報科学を問い直す@IIBMP2020
ktnyt
1
3.4k
ねこでもわかる深層学習入門
ktnyt
2
2.9k
Featured
See All Featured
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
5
1.5k
Learning to Love Humans: Emotional Interface Design
aarron
266
39k
Art, The Web, and Tiny UX
lynnandtonic
288
19k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
1
3.4k
The Straight Up "How To Draw Better" Workshop
denniskardys
227
130k
The Success of Rails: Ensuring Growth for the Next 100 Years
eileencodes
29
6k
Rebuilding a faster, lazier Slack
samanthasiow
72
8.2k
The Language of Interfaces
destraynor
151
23k
GitHub's CSS Performance
jonrohan
1023
450k
Typedesign – Prime Four
hannesfritz
36
2.1k
StorybookのUI Testing Handbookを読んだ
zakiyama
11
4.6k
Designing for humans not robots
tammielis
247
25k
Transcript
όΠΦγΣϧܳͷͨΊͷ PerlϫϯϥΠφʔ @kotone_nyt
ࣗݾհ ࣾձෆద߹ऀΩϟϯύεʹि̍Ͱ௨͍ͬͯΔ ͦͷੲόΠΦܥͷιϑτΣΞΛ։ൃͯͨ͠ ΞΠυϧϚελʔγϯσϨϥΨʔϧζΛѪ͢Δ υϫϯΰਓೳݚڀॴͷόΠτ ͜ͱ @kotone_nyt
ΤΠϦΞεΛషΔ͚ͩͰ͍͍͔ΒҠ২ੑ͕ߴ͍ ίϐϖ͢Δ͚ͩͰ͑ΔͷͰಋೖͷোน͕͍ ϓϩάϥϜΛҰߦͰهड़͢ΔͷͰݟ௨͕͠ྑ͍ ϝϦοτ ͋ͱָ͍͠ʂʂʂ✌('ω' ✌)ࡾ✌('ω')✌ࡾ(✌ 'ω')✌
One Line FASTQ Filter
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{print join("\n",map{join("\n",@{$_})} grep{List::Util::sum(map{ord($_)-33}split(//,$_-
>[3]))>2000}@d)' > filtered.fastq FASTQ Filter ίʔυࣗମͨͬͨͷ129όΠτʂ
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{ print join("\n",
map{join("\n",@{$_})} grep{ List::Util::sum( map{ ord($_)-33 }split(//,$_->[3]) )>2000 }@d )' > filtered.fastq FASTQ Filter
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{ print join("\n",
map{join("\n",@{$_})} grep{ List::Util::sum( map{ ord($_)-33 }split(//,$_->[3]) )>2000 }@d )' > filtered.fastq FASTQ Filter
֤छϑϥά ϑϥά ػೳ -e ϫϯϥΠφʔϞʔυ -l print ڧ੍վߦ -n ෳߦॲཧ
-a AWKϞʔυ -p ෳߦ+print -MModule use Module; https://qiita.com/tossh/items/f8d448c0c039f68c0ea3
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{ print join("\n",
map{join("\n",@{$_})} grep{ List::Util::sum( map{ ord($_)-33 }split(//,$_->[3]) )>2000 }@d )' > filtered.fastq FASTQ Filter
$. Perlͷ҉มͷ͏ͪͷҰͭ ߦ൪߸͕֨ೲ͞Ε͍ͯΔ 0Ͱͳ͘1ΠϯσΫεͳͷͰҙ
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{ print join("\n",
map{join("\n",@{$_})} grep{ List::Util::sum( map{ ord($_)-33 }split(//,$_->[3]) )>2000 }@d )' > filtered.fastq FASTQ Filter
}{ ͍ΘΏΔൿີԋࢉࢠͷҰͭ ϫϯϥΠφʔʹENDϒϩοΫΛՃ͢Δԋࢉࢠ ϑΝΠϧΛॲཧͯ͠࠷ޙʹprintΈ͍ͨͳࣄ͕Ͱ͖Δ
$ cat test.fastq | perl -MList::Util -lne '$d[($.-1)/4]->[($.-1)%4]=$_}{ print join("\n",
map{join("\n",@{$_})} grep{ List::Util::sum( map{ ord($_)-33 }split(//,$_->[3]) )>2000 }@d )' > filtered.fastq FASTQ Filter
·ͱΊ • ͜ΕͬͯPerlܳ͡Όͳ͍ʁ • ·͊ɺͦ͏Ͱ͢Ͷ... • ͩ͜ΘΓΛ࣋ͭͱָ͍͠ • ηϛίϩϯΛΘͳ͍ͱ͔ •
grep/map/subΛ͏·͍͘·͠ΐ͏
͓·͚ɿॏෳͷౕ $ cat hoge | tr -dc a-z | perl
-le 'sub{map{print}split(//,shift)}->(<>)' | uniq -c | sort -nr | head -n 1 7 a
͓·͚ɿFASTQੜ $ seq 10 | perl -lne 'print join("\n", (sprintf("\@seq%03d",$.),join("",map{qw(a
t g c) [rand(4)]}0..99),sprintf("\+seq%03d", $.),join("",map{chr(rand(41)+33)}0..99)))'
͓·͚ɿST*P while("STAP"ne$s){print$s=join("",map{qw(S T A P)[4*rand]}0..3),"\n"}print"ཅੑ͔͘ʹΜ! Α͔ ͬͨˑ\n"