Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add basic script to check directory content against the manifests #10

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

sarahhunt
Copy link

No description provided.

my $ftp = Net::FTP->new("ftp.1000genomes.ebi.ac.uk", Debug => 0)|| die "Cannot connect to ftp.1000genomes.ebi.ac.uk: $@";
$ftp->login("anonymous",'-anonymous@') || die "Cannot login ", $ftp->message;

open my $dir_list, $ARGV[0] || die "Failed to open dir list $ARGV[0] : $!\n";
Copy link
Collaborator

@likhitha-surapaneni likhitha-surapaneni Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
open my $dir_list, $ARGV[0] || die "Failed to open dir list $ARGV[0] : $!\n";
open my $dir_list, $ARGV[0] or die "Failed to open dir list $ARGV[0] : $!\n";

Interestingly, the code behaves differently for or and || when there is a file opening error. Tested with perl 5.26

my $data_file_list = $ftp->dir();

## write list of all & download manifest
open my $out, ">", "$dir\_data_file_list" ||die "Failed to open file to write list of data files for $dir :$!\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
open my $out, ">", "$dir\_data_file_list" ||die "Failed to open file to write list of data files for $dir :$!\n";
open my $out, ">", "$dir\_data_file_list" or die "Failed to open file to write list of data files for $dir :$!\n";



## check files in manifest available & get sizes
open my $size_log, ">$dir\_data_file_sizes" ||die "Failed to open file to write sizes of data files :$!\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
open my $size_log, ">$dir\_data_file_sizes" ||die "Failed to open file to write sizes of data files :$!\n";
open my $size_log, ">$dir\_data_file_sizes" or die "Failed to open file to write sizes of data files :$!\n";

foreach my $mani ( keys %get){
print "starting on manifest $mani\n";

open my $filelist, $mani || die "Failed to read manifest $mani :$!\n";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
open my $filelist, $mani || die "Failed to read manifest $mani :$!\n";
open my $filelist, $mani or die "Failed to read manifest $mani :$!\n";

$ftp->cwd("$ftp_dir/$dir") || die "Cannot change project directory to $ftp_dir/$dir ", $ftp->message;

## get list of data files per dir
my $data_file_list = $ftp->dir();
Copy link
Collaborator

@likhitha-surapaneni likhitha-surapaneni Sep 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not giving a recursive list according to docs. Do we want to list the files recursively?
Sometimes the manifest file may not be in the root directory, we may miss the manifest file in this case unless we have a convention to have the manifest file in the root directory always.
Ex: 20220711_Strandseq

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants