Smeb has asked for the wisdom of the Perl Monks concerning the following question:
Hi guys,
As the title says, what I wanted to do is take one DNA file and put it into an array, do the same to a second DNA file and then insert one of the files somewhere in the other.
I have 2 files, DNA3 and DNA4
The content within the DNA3 file is: ATCGC
The content within the DNA4 file is: AAATTGC
What I want to do is to insert DNA4 into position #1 in DNA3, so the result would look like this: AAAATTGCTCGC
Currently my code looks like this:
#!/usr/bin/perl -w $DNA3file = 'testDNA3'; open(DNA3handle, $DNA3file); @DNA3 = <DNA3handle>; $DNA4file = 'testDNA4'; open(DNA4handle, $DNA4file); @DNA4 = <DNA4handle>; splice (@DNA3, 1, 0, @DNA4); print @DNA3, "\n"; exit;
However, what is displayed really puzzled me:
ATCGC
AAATTGC
*Note, in my complier there isn't the space in between the output*
For the life of me I can't figure out what is wrong, I can run the above operation fine if I manually insert the DNA sequences into an array, but for large DNA set that is simply not possible. Really appreciate any help here, thanks for your time!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Splice an array into another array
by huck (Prior) on Jun 23, 2017 at 22:45 UTC | |
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:10 UTC | |
by Smeb (Novice) on Jun 23, 2017 at 22:54 UTC | |
by huck (Prior) on Jun 23, 2017 at 23:10 UTC | |
by Smeb (Novice) on Jun 23, 2017 at 23:24 UTC | |
|
Re: Splice an array into another array
by AnomalousMonk (Archbishop) on Jun 24, 2017 at 05:33 UTC | |
by Smeb (Novice) on Jun 25, 2017 at 17:53 UTC | |
|
Re: Splice an array into another array
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:21 UTC | |
|
Re: Splice an array into another array
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:00 UTC | |
by Smeb (Novice) on Jun 23, 2017 at 23:17 UTC | |
by huck (Prior) on Jun 23, 2017 at 23:25 UTC | |
by Smeb (Novice) on Jun 23, 2017 at 23:33 UTC | |
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:49 UTC | |
| |
by AnomalousMonk (Archbishop) on Jun 23, 2017 at 23:35 UTC | |
by Smeb (Novice) on Jun 23, 2017 at 23:37 UTC |