Hello Monks, i need your help in searching my two files,in first file(result)frist word of each line represents geneset and rest of the words of that line represents genes represent in that geneset{We can compare it with a draw having number of files in it, i.e geneset is nothing but a draw and files in that draw are genes,I hope you can get my point}each line may contain few hundreds of words and now i need to search each gene(words except first word)in second file(map) and print that line, which has information about genes.
My second file#RAW data chr1q21 na S100A3 S100A6 HRNR DRD5P2 ....... HSA04910_INSULIN_SIGNALING_PATHWAY na XRCC5 HRAS .... V$YY1_02 na B3GALT6 DZIP1 RAB1B SART3 FLJ20309 .. MORF_EIF3S2 na HCCS XRCC3 LDHB LDHA OXA1L RPL14 + ... module_486 na CYP3A7 C14orf179 JAG2 INTS1 RBM6 .. CATABOLIC_PROCESS na PGD HNRPD USE1 RNF217 RNASEH1 #second word can be eleminated
My output file should look some thing like this:#Map data XRCC5 SNP_A-1966881 1 EFNA1 SNP_A-1877994 9 HRNR SNP_A-1919060 2 XRCC5 SNP_A-1966884 1 XRCC5 SNP_A-1966882 1 HRNR SNP_A-1829030 1
chr1q21 HRNR SNP_A-1829030 1 HRNR SNP_A-1919060 2 EFNA1 SNP_A-1877994 9 HSA04910_INSULIN_SIGNALING_PATHWAY XRCC5 SNP_A-1966884 1 XRCC5 SNP_A-1966882 1 XRCC5 SNP_A-1966881 1 .......
I tried doing this by storing each line in array and from there getting genes (searching has to be done), but the thing is that i want to know is there any thing much simpler way to do this???
THANKS IN ADVANCE. Have a look at my code:#Actually is a subroutine which is a part of my other program: sub parseGeneEntry { ##purpose of this function is to return everythi +ng from the second tab onwards (these are the genes) $genesList = $_[0]; #print $genesList."\n"; #print "STARTING PARSING \n"; @genes; @genes = split(/\t/,$genesList); shift(@genes); ##removes first entry of array #print $#genes." "; ##for debugging only shift(@genes); #print $#genes." "; #@genes; $toReturn = ""; $counter = 0; foreach $element(@genes){ if ($counter == 0){ $toReturn = $toReturn.$element; $counter++; } else{ $toReturn = $toReturn."\t".$element; } } #$toReturn = $toReturn."\n"; #print length($toReturn)." ".$toReturn."\n\n"; return($toReturn); }
In reply to Searching each word of a file by biomonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |