2 つのシーケンス ファイルを結合したので、2 つのシーケンスを持つ 1 つのファイルがあります。これらの 2 つのシーケンスを @char 配列に分割しました。これは、後で文字ごとに比較する必要があるためです。ただし、シーケンスの 1 つは 2 行にあります。結合機能を使って2行を結合したいのですが、方法がわかりません。
元:
シーケンス 1
ACGTATATATTATATCTGGCGCTATCGATGCTATCGAT
CGATGCGCG
シーケンス 2
AGTGAGCGTAGCTAGCGGCGCGATCTAGCTA
これまでの私のコード
#!usr/bin/perl
use strict;
use warnings;
# open file 1
open (my $seq1, "<", "file1.fa") or die $!;
# open file 2
open (my $seq2, "<", "file2.fa") or die $!;
# open combined file
open (my $combined, ">", "combined.txt") or die $!;
# read file 1, skip header line, write to combined file
while (my $line = <$seq1>) {
if($line =~ />/) {
next;
}
else {
print $combined "$line\n";
}
}
# read file 2, skip header line, write to combined file on new line
while (my $line2 = <$seq2>) {
if ($line2 =~ />/) {
next;
}
else {
print $combined "$line2\n";
}
}
# need to open combined file for reading
open (my $combined2, "<", "combined.txt") or die $!;
# read through combined file line by line
while (my $seqs = <$combined2>) {
chomp($seqs);
# split sequences into characters
my @chars = split(//, $seqs);
# the sequence from file1 is on 2 separate lines. Need to join these
# lines together