OK getting closer, but I am still unsure of *where* the references come from.
If they were static like you posted that is easy. Now you mention a filename:
Quote:
Yes but the numbers continue into the millions so itd be easier to set the reference as the entire filename instead I believe.
What file name?
I cannot find anywhere in this post where you have mentioned getting the references from filenames...
If there is more than one file involved please specify that, if the *names* of the file are important then also point that out and specify the names.
We need a sample of *ALL* data you are working with (even if bogus but representative), and a description of what columns, fields, or characters you want to match on.
Beyond that we can only work with what we are given and your results may not be helpful.
EDIT:
Going on the static reference you gave I come up with this:
RESULTS:
Maybe that will help you get further in your solution...
Last edited by ddreggors; 06-06-2012 at 12:08 PM..
Okay I'll start over and try to be more exact.
I am looking at a file that has about 3 million rows and about 100 columns. The row number is given by the index number, in the 1st column, as previously shown. The genotypes that I need to look at, 'TT' or 'GG', for example, are located in the 88th column. The last column of importance is the 6th in which it gives the name of the mutation, such as 'intronic'.
In a seperate file, there are two columns. The first being the index number that ranges from 1 to about 3 million, and the second has static values for the references, i.e 'T' or 'G'.
I would like to compare the letters in index 1 of the first file with index 1 of the second file, and so on and so forth.
Now I am changing one aspect of this so I apologize.
If either one of the letters from the first file at index 1 matches the letter from the second file at index 1, I would like for the 1st column and 6th column of the first file to be printed out.
For example:
Output: Since at index 4 and 5, one of the letters in the genotype in file 1 match the letter from file 2, i would like the following to be displayed:
I hope this is more helpful
Thank you so much its running flawlessly for me.
Is there any quick alteration that could be made so that instead of reporting back the cases in which neither letter is the same as the reference, it would instead report all cases where at least one of the letters DOES match the reference?
Sorry for changing up, and i appreciate your help a ton.
Is there any quick alteration that could be made so that instead of reporting back the cases in which neither letter is the same as the reference, it would instead report all cases where at least one of the letters DOES match the reference?
As in the opposite of what it is doing now?
If so then the next to last line in the second loop can be changed as follows...
Original: Changed:
BTW my original code was only really good for 3 columns in the data file.
Here is the same code working for 88 columns as you stated...
again changing the next to last line of the second loop from "!~" to "=~" to get the opposite behavior.
NOTE:
I cleaned up the code a bit, I removed the unused variables ($geno & @ref) and also now I close the file handles (FILE1 & FILE2).
Last edited by ddreggors; 06-06-2012 at 03:56 PM..
Hi everyone
I have a question for you, as I am trying to learn more about Perl and work with some weather data. I have an ascii file (shown below) that has 10 lines with different columns. What I would like is have Perl find an "anomalous" value by comparing a field with the values from the last... (2 Replies)
I have these two file that I am trying to compare using shell arrays. I need to find out the changed or the missing
enteries from File2. For example. The line "f nsd1" in file2 is different from file1 and the line "g nsd6" is missing
from file2.
I dont want to use "for loop" because my files... (2 Replies)
What do i need to do have the below perl program load 205 million record files into the hash. It currently works on smaller files, but not working on huge files. Any idea what i need to do to modify to make it work with huge files:
#!/usr/bin/perl
$ot1=$ARGV;
$ot2=$ARGV;
open(mfileot1,... (12 Replies)
Hi,
I'm new to perl and i have to write a perl script that will compare to log/txt files and display the differences. Unfortunately I'm not allowed to use any complied binaries or applications like diff or comm.
So far i've across a code like this:
use strict;
use warnings;
my $list1;... (2 Replies)
Hi there, i have been trying different methods and i wonder if somebody could explain to me how i would perform a comparison on two arrays for example
my @array1 = ("gary" ,"peter", "paul");
my @array2 = ("gary" ,"peter", "joe");
I have two arrays above, and i want to something like this... (5 Replies)
I have a main file with variable tokens like this:
name: File1
===========
Destination/Company=@deploy.company@
Destination/Environment=@deploy.env@
Destination/Location=@deploy.location@
Destination/Domain=@deploy.location@
MIG_GatewayAddresses=@deploy.gwaddress@
MIG_URL=@deploy.mig_url@... (1 Reply)
Hi all,
I am trying to compare two arrays in perl using the following code.
foreach $item (@arrayA){
push(@arrayC, $item) unless grep(/$item/, @arrayB); ... (1 Reply)
Hi.
I have three arrays.
@a=('AB','CD','EF');
@b=('AB,'DG',HK');
@c=('DD','TT','MM');
I want to compare the elements of the first two array and if they match then so some substition.
I tried using the if statement using the scalar value of the array but its not giving me any output.
... (7 Replies)
Hello all
im facing some kind of problem i have this string :
functionA() $" "$ functionB("arg1") $" = "$
i will like to replace all the pairs of opening and closing "$" to be something like that
functionA() <#" "#> functionB("arg1") <#" = "#>
i cant of course do is with simple ... (1 Reply)