文本程序处理.ppt_第1页
文本程序处理.ppt_第2页
文本程序处理.ppt_第3页
文本程序处理.ppt_第4页
文本程序处理.ppt_第5页
已阅读5页,还剩20页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Liqi Gao,Text Operations,Utilities,C/C+ Library Perl (Active Perl) Regular Expression Edit Plus / Ultra Edit Excel,C/C+ Language,Standard library: Read a line Remove a CR or LF Split a line,C+ Boost Library Case Conversion Trimming Replace Algorithm Finding Algorithm Split,C/C+: Read a Line,Though i

2、ts simple, its useful! Three methods:,C/C+: Remove CR/LF,Get a line under Windows and Linux platform,C/C+: Remove CR/LF (cont.),The noising CR Carriage Return,C/C+: Split a Line,Split a line by a specific character,C/C+: Split a Line (cont.),Split a line,C+ Boost: Case Conversion,to_upper: Convert a

3、 string to upper case to_lower: Convert a string to lower case,C+ Boost: Trimming - variable assignment statement print “Hello world!n”; printf “All %d of you!n”, $x;,- function calls (output statements),perltaste.pl: Greet the entire world.,Scalar Values,Numerical Values integer:5, “3”, 0, -307 flo

4、ating point: 6.2e9, -4022.33 hexadecimal/octal:0 x0d4f, 0477 NOTE: all numerical values stored as floating-point numbers (usu. “double” precision),String Values,Double-quoted: interpolates (replaces variable name/control character with its value) Single-quoted: no interpolation done (as-is) Quoting

5、operators: qq/, qw/, etc.,$day = “Monday”; “Happy Monday!n”Happy Monday! “Happy $date!n”Happy Monday! Happy Monday!nHappy Monday! Happy $date!nHappy $date!n,String Manipulation,Concatenation $dna1 = “ACTGCGTAGC”; $dna2 = “CTTGCTAT”; juxtapose in a string assignment or print statement $new_dna = “$dn

6、a1$dna2”; Use the concatenation operator . $new_dna = $dna1 . $dna2; Add segments serially using incremental concatenation: $new_dna = $dna1; $new_dna .= $dna2; (shorthand for: $new_dna = $new_dna . $dna2;),Substitution,DNA transcription: T U Substitution operator s/: $dna = “GATTACATACACTGTTCA”; $r

7、na = $dna; $rna = s/T/U/;# “GAUUACAUACACUGUUCA” Exercise: Start with $dna =“gattACataCACTgttca”; and do the same as above. Print out $rna to the screen.,transcribe.pl:,$dna =“gattACataCACTgttca”; $rna = $dna; $rna = s/T/U/g; print DNA: $dnan; print RNA: $rnan;,Does it do what you expect? If not, why

8、 not?,Patterns in substitution are case-sensitive! What can we do? Convert all letters to upper (or lower) case (preferred when possible) If we want to retain mixed case, use transliteration operator tr/ $rna = tr/tT/uU/;,Case conversion,$string = “acCGtGcaTGc”; Upper case: $dna = uc($string);# “ACCGTGCATGC” or $dna = uc $string; or $dna = “U$string”; Lower case: $dna = lc($string);# “accgtgcatgc” or $dna = “L$string”; Sentence case: $dna = ucfirst($string) # “Accgtgcatgc” or $dna = “uL$string”;,Per

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论