This is a test version of Biostars. For the public version, visit https://www.biostars.org.
error in sed usage

Hello,

I am using this loop for a software"

RUN=$(printf "%02d" ${SLURM_ARRAY})
INPUT_DIR=/path
OUTPUT_DIR=/path
echo "RUN"
INPUT_FILE=$(ls $INPUT_DIR/*.bed | sed -n ${RUN}p)
SAMPLE=$(basename "$INPUT_FILE" .bed)
echo "RUN #${RUN} with sample ${SAMPLE}"
freebayes -f genome.fasta  \
          -L genome_1.txt \
          --targets ${INPUT_FILE}  > ${OUTPUT_DIR}/${SAMPLE}_.vcf

But I am getting error:

sed: -e expression #1, char 3: invalid usage of line address 0

Thank you for the help.

sequencing

This is not reproducible, please give examples on what the variables store.

Edit: Deleted, OP unable to answer questions.

I have added the code that I used it for. Please let me know if it is works now or not. Thank you!

That's not what I mean. Please give a representative example of the content of each variable so we know what it contains, not code, just a string what they contain.

RUN represents 10 bed files; INPUT_DIR represents path to bed files; OUTPUT_DIR represents path for vcf files to be made

what are you trying to do with sed? or what is the expected value of INPUT_FILE?

INPUT_FILE is expected to give each of the bed file name along with path to run with an array.

I am not sure if freebayes --targets accepts more than one file, but in case you will need to put together in a single string, like:

INPUT_FILE=$(ls $INPUT_DIR/*.bed | perl -pe "s/\n/,/g")

0 answers

No answers yet.

Log in to answer this question.