我有一个fastq文件的文件夹(基因组序列)和一个带有条形码的excel文件(一系列20个核苷酸),我想搜索所有fastq文件中的所有条形码,并获得精确的匹配。我单独使用了"zgrep -u barcode file1 file2 file3“来测试几个条形码,它可以工作,但现在我想创建一个脚本来为我做这件事,因为我有大约200个不同的条形码要在10个文件中查找。我不确定如何才能将zgrep整合到这样的脚本中。
发布于 2021-06-16 17:22:06
你好,欢迎来到堆栈溢出。我非常抱歉,这里的一些人阅读了你的非IT背景,并肯定会含糊其辞地回答你。
关于你的问题:
首先,如果可能,使用以下PowerShell命令在您的计算机上安装ImportExcel模块:
Install-Module -Name ImportExcel -Scope CurrentUser -Force之后,我们可以运行这个小脚本,对Excel文档中的每一行执行zgrep:
# Change this to the path to your file
$FilePath = "C:\Test123.xlsx"
$excelContent = Import-Excel -Path $FilePath
foreach($row in $excelContent)
{
# Change columnName to the Name of the columne the barcodes are in
zgrep -u $row.columnName file1 file2 file3
}这应该是您解决问题所需的全部内容。
https://stackoverflow.com/questions/67993985
复制相似问题