linseyr has asked for the wisdom of the Perl Monks concerning the following question:
So for example I want to compare line 3,4,5 because they have the same id in column 4. My code looks like this now:chr1 15865 15915 cg13869341 908 913 chr1 18827 18877 cg14008030 688 776 chr1 29407 29457 cg12045430 43 70 chr1 29407 29457 cg12045430 43 88 chr1 29407 29457 cg12045430 43 16 chr1 29425 29475 cg20826792 57 70 chr1 29425 29475 cg20826792 57 88 chr1 29425 29475 cg20826792 57 16 chr1 29435 29485 cg00381604 33 70 chr1 29435 29485 cg00381604 33 88 chr1 29435 29485 cg00381604 33 16 chr1 68849 68899 cg20253340 560 593 chr1 69591 69641 cg21870274 791 809 chr1 91550 91600 cg03130891 55 84
But this doesn't work.. Could somebody help me? Thanks!open(intersectMethyl,'<',"intersect148methyl.bed") or die $!; my @methylData = <intersectMethyl>; close(intersectMethyl); my @methylScore; my @ids; for my $line(@methylData){ my($chr,$start,$end,$id,$scoreNormal,$scoreTumor) = split("\t",$li +ne); push(@ids, $id); for ($i = 1; $i<eof; $i++){ if (@ids[$i]==@ids[$i-1] && (($scoreTumor/1000) - ($scoreNormal +/1000) >= 0.2)){ push(@methylscore, "$chr $start $end $id $scoreNor +mal $scoreTumor") } } } open(RESULTS,'>','methylDifferences.txt') or die $!; foreach(@methylscore){ print RESULTS "$_\n"; } close(RESULTS);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: compare values while value on other column remains the same
by aaron_baugher (Curate) on Sep 22, 2012 at 02:08 UTC | |
|
Re: compare values while value on other column remains the same
by choroba (Cardinal) on Sep 21, 2012 at 19:39 UTC | |
by linseyr (Acolyte) on Sep 21, 2012 at 19:47 UTC | |
|
Re: compare values while value on other column remains the same
by Anonymous Monk on Sep 21, 2012 at 21:11 UTC | |
by linseyr (Acolyte) on Sep 26, 2012 at 20:23 UTC | |
|
Re: compare values while value on other column remains the same
by CountZero (Bishop) on Sep 22, 2012 at 12:16 UTC |