{"action":"closed","issue":{"url":"https://api.github.com/repos/WinterLi1993/Bioinfomatics/issues/6","labels_url":"https://api.github.com/repos/WinterLi1993/Bioinfomatics/issues/6/labels{/name}","comments_url":"https://api.github.com/repos/WinterLi1993/Bioinfomatics/issues/6/comments","events_url":"https://api.github.com/repos/WinterLi1993/Bioinfomatics/issues/6/events","html_url":"https://github.com/WinterLi1993/Bioinfomatics/issues/6","id":111312908,"number":6,"title":"E_test_Answer","user":{"login":"WinterLi1993","id":10543236,"avatar_url":"https://avatars.githubusercontent.com/u/10543236?v=3","gravatar_id":"","url":"https://api.github.com/users/WinterLi1993","html_url":"https://github.com/WinterLi1993","followers_url":"https://api.github.com/users/WinterLi1993/followers","following_url":"https://api.github.com/users/WinterLi1993/following{/other_user}","gists_url":"https://api.github.com/users/WinterLi1993/gists{/gist_id}","starred_url":"https://api.github.com/users/WinterLi1993/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/WinterLi1993/subscriptions","organizations_url":"https://api.github.com/users/WinterLi1993/orgs","repos_url":"https://api.github.com/users/WinterLi1993/repos","events_url":"https://api.github.com/users/WinterLi1993/events{/privacy}","received_events_url":"https://api.github.com/users/WinterLi1993/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-10-14T03:12:14Z","updated_at":"2016-01-13T08:05:12Z","closed_at":"2016-01-13T08:05:12Z","body":"#!/usr/bin/env perl -w \r\n\r\nuse strict;\r\nuse Getopt::Long;\r\n=head\r\nAuthor:Winter Li\r\n=cut\r\n\r\nmy %opts;\r\nGetOptions(\\%opts,\"infile=s\",\"cutoff=s\",\"outfile=s\",\"h\");\r\nmy $infile=$opts{infile};\r\nmy $outfile=$opts{outfile};\r\nmy $cutoff = $opts{cutoff} || 0;\r\nmy $help = $opts{h};\r\n\r\n#if (!defined($infile) || $help) { \r\nif (!defined($infile) || !defined($outfile) || $help) { \r\n\tprint <<Usage;\r\n\tperl  $0 -infile test.fa -cutoff [optional]  (float type [0.0])  -outfile output\r\nUsage\r\n\texit;\r\n}\r\n\r\nopen IN,\"<\",$infile || die \"Cannot open the $infile!$!\";\r\n\r\nopen OUT,\">\",$outfile || die \"Cannot create the $outfile!$!\";\r\n\r\nmy %data = ();\r\nmy @label;\r\nmy $seqstr=undef;\r\nmy $count = -1;\r\nwhile ( <IN>) { \r\n\tchomp(my $line = $_);\r\n\t\r\n\tif ( $line =~/^(>\\w+)/) {\r\n\t\tmy $lab = $1;\r\n\t\t$count++;\r\n\t\tpush(@label,$lab);\r\n\t\tif (defined($seqstr)) {\r\n\t\t\t#&BaseStat() get AT:percentage GC:percentage\r\n\t\t\tmy ($at,$gc)=&BastStat($seqstr);\r\n\t\t\tif ( $gc > $cutoff) {\r\n\t\t\t\tmy $chrName=\"$label[$count-1]\\t$at\\t$gc\\n\";\r\n\t\t\t\tprint OUT \"$chrName$seqstr\\n\";\r\n\t\t\t}\r\n\r\n\r\n\t      }\r\n\t $seqstr = \"\";\r\n\t next;\r\n\r\n     }\r\n\t$seqstr = $seqstr.$line;\r\n\r\n }\r\n\r\n\r\n my ($at,$gc)=&BastStat($seqstr);\r\n  if ( $gc > $cutoff) {\r\n\tmy $chrName=\"$label[$count-1]\\t$at\\t$gc\\n\";\r\n\t print OUT \"$chrName$seqstr\\n\";\r\n}\r\n\r\n\r\n\r\n# return('>seqXX\\tATpercentageGCpercentage',GCGCpercentage)\r\n\r\nsub BastStat { \r\n\tmy $basestr = shift @_;\r\n\t\r\n\tmy $ATcount = $basestr =~ tr/AT/AT/;\r\n\tmy $GCcount = $basestr =~ tr/GC/GC/;\r\n\tmy $totalBase = length($basestr);\r\n\tmy $at = $ATcount/$totalBase if $totalBase;\r\n\tmy $gc = $GCcount/$totalBase if $totalBase; \r\n\tmy $AT=sprintf(\"%.2f\",$at);\r\n\tmy $GC=sprintf(\"%.2f\",$gc);\r\n\treturn($AT,$GC);\r\n}\t\r\n"}}